Skip to content

Commit ef08bac

Browse files
GoGoComputerclaude
andcommitted
docs(faq): backfill reachability proof + upstream-escape-hatch evidence
The 'Ollama not reachable' FAQ entry stated the cause and fix, but the diagnostic detail (curl comparison, grep findings, hardcoded source pointers) lived only in CHANGELOG. User asked whether the full chat-side explanation was actually in the docs — the actionable fix was, the evidence wasn't. Add a nested <details> "Technical background" block inside the FAQ entry (KO + EN). Casual readers see the actionable fix only; curious readers expand for: · the 127.0.0.1 vs host.docker.internal reachability comparison table, with a one-liner curl that reproduces both results · the three checks proving OpenClaw upstream has no escape hatch (no process.env.OLLAMA_* lookup, no --ollama-base-url flag, initialValue hardcoded in setup-CtbggUuv.js with file path) · what setup.sh actually does pre-flight (5-step trace) so the transparency around 'why we can't just auto-fix it' is in one place, alongside the workaround. No code or behavior change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 7c7adac commit ef08bac

2 files changed

Lines changed: 149 additions & 0 deletions

File tree

‎README.en.md‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,81 @@ docker compose run --rm --entrypoint sh openclaw-cli \
670670
```
671671

672672
> Note: OpenClaw upstream doesn't honor any env var or CLI flag for this URL — it can only be entered via the wizard prompt. So `setup.sh` can't inject the right value; clear pre-flight guidance is the best we can do.
673+
674+
<details>
675+
<summary>🔬 Technical background — reachability proof + why we can't auto-fix it</summary>
676+
677+
**Direct `curl` from inside the cli container:**
678+
679+
| URL | Reachable? | Why |
680+
|---|---|---|
681+
| `http://127.0.0.1:11434` (wizard default) | **✗ NOT REACHABLE** | Loopback inside the container points to the container itself |
682+
| `http://host.docker.internal:11434` (correct) | **✓ REACHABLE** | Docker Desktop's special hostname injected into containers; points back to the host machine |
683+
684+
Reproduce:
685+
```bash
686+
cd ~/DEV/openclaw
687+
docker compose run --rm --entrypoint sh openclaw-cli -c '
688+
curl -sf --max-time 3 http://127.0.0.1:11434/api/tags && echo OK_127 || echo FAIL_127;
689+
curl -sf --max-time 3 http://host.docker.internal:11434/api/tags >/dev/null && echo OK_HDI || echo FAIL_HDI
690+
'
691+
# → FAIL_127
692+
# OK_HDI
693+
```
694+
695+
**No upstream escape hatch — evidence:**
696+
697+
1. **No env var lookup** — grep `/app/dist` for `process.env.OLLAMA*`:
698+
```bash
699+
docker compose run --rm --entrypoint sh openclaw-cli -c \
700+
'grep -hroE "process\.env\.[A-Z_]*OLLAMA[A-Z_]*" /app/dist | sort -u'
701+
# → (no output. No OLLAMA URL env lookup at all)
702+
```
703+
`OLLAMA_API_KEY` is read but only for auth, not for the URL.
704+
705+
2. **No CLI flag** — `onboard --help` doesn't include `--ollama-base-url`:
706+
```
707+
--custom-base-url <url> # only for the 'custom' provider, not ollama
708+
--auth-choice ... ollama # this picks ollama as the provider; doesn't set the URL
709+
```
710+
711+
3. **Hardcoded prompt** — wizard source (`/app/dist/setup-CtbggUuv.js`):
712+
```js
713+
async function promptForOllamaBaseUrl(prompter) {
714+
return resolveOllamaApiBase((await prompter.text({
715+
message: "Ollama base URL",
716+
initialValue: "http://127.0.0.1:11434", // ← hardcoded
717+
placeholder: "http://127.0.0.1:11434",
718+
validate: (value) => value?.trim() ? void 0 : "Required"
719+
}) ?? "").trim().replace(/\/+$/, ""));
720+
}
721+
```
722+
The `OLLAMA_DEFAULT_BASE_URL` is also a plain constant (`/app/dist/defaults-JS7ic3Yx.js`):
723+
```js
724+
const OLLAMA_DEFAULT_BASE_URL = "http://127.0.0.1:11434";
725+
```
726+
727+
**Conclusion**: no env var, no CLI flag, and the prompt's `initialValue` is hardcoded — so `setup.sh` has no way to inject the correct URL before the wizard launches. v0.2.8's fix is the best alternative: **pre-flight reachability check + a loud yellow warning box** telling the user the exact value to type.
728+
729+
**What `setup.sh` actually does before launching the wizard** (`cmd/setup.sh` v0.2.8):
730+
731+
```
732+
1) docker compose run --rm --no-deps openclaw-cli curl http://host.docker.internal:11434/api/tags
733+
→ response OK → host_ollama_ok=1
734+
→ response NOK → host_ollama_ok=0
735+
2) If OK, print a yellow box:
736+
┌─────────────────────────────────────────────────────────────┐
737+
│ ⚠ When the wizard reaches "Ollama base URL", enter: │
738+
│ http://host.docker.internal:11434 │
739+
│ The default http://127.0.0.1:11434 points at the container │
740+
│ itself, not the host — so it can't reach your local Ollama. │
741+
└─────────────────────────────────────────────────────────────┘
742+
3) If NOK, warn + confirm (Ollama down, or network is in isolated mode)
743+
4) docker compose run --rm openclaw-cli onboard
744+
5) If the wizard exits non-zero, the closing banner explicitly suggests
745+
the URL fix in addition to the generic "rerun to resume" hint.
746+
```
747+
</details>
673748
</details>
674749
675750
<details>

