Repository navigation
feat(onboard): detect Windows-host Ollama from WSL via host.docker.inernal - #2707
Conversation
…ternal Signed-off-by: zyang-dev <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds WSL-aware, cached Ollama host resolution: probes candidate hosts ( Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client/UI
participant Resolver as findReachableOllamaHost()
participant HostA as 127.0.0.1:/api/tags
participant HostB as host.docker.internal:/api/tags
participant Cache as HostCache
Client->>Resolver: request resolved host
Resolver->>Cache: check cached host
alt cache miss
Resolver->>HostA: GET /api/tags (short timeouts)
alt HostA responds
HostA-->>Resolver: 200 OK
Resolver->>Cache: store HostA
Resolver-->>Client: return HostA
else HostA fails
Resolver->>HostB: GET /api/tags (short timeouts)
alt HostB responds
HostB-->>Resolver: 200 OK
Resolver->>Cache: store HostB
Resolver-->>Client: return HostB
else HostB fails
Resolver-->>Client: return null
end
end
else cache hit
Cache-->>Resolver: cached host
Resolver-->>Client: return cached host
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lib/local-inference.ts (1)
294-297:⚠️ Potential issue | 🟡 MinorInconsistent error message: hardcoded
127.0.0.1should use resolved host.If Ollama was detected on
host.docker.internal(WSL scenario), this message incorrectly states it's "responding on 127.0.0.1". The message at line 271 correctly usesgetResolvedOllamaHost()— this should match.🔧 Proposed fix
case "ollama-local": return { ok: false, - message: `Local Ollama is responding on 127.0.0.1, but containers cannot reach the auth proxy at http://host.openshell.internal:${OLLAMA_CONTAINER_PORT}. Ensure the Ollama auth proxy is running.`, + message: `Local Ollama is responding on ${getResolvedOllamaHost()}, but containers cannot reach the auth proxy at http://host.openshell.internal:${OLLAMA_CONTAINER_PORT}. Ensure the Ollama auth proxy is running.`, };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/local-inference.ts` around lines 294 - 297, The error message in the switch branch for "ollama-local" incorrectly hardcodes "127.0.0.1"; update the returned message to use getResolvedOllamaHost() (same as the earlier branch) and include OLLAMA_CONTAINER_PORT so the message reads consistently (e.g., "Local Ollama is responding on <getResolvedOllamaHost()>, but containers cannot reach the auth proxy at http://host.openshell.internal:<OLLAMA_CONTAINER_PORT>. Ensure the Ollama auth proxy is running."). Target the case "ollama-local" return object to swap the hardcoded host for the getResolvedOllamaHost() call.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/onboard.ts`:
- Around line 4251-4255: The current code converts the result of
findReachableOllamaHost() to a boolean (ollamaRunning), losing whether the
resolved host was "127.0.0.1" or "host.docker.internal"; change this to capture
and retain the resolved host string (e.g., const ollamaHost =
findReachableOllamaHost()) and derive the running flag from it (const
ollamaRunning = ollamaHost !== null), then update downstream labels/logging to
use ollamaHost (with a safe fallback like "localhost" where UI text expects a
host) instead of always showing "localhost"; after making this change, run the
recommended onboarding E2E jobs (cloud-e2e, sandbox-operations-e2e,
rebuild-openclaw-e2e) before merging.
---
Outside diff comments:
In `@src/lib/local-inference.ts`:
- Around line 294-297: The error message in the switch branch for "ollama-local"
incorrectly hardcodes "127.0.0.1"; update the returned message to use
getResolvedOllamaHost() (same as the earlier branch) and include
OLLAMA_CONTAINER_PORT so the message reads consistently (e.g., "Local Ollama is
responding on <getResolvedOllamaHost()>, but containers cannot reach the auth
proxy at http://host.openshell.internal:<OLLAMA_CONTAINER_PORT>. Ensure the
Ollama auth proxy is running."). Target the case "ollama-local" return object to
swap the hardcoded host for the getResolvedOllamaHost() call.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 2b144ba5-5a77-45f1-952d-5c1d0221609f
📒 Files selected for processing (2)
src/lib/local-inference.tssrc/lib/onboard.ts
| // findReachableOllamaHost probes 127.0.0.1 first and, on WSL, falls back | ||
| // to host.docker.internal so a Windows-host Ollama bound to a non-loopback | ||
| // interface is detected. The result is cached for the rest of the onboard | ||
| // run and consumed by the Ollama lifecycle helpers in local-inference.ts. | ||
| const ollamaRunning = findReachableOllamaHost() !== null; |
There was a problem hiding this comment.
Keep the resolved Ollama host string for accurate UX on WSL.
At Line 4255, host resolution is reduced to a boolean. That works for branching, but it drops whether the selected host is 127.0.0.1 or host.docker.internal. Downstream labels/logs still say localhost, which is misleading in the Windows-host Ollama case.
💡 Suggested patch
- const ollamaRunning = findReachableOllamaHost() !== null;
+ const reachableOllamaHost = findReachableOllamaHost();
+ const ollamaRunning = reachableOllamaHost !== null;
...
- label:
- `Local Ollama (localhost:${OLLAMA_PORT})${ollamaRunning ? " — running" : ""}` +
+ label:
+ `Local Ollama (${reachableOllamaHost ?? "localhost"}:${OLLAMA_PORT})${ollamaRunning ? " — running" : ""}` +
(ollamaRunning ? " (suggested)" : ""),
...
- console.log(` ✓ Using Ollama on localhost:${OLLAMA_PORT}`);
+ console.log(
+ ` ✓ Using Ollama on ${reachableOllamaHost ?? "127.0.0.1"}:${OLLAMA_PORT}`,
+ );Also, since this touches core onboarding flow, run the recommended onboarding E2E jobs before merge (cloud-e2e, sandbox-operations-e2e, rebuild-openclaw-e2e). As per coding guidelines: src/lib/onboard.ts is core onboarding logic and these E2E jobs are explicitly recommended.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/lib/onboard.ts` around lines 4251 - 4255, The current code converts the
result of findReachableOllamaHost() to a boolean (ollamaRunning), losing whether
the resolved host was "127.0.0.1" or "host.docker.internal"; change this to
capture and retain the resolved host string (e.g., const ollamaHost =
findReachableOllamaHost()) and derive the running flag from it (const
ollamaRunning = ollamaHost !== null), then update downstream labels/logging to
use ollamaHost (with a safe fallback like "localhost" where UI text expects a
host) instead of always showing "localhost"; after making this change, run the
recommended onboarding E2E jobs (cloud-e2e, sandbox-operations-e2e,
rebuild-openclaw-e2e) before merging.
There was a problem hiding this comment.
Reduced to a boolean to avoid an unused-variable lint warning, since this PR doesn't consume the resolved host. The following PR will switch it back to the host string and use it for labels and logs.
There was a problem hiding this comment.
@zyang-dev Thanks for the context. If you’d like to keep this PR behaviorally scoped but still avoid the unused-var lint and improve the UX now, here’s a tiny patch that retains and uses the resolved host string just for the label and WSL log. It keeps the rest of the flow unchanged and won’t trip the linter because the variable is consumed.
diff --git a/src/lib/onboard.ts b/src/lib/onboard.ts
@@
// Detect local inference options
const hasOllama = hostCommandExists("ollama");
- // findReachableOllamaHost probes 127.0.0.1 first and, on WSL, falls back
- // to host.docker.internal so a Windows-host Ollama bound to a non-loopback
- // interface is detected. The result is cached for the rest of the onboard
- // run and consumed by the Ollama lifecycle helpers in local-inference.ts.
- const ollamaRunning = findReachableOllamaHost() !== null;
+ // findReachableOllamaHost probes 127.0.0.1 first and, on WSL, falls back
+ // to host.docker.internal. The result is cached for this onboard run.
+ const reachableOllamaHost = findReachableOllamaHost();
+ const ollamaRunning = reachableOllamaHost !== null;
@@
- if (hasOllama || ollamaRunning) {
+ if (hasOllama || ollamaRunning) {
options.push({
key: "ollama",
- label:
- `Local Ollama (localhost:${OLLAMA_PORT})${ollamaRunning ? " — running" : ""}` +
+ label:
+ `Local Ollama (${reachableOllamaHost ?? "localhost"}:${OLLAMA_PORT})${ollamaRunning ? " — running" : ""}` +
(ollamaRunning ? " (suggested)" : ""),
});
}
@@
} else if (selected.key === "ollama") {
if (!checkOllamaPortsOrWarn()) continue selectionLoop;
if (!ollamaRunning) {
console.log(" Starting Ollama...");
const ollamaEnv = isWsl() ? "" : `OLLAMA_HOST=0.0.0.0:${OLLAMA_PORT} `;
runShell(`${ollamaEnv}ollama serve > /dev/null 2>&1 &`, { ignoreError: true });
sleep(2);
if (!isWsl()) printOllamaExposureWarning();
}
- if (isWsl()) {
- // WSL2 doesn't need the proxy — Docker can reach the host directly.
- console.log(` ✓ Using Ollama on localhost:${OLLAMA_PORT}`);
- } else {
+ if (isWsl()) {
+ // WSL2 doesn't need the proxy — Docker can reach the host directly.
+ console.log(
+ ` ✓ Using Ollama on ${reachableOllamaHost ?? "127.0.0.1"}:${OLLAMA_PORT}`,
+ );
+ } else {
if (!startOllamaAuthProxy()) {
process.exit(1);
}
console.log(
` ✓ Using Ollama on localhost:${OLLAMA_PORT} (proxy on :${OLLAMA_PROXY_PORT})`,
);
}If you’d rather keep this PR exactly as-is and handle labels/logs in the follow-up, no problem—let me know and I can open a tracking issue to capture the UX fix.
Also, since this touches src/lib/onboard.ts (core onboarding), please run the recommended E2E jobs before merge:
- cloud-e2e
- sandbox-operations-e2e
- rebuild-openclaw-e2e
Command you can copy-paste:
- gh workflow run nightly-e2e.yaml --ref feat/wsl-ollama-detect-host -f jobs=cloud-e2e,sandbox-operations-e2e,rebuild-openclaw-e2e
Want me to open the follow-up issue for the label/log polish if you decide to defer?
🧠 Learnings used
Learnt from: jyaunches
Repo: NVIDIA/NemoClaw PR: 2495
File: src/lib/onboard-inference-probes.ts:135-323
Timestamp: 2026-04-27T13:06:57.456Z
Learning: In NVIDIA/NemoClaw PRs that extract code from `src/lib/onboard.ts` into new behavior-preserving modules (e.g., `src/lib/onboard-providers.ts`, `src/lib/onboard-ollama-proxy.ts`, `src/lib/onboard-inference-probes.ts`), reviewers should avoid requesting refactors/complexity/style improvements in the extracted modules as part of the same PR. Only check for correctness and behavior preservation; defer non-behavior-preserving cleanup to separate follow-up PRs.
Learnt from: ericksoa
Repo: NVIDIA/NemoClaw PR: 2554
File: src/lib/onboard.ts:698-700
Timestamp: 2026-04-28T17:22:19.715Z
Learning: For NVIDIA/NemoClaw credential environment hydration/migration, implement fill-only-if-missing semantics across the onboarding and credentials modules: (1) In src/lib/credentials.ts, stageLegacyCredentialsToEnv() should only consider an allowlisted set of credential keys and should set process.env[key] only when getCredential(key) returns null (never override an explicitly provided env export). Treat blank/whitespace values as unset. (2) In src/lib/onboard.ts, hydrateCredentialEnv(envName) must first read getCredential(envName) and only call stageLegacyCredentialsToEnv() when that specific key is missing; after staging, re-read and then set process.env[envName]. This ensures stale credentials.json values cannot override explicitly provided environment credentials.
There was a problem hiding this comment.
I'd rather keep this PR exactly as-is and handle labels/logs in the follow-up.
There was a problem hiding this comment.
@zyang-dev Got it — we’ll keep this PR behavior-scoped and handle the labels/logs in a follow-up.
Would you like me to open a tracking issue for the follow-up? Proposed:
- Title: UX: show resolved Ollama host in onboard provider label and WSL log
- Scope:
- Capture reachable host via findReachableOllamaHost() in setupNim.
- Use it in the “Local Ollama (…)” option label and the WSL “Using Ollama on …” log line.
- Keep the rest of the flow unchanged; ensure no unused-var lint.
Also, since this touches src/lib/onboard.ts, please run the recommended E2E jobs before merging:
- gh workflow run nightly-e2e.yaml --ref feat/wsl-ollama-detect-host -f jobs=cloud-e2e,sandbox-operations-e2e,rebuild-openclaw-e2e
If you want, I can file the issue and/or kick off those workflows for you — just say the word.
🧠 Learnings used
Learnt from: jyaunches
Repo: NVIDIA/NemoClaw PR: 2495
File: src/lib/onboard-inference-probes.ts:135-323
Timestamp: 2026-04-27T13:06:57.456Z
Learning: In NVIDIA/NemoClaw PRs that extract code from `src/lib/onboard.ts` into new behavior-preserving modules (e.g., `src/lib/onboard-providers.ts`, `src/lib/onboard-ollama-proxy.ts`, `src/lib/onboard-inference-probes.ts`), reviewers should avoid requesting refactors/complexity/style improvements in the extracted modules as part of the same PR. Only check for correctness and behavior preservation; defer non-behavior-preserving cleanup to separate follow-up PRs.
Learnt from: ericksoa
Repo: NVIDIA/NemoClaw PR: 2554
File: src/lib/onboard.ts:698-700
Timestamp: 2026-04-28T17:22:19.715Z
Learning: For NVIDIA/NemoClaw credential environment hydration/migration, implement fill-only-if-missing semantics across the onboarding and credentials modules: (1) In src/lib/credentials.ts, stageLegacyCredentialsToEnv() should only consider an allowlisted set of credential keys and should set process.env[key] only when getCredential(key) returns null (never override an explicitly provided env export). Treat blank/whitespace values as unset. (2) In src/lib/onboard.ts, hydrateCredentialEnv(envName) must first read getCredential(envName) and only call stageLegacyCredentialsToEnv() when that specific key is missing; after staging, re-read and then set process.env[envName]. This ensures stale credentials.json values cannot override explicitly provided environment credentials.
Signed-off-by: zyang-dev <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/local-inference.ts`:
- Around line 48-54: The host probe in findReachableOllamaHost uses plain curl
which can block; modify the curl invocation built inside findReachableOllamaHost
(and used via runCapture/runCaptureImpl over ollamaCandidateHosts with
OLLAMA_PORT) to include explicit short timeouts (e.g., --connect-timeout and
--max-time) so each probe fails fast on blackholed hosts; update the capture
command array to add these timeout flags (choose small values like 2s/4s) and
keep ignoreError:true so discovery continues to the next host.
- Around line 295-297: The error message returned by the block that currently
constructs the container-reachability string (referencing
getResolvedOllamaHost() and OLLAMA_CONTAINER_PORT) should be made WSL-aware:
detect WSL (use the existing isWsl()/isWSL() helper or add a simple check) and,
when running under WSL, return a different remediation that explains Ollama is
contacted directly from WSL and no auth-proxy is required; otherwise keep the
existing guidance about ensuring the Ollama auth proxy is running at
http://host.openshell.internal:${OLLAMA_CONTAINER_PORT}. Adjust the conditional
around the current return so the message changes based on the WSL check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 4c99a57b-fdfd-4a51-8098-250481a2bf1a
📒 Files selected for processing (1)
src/lib/local-inference.ts
…WSL-aware Signed-off-by: zyang-dev <[email protected]>
…t-host Signed-off-by: zyang-dev <[email protected]> # Conflicts: # src/lib/local-inference.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/lib/local-inference.ts (1)
42-85: ⚡ Quick winAdd regression coverage for the WSL fallback and cache semantics.
This logic is platform- and state-dependent now. A focused unit suite around candidate order, cache reuse, cache-miss retry behavior, and
resetOllamaHostCache()would make this path much safer to change.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/local-inference.ts` around lines 42 - 85, Add unit tests exercising ollamaCandidateHosts(), findReachableOllamaHost(), getResolvedOllamaHost(), and resetOllamaHostCache(): cover WSL vs non-WSL candidate order, successful probe returning first reachable host, caching behavior across repeated findReachableOllamaHost() calls (no re-probe when cache populated), retry behavior when initial probes fail then succeed after reset, and that resetOllamaHostCache() clears the cached host; use dependency injection of runCaptureImpl to simulate curl success/failure and toggle isWsl() in tests to validate fallback to OLLAMA_HOST_DOCKER_INTERNAL on WSL.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/local-inference.ts`:
- Around line 77-80: The getter getResolvedOllamaHost currently hides whether a
probe has ever succeeded by always returning OLLAMA_LOCALHOST when
_resolvedOllamaHost is empty; change it to surface the empty cache so callers
can retry resolution: have getResolvedOllamaHost return undefined (or a nullable
type) when _resolvedOllamaHost is unset instead of defaulting to
OLLAMA_LOCALHOST, and update call sites that use getResolvedOllamaHost to call
findReachableOllamaHost() when the result is undefined (referencing
getResolvedOllamaHost, _resolvedOllamaHost, OLLAMA_LOCALHOST, and
findReachableOllamaHost).
---
Nitpick comments:
In `@src/lib/local-inference.ts`:
- Around line 42-85: Add unit tests exercising ollamaCandidateHosts(),
findReachableOllamaHost(), getResolvedOllamaHost(), and resetOllamaHostCache():
cover WSL vs non-WSL candidate order, successful probe returning first reachable
host, caching behavior across repeated findReachableOllamaHost() calls (no
re-probe when cache populated), retry behavior when initial probes fail then
succeed after reset, and that resetOllamaHostCache() clears the cached host; use
dependency injection of runCaptureImpl to simulate curl success/failure and
toggle isWsl() in tests to validate fallback to OLLAMA_HOST_DOCKER_INTERNAL on
WSL.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ca1700f8-26e3-4455-bba8-4a840fd9bea7
📒 Files selected for processing (2)
src/lib/local-inference.tssrc/lib/onboard.ts
| // Returns the resolved host if a probe has succeeded, otherwise OLLAMA_LOCALHOST. | ||
| // Used by URL-builder helpers that need a string and don't want to re-probe. | ||
| export function getResolvedOllamaHost(): string { | ||
| return _resolvedOllamaHost ?? OLLAMA_LOCALHOST; |
There was a problem hiding this comment.
Retry WSL host resolution when the cache is still empty.
These helpers only read the cached success and otherwise fall back to 127.0.0.1. If the first findReachableOllamaHost() happens before Ollama is started, the later validation/model/probe paths never retry host.docker.internal, so a Windows-host Ollama that comes up mid-onboarding stays invisible for the rest of the run.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/lib/local-inference.ts` around lines 77 - 80, The getter
getResolvedOllamaHost currently hides whether a probe has ever succeeded by
always returning OLLAMA_LOCALHOST when _resolvedOllamaHost is empty; change it
to surface the empty cache so callers can retry resolution: have
getResolvedOllamaHost return undefined (or a nullable type) when
_resolvedOllamaHost is unset instead of defaulting to OLLAMA_LOCALHOST, and
update call sites that use getResolvedOllamaHost to call
findReachableOllamaHost() when the result is undefined (referencing
getResolvedOllamaHost, _resolvedOllamaHost, OLLAMA_LOCALHOST, and
findReachableOllamaHost).
Automated PR review summaryReviewed PR #2707: feat(onboard): detect Windows-host Ollama from WSL via host.docker.inernal Recommendation
Installation and setup findings
What was validated
Failing tests and unresolved impact
Passing tests and why they matteredPassing test 1: WSL fallback host ordering and downstream host reuse
Passing test 2: Native Linux sandbox does not incorrectly depend on host.docker.internal
Bottom line
|
…#2768) <!-- markdownlint-disable MD041 --> ## Summary When Ollama runs on the Windows host (now detected from WSL via `host.docker.internal` after #2707), `nemoclaw onboard` could detect it but couldn't pull new models because `pullOllamaModel` shells out to the `ollama` CLI. This PR adds an HTTP `/api/pull` path that runs only when the resolved host is `host.docker.internal`. Native Linux/macOS keeps the existing CLI shell-out unchanged. ## Changes - `src/lib/onboard-ollama-proxy.ts`: - Renamed existing `pullOllamaModel` to `pullOllamaModelViaCli` (no logic change). - Added `pullOllamaModelViaHttp(model)`: streams `POST /api/pull` via curl with `--connect-timeout 10 --max-time 600`, parses NDJSON, renders an in-place progress bar with throttled status updates. Falls back to throttled per-line output when stdout is not a TTY. - Added async dispatcher `pullOllamaModel`: routes to HTTP only when `getResolvedOllamaHost() ===OLLAMA_HOST_DOCKER_INTERNAL`; otherwise CLI. - Made `prepareOllamaModel` async so the dispatcher can await. - Distinct timeout message on curl exit 28; resume hint on any non-zero exit (`Already-downloaded layers are kept; re-running the pull resumes them.`). - `src/lib/onboard.ts`: two `prepareOllamaModel` callers updated to `await`. ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Verification <!-- Check each item you ran and confirmed. Leave unchecked items you skipped. --> - [x] `npx prek run --all-files` passes - [x] `npm test` passes - [ ] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed - [ ] Docs updated for user-facing behavior changes - [ ] `make docs` builds without warnings (doc changes only) - [ ] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) ## AI Disclosure - [x] AI-assisted — tool: Claude Code --- <!-- DCO sign-off required by CI. Run: git config user.name && git config user.email --> Signed-off-by: zyang-dev <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Asynchronous model pulling with real-time streamed progress and condensed non-interactive status updates. * Automatic selection of an HTTP-based pull strategy for Windows/Docker hosts to improve compatibility. * **Bug Fixes** * Pull results are now awaited before proceeding, ensuring accurate success/failure handling. * Improved error reporting that clearly distinguishes timeouts from other connection failures. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: zyang-dev <[email protected]>
Summary
When Ollama runs on the Windows host (a common WSL setup), the WSL onboard CLI couldn't detect it because Ollama's default
127.0.0.1binding lives in a different network namespace from WSL. This adds ahost.docker.internalfallback probe so WSL users with Windows-host Ollama (OLLAMA_HOST=0.0.0.0) get auto-detection without manual configuration.Changes
src/lib/local-inference.ts:findReachableOllamaHost()probes127.0.0.1first and, on WSL only, falls back tohost.docker.internal. Result is cached per onboard run;getResolvedOllamaHost()returns it for URL builders, andresetOllamaHostCache()is exposed for tests.getResolvedOllamaHost():getLocalProviderValidationBaseUrl,getLocalProviderHealthEndpoint,getOllamaModelOptions,getOllamaWarmupCommand,getOllamaProbeCommand, plus the validation-failure error message.src/lib/onboard.ts: replaces the direct127.0.0.1curl probe withfindReachableOllamaHost().findReachableOllamaHost()only probes127.0.0.1outside WSL, andgetResolvedOllamaHost()falls back to127.0.0.1until populated.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesmake docsbuilds without warnings (doc changes only)AI Disclosure
Signed-off-by: zyang-dev [email protected]
Summary by CodeRabbit