‎README.md‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,80 @@ docker compose run --rm --entrypoint sh openclaw-cli \
861861
```
862862

863863
> 참고: OpenClaw 본체는 이 URL 을 환경변수/CLI 플래그로 받지 않고 마법사 안에서만 입력 가능합니다. 그래서 setup.sh 가 자동 주입할 수는 없고, **명확히 안내하는 게 최선**.
864+
865+
<details>
866+
<summary>🔬 기술 배경 (펼치기) — 도달성 비교 + upstream 우회 불가 증거</summary>
867+
868+
**컨테이너 안에서 직접 curl 한 결과:**
869+
870+
| URL | 도달성 | 이유 |
871+
|---|---|---|
872+
| `http://127.0.0.1:11434` (마법사 기본값) | **✗ NOT REACHABLE** | 컨테이너 안의 loopback 은 컨테이너 자신을 가리킴 |
873+
| `http://host.docker.internal:11434` (정답) | **✓ REACHABLE** | Docker Desktop 이 컨테이너에 자동 주입하는 특수 호스트명, 호스트 머신을 가리킴 |
874+
875+
직접 재현:
876+
```bash
877+
cd ~/DEV/openclaw
878+
docker compose run --rm --entrypoint sh openclaw-cli -c '
879+
curl -sf --max-time 3 http://127.0.0.1:11434/api/tags && echo OK_127 || echo FAIL_127;
880+
curl -sf --max-time 3 http://host.docker.internal:11434/api/tags >/dev/null && echo OK_HDI || echo FAIL_HDI
881+
'
882+
# → FAIL_127
883+
# OK_HDI
884+
```
885+
886+
**OpenClaw 본체에 우회로 없음 — 검증 흔적:**
887+
888+
1. **env 변수 검사** — `/app/dist` 전체에서 `process.env.OLLAMA*` 검색
889+
```bash
890+
docker compose run --rm --entrypoint sh openclaw-cli -c \
891+
'grep -hroE "process\.env\.[A-Z_]*OLLAMA[A-Z_]*" /app/dist | sort -u'
892+
# → (출력 없음. OLLAMA URL 관련 env 검사 없음)
893+
```
894+
참고로 `OLLAMA_API_KEY` 만 읽지만 이건 인증용이지 URL 무관.
895+
896+
2. **CLI 플래그 검사** — `onboard --help` 출력에 `--ollama-base-url` 같은 플래그가 있는지
897+
```
898+
--custom-base-url <url> # 있긴 한데 'custom' provider 전용
899+
--auth-choice ... ollama # 'ollama' 는 provider 선택 옵션일 뿐, URL 지정 아님
900+
```
901+
Ollama 전용 base URL 플래그 **없음**.
902+
903+
3. **하드코딩 출처** — 마법사 프롬프트 정의 (`/app/dist/setup-CtbggUuv.js`)
904+
```js
905+
async function promptForOllamaBaseUrl(prompter) {
906+
return resolveOllamaApiBase((await prompter.text({
907+
message: "Ollama base URL",
908+
initialValue: "http://127.0.0.1:11434", // ← 하드코딩
909+
placeholder: "http://127.0.0.1:11434",
910+
validate: (value) => value?.trim() ? void 0 : "Required"
911+
}) ?? "").trim().replace(/\/+$/, ""));
912+
}
913+
```
914+
`OLLAMA_DEFAULT_BASE_URL` 도 단순 상수 (`/app/dist/defaults-JS7ic3Yx.js`):
915+
```js
916+
const OLLAMA_DEFAULT_BASE_URL = "http://127.0.0.1:11434";
917+
```
918+
919+
**결론**: env 변수도 플래그도 없고 prompt initialValue 가 하드코딩이므로, `setup.sh` 가 마법사 시작 전에 값을 주입할 방법이 없습니다. 그래서 v0.2.8 의 fix 는 **사전 점검 + 화면에 큰 경고 박스**로 사용자에게 정확한 입력값을 알려주는 방식.
920+
921+
**setup.sh 가 마법사 띄우기 전 실제로 하는 일** (`cmd/setup.sh` v0.2.8):
922+
923+
```
924+
1) docker compose run --rm --no-deps openclaw-cli curl http://host.docker.internal:11434/api/tags
925+
→ 응답 OK 면 host_ollama_ok=1, NOK 면 0
926+
2) 응답 OK → 노란색 박스 출력:
927+
┌─────────────────────────────────────────────────────────────┐
928+
│ ⚠ 마법사 안에서 "Ollama base URL" 단계가 나오면 다음을 입력 │
929+
│ http://host.docker.internal:11434 │
930+
│ 기본값으로 보이는 http://127.0.0.1:11434 는 컨테이너 자신을 │
931+
│ 가리켜서 호스트 Ollama 에 닿지 못합니다. │
932+
└─────────────────────────────────────────────────────────────┘
933+
3) 응답 NOK → warn + confirm 후 진행 (Ollama 꺼져 있거나 isolated 모드)
934+
4) docker compose run --rm openclaw-cli onboard 실행
935+
5) 마법사가 non-zero 로 끝나면 종료 메시지에 URL 수정 힌트 표시
936+
```
937+
</details>
864938
</details>
865939
866940
<details>

0 commit comments

Comments
 (0)