Skip to content

feat(onboard): add WSL Windows-host Ollama install/start/restart flow#2800

Merged
ericksoa merged 8 commits into
mainfrom
feat/wsl-ollama-windows-host-ux
May 3, 2026
Merged

feat(onboard): add WSL Windows-host Ollama install/start/restart flow#2800
ericksoa merged 8 commits into
mainfrom
feat/wsl-ollama-windows-host-ux

Conversation

@zyang-dev

@zyang-dev zyang-dev commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Windows-host Ollama lifecycle actions (Use, Start, Restart, Install) to the WSL nemoclaw onboard inference menu via PowerShell interop. Lets users on WSL2 run Ollama on the Windows side and reach it from the sandbox without manually configuring OLLAMA_HOST=0.0.0.0, kill+restart cycles, or learning that wslrelay holds 127.0.0.1.

Changes

  • New menu options on WSL: Use, Restart, Start, Install Windows-host Ollama (label flips on windowsOllamaReachable / winOllamaLoopbackOnly / hasWindowsOllama).
  • New module src/lib/onboard-windows-ollama.ts owns the Windows-host action helpers: install, kill watcher-then-daemon, capture watcher path, persist OLLAMA_HOST env, launch + await ready, switch (cache pin only).
  • Install path pre-sets OLLAMA_HOST=0.0.0.0:11434 in both User-scope registry and the current PowerShell session so the installer's auto-spawned daemon binds correctly with no kill+relaunch.
  • Streams installer stdout via a Node chunk forwarder; stdio: inherit through WSL interop block-buffers Write-Host for minutes.
  • Bounded curl --connect-timeout 2 --max-time 5 probes against host.docker.internal:11434/api/tags so a half-state listener cannot eat the readiness budget.
  • Action prompts default to [Y/n] to nudge users toward the Windows-host path.
  • Refactor: extracted selectAndValidateOllamaModel from three near-duplicate inline loops in setupNim.
  • getOllamaModelOptions no longer falls back to the local ollama list CLI when the resolved host is non-loopback (would surface WSL models when targeting the Windows-host daemon, breaking validation).
  • Install Ollama (WSL Linux) handler now matches the existing-running-Ollama branch on WSL: no OLLAMA_HOST=0.0.0.0 override, no auth proxy, no exposure warning. Skips its own ollama serve when the installer's systemd unit is already up so journalctl logs stay
    intact.
  • Resolved-host cache is cleared when the user backs out of the Windows-host model-selection step so subsequent provider picks start from a fresh probe.
  • Non-interactive recovery for recorded ollama-local is fail-loud rather than auto-substituting the Windows-host daemon. Two cases:
    • Only start-windows-ollama / install-windows-ollama are present: print a NEMOCLAW_PROVIDER=… hint.
    • Windows-host is already reachable on host.docker.internal: refuse before the availability check finds the menu's ollama key (which now points at Windows-host) and silently swaps daemon/model cache.
  • launchAndAwaitWindowsOllama checks PowerShell exit code and surfaces stderr instead of waiting 30s for a readiness probe to fail.
  • installOllamaOnWindowsHost logs spawn errors (e.g. powershell.exe missing) and guards stdio listeners so the install path doesn't crash on hosts where the spawn returns no streams.
  • Unit test added for getOllamaModelOptions host-pinned behavior (non-loopback empty /api/tags returns []; loopback falls back to ollama list).

Type of Change

  • 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

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • 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 (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

AI Disclosure

  • AI-assisted — tool: Claude Code, Cursor

Signed-off-by: zyang-dev 267119621+zyang-dev@users.noreply.github.com

Summary by CodeRabbit

  • New Features

    • Run and manage Ollama on Windows hosts from WSL with install, start, switch, and use-Windows-host options.
    • Centralized model selection and onboarding flows with WSL-aware install/switch choices.
  • Improvements

    • Avoids mixing separate Ollama instances by refining host discovery and fallback behavior.
    • Faster, length-constrained probe requests for quicker, more reliable model detection.
  • Tests

    • Added tests for model discovery across different host resolutions and updated onboarding tests for WSL.

Signed-off-by: zyang-dev <267119621+zyang-dev@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a setter to override the resolved Ollama host; tightens probe/warmup prompts and generation limits; implements Windows-host Ollama onboarding from WSL (install/start/switch via PowerShell) with host detection and polling; centralizes Ollama model selection/validation and adds host-dependent tests.

Changes

Cohort / File(s) Summary
Local Inference Host Management
src/lib/local-inference.ts
Exports setResolvedOllamaHost(host: string). Skips ollama list fallback unless host is loopback, shortens probe/warmup prompts, sets options.num_predict = 16, and refactors probe/validation flow.
Windows-Host Ollama Orchestration
src/lib/onboard-windows-ollama.ts
New module to install/start/switch Ollama on Windows from WSL via powershell.exe: persists OLLAMA_HOST=0.0.0.0:11434, captures watcher path, stops watcher to avoid respawn, launches daemon (watcher or ollama.exe serve), polls host.docker.internal up to 15 tries, and calls setResolvedOllamaHost. Exports install/start/wait/switch functions.
Onboarding Wizard Integration
src/lib/onboard.ts
Adds selectAndValidateOllamaModel helper; extends WSL discovery to probe for Windows-host Ollama and distinguish loopback vs reachable hosts; adds start-windows-ollama / install-windows-ollama flows; adjusts WSL vs non-WSL install/start behavior; refines non-interactive recovery and selection UI labels.
Tests
test/get-ollama-model-options.test.ts, test/onboard-selection.test.ts
Adds Vitest suite that resets host cache and uses setResolvedOllamaHost to assert host-dependent model discovery and CLI fallback behavior. Updates onboarding selection test to compute WSL-aware option index and expected label.

Sequence Diagram

sequenceDiagram
    participant User as Onboarding Wizard
    participant WSL as WSL Discovery
    participant PS as PowerShell (Windows Host)
    participant WinSvc as Windows Ollama Watcher/Daemon
    participant Daemon as Ollama HTTP API
    participant LI as Local Inference

    User->>WSL: start discovery / choose provider
    WSL->>Daemon: probe /api/tags on candidate host(s)
    alt Windows-host install/start selected
        User->>PS: run install/start via powershell.exe
        PS->>WinSvc: stop watcher, persist OLLAMA_HOST, start daemon
        PS->>Daemon: poll host.docker.internal for readiness (max 15 attempts)
        Daemon-->>PS: HTTP ready
        PS->>LI: setResolvedOllamaHost(OLLAMA_HOST_DOCKER_INTERNAL)
    end
    User->>LI: selectAndValidateOllamaModel
    LI->>Daemon: model probe (short prompt, options.num_predict=16)
    Daemon-->>LI: probe response (validation)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through shells and ports at dawn,

set hosts and nudged daemons till they yawned,
pulled tiny prompts and clipped responses tight,
coaxed Windows hosts to wake in Docker's light,
now models hum — I nibble a carrot, bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly matches the main objective: adding WSL Windows-host Ollama install/start/restart flow capabilities.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/wsl-ollama-windows-host-ux

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get your free trial and get 200 agent minutes per Slack user (a $50 value).


Comment @coderabbitai help to get the list of available commands and usage tips.

@zyang-dev zyang-dev changed the title feat(onboard): add WSL Windows-host Ollama install/start flow feat(onboard): add WSL Windows-host Ollama install/start/restart flow May 1, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
src/lib/local-inference.ts (1)

434-463: ⚡ Quick win

Add regression tests for host-pinned model discovery behavior.

Please add/extend unit tests for:

  1. setResolvedOllamaHost(OLLAMA_HOST_DOCKER_INTERNAL) + empty /api/tags => returns [] (no ollama list fallback), and
  2. loopback host + empty /api/tags => still falls back to ollama list.

This branch is now critical to onboarding correctness and is worth pinning with explicit tests.

🤖 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 434 - 463, Add unit tests for
getOllamaModelOptions covering two host scenarios: (1) call
setResolvedOllamaHost(OLLAMA_HOST_DOCKER_INTERNAL), mock the capture used by
getOllamaModelOptions (or pass a runCaptureImpl) to return empty for the
/api/tags endpoint and assert the function returns [] and does not call the
"ollama list" fallback (e.g. by having the list capture throw or record calls);
and (2) call setResolvedOllamaHost(OLLAMA_LOCALHOST), mock capture so the
/api/tags response is empty but the "ollama list" capture returns a known value,
then assert getOllamaModelOptions returns the parsed list (use parseOllamaList
expected output). Ensure tests reset the resolved host after each case and use
the getOllamaModelOptions/runCaptureImpl, parseOllamaTags, parseOllamaList
symbols to locate and wire mocks.
🤖 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-windows-ollama.ts`:
- Around line 39-41: The current child process error handler swallows spawn
errors by resolving the promise in child.on("error", ...); update the handler
for the spawned child (the child variable and its "error" event) to log the
error (using the existing logger or console.error) and reject the promise with
the error instead of resolving, so callers can see and handle spawn failures and
logs contain the actual error details.

In `@src/lib/onboard.ts`:
- Around line 4721-4740: The WSL-specific install option currently uses the same
"install-ollama" key/flow as non-WSL, causing the post-install startup to run
the non-WSL path (setting OLLAMA_HOST=0.0.0.0 and starting the auth proxy) which
is unreachable from the sandbox; change the option pushed when isWsl() true to
use a distinct key (e.g., "install-ollama-wsl") or add a flag on the option to
mark WSL, and then update the install handler that processes the
"install-ollama" branch to detect that key/flag and run the WSL-specific startup
sequence (mirror the existing ollama branch behavior: do NOT set
OLLAMA_HOST=0.0.0.0 and do NOT start the auth proxy). Ensure you reference
isWsl(), the option key "install-ollama" (and new "install-ollama-wsl" or
option.flag), and the install/startup handler that launches `ollama serve` so
the correct WSL-safe startup path is used after installation.
- Around line 5366-5408: The Windows-host flow pins the resolved Ollama host
(via
switchToWindowsOllamaHost/awaitWindowsOllamaReady/setupWindowsOllamaWith0000Binding)
but when selectAndValidateOllamaModel returns outcome === "back-to-selection" we
never clear or recompute that resolution, so subsequent choices still use the
Windows host; fix this by clearing the cached/resolved host before continuing
selectionLoop (e.g., call a new resetResolvedOllamaHost helper or explicitly
unset the variable/env that getLocalProviderBaseUrl and getOllamaModelOptions
read) immediately before the continue selectionLoop after result.outcome ===
"back-to-selection" so provider/endpointUrl are recomputed on the next
selection.
- Around line 4710-4720: The recovered provider name "ollama" can refer to the
Windows-host action but this menu only exposes
"start-windows-ollama"/"install-windows-ollama", so update the options
construction in the hasWindowsOllama block to also add an alias entry keyed as
"ollama" that points to the same windowsOllamaLabel (i.e., push both { key:
"start-windows-ollama", label: windowsOllamaLabel } and { key: "ollama", label:
windowsOllamaLabel }), or alternatively adjust providerNameToOptionKey() to map
the recovered "ollama" to "start-windows-ollama"; reference the options array,
windowsOllamaLabel, the "start-windows-ollama" key and providerNameToOptionKey()
so the non-interactive recovery path will find the Windows-host action.

---

Nitpick comments:
In `@src/lib/local-inference.ts`:
- Around line 434-463: Add unit tests for getOllamaModelOptions covering two
host scenarios: (1) call setResolvedOllamaHost(OLLAMA_HOST_DOCKER_INTERNAL),
mock the capture used by getOllamaModelOptions (or pass a runCaptureImpl) to
return empty for the /api/tags endpoint and assert the function returns [] and
does not call the "ollama list" fallback (e.g. by having the list capture throw
or record calls); and (2) call setResolvedOllamaHost(OLLAMA_LOCALHOST), mock
capture so the /api/tags response is empty but the "ollama list" capture returns
a known value, then assert getOllamaModelOptions returns the parsed list (use
parseOllamaList expected output). Ensure tests reset the resolved host after
each case and use the getOllamaModelOptions/runCaptureImpl, parseOllamaTags,
parseOllamaList symbols to locate and wire mocks.
🪄 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: 1e66f20d-f9c5-4691-bd1c-956310c66f18

📥 Commits

Reviewing files that changed from the base of the PR and between 8cd670e and 7972ecd.

📒 Files selected for processing (3)
  • src/lib/local-inference.ts
  • src/lib/onboard-windows-ollama.ts
  • src/lib/onboard.ts

Comment thread src/lib/onboard-windows-ollama.ts
Comment thread src/lib/onboard.ts
Comment thread src/lib/onboard.ts
Comment thread src/lib/onboard.ts
@cv cv added v0.0.33 and removed v0.0.32 labels May 1, 2026
Signed-off-by: zyang-dev <267119621+zyang-dev@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/lib/onboard.ts (1)

4772-4813: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Non-interactive recovery still fails for recorded ollama-local when only Windows-host actions are present

On Line 4772, recovered ollama-local maps to ollama, but when the menu only contains start-windows-ollama / install-windows-ollama (Line 4711 onward), Line 4809 hard-fails with “Requested provider 'ollama' is not available.”
Please alias recovered ollama to an available Windows-host action before this availability check.

Proposed fix
         if (!providerKey) {
           const recordedProvider = readRecordedProvider(sandboxName);
           const hasNimContainer = !!readRecordedNimContainer(sandboxName);
           const recoveredKey = providerNameToOptionKey(recordedProvider, { hasNimContainer });
           if (recoveredKey) {
+            let resolvedRecoveredKey = recoveredKey;
+            if (
+              resolvedRecoveredKey === "ollama" &&
+              !options.some((o) => o.key === "ollama")
+            ) {
+              const windowsFallback = options.find(
+                (o) =>
+                  o.key === "start-windows-ollama" || o.key === "install-windows-ollama",
+              );
+              if (windowsFallback) {
+                resolvedRecoveredKey = windowsFallback.key;
+              }
+            }
             // Refuse to silently switch providers behind the user's back; if
             // the previously-recorded one is gone, surface the recorded value
             // so the user can fix the dependency or override via env var.
-            if (!options.some((o) => o.key === recoveredKey)) {
+            if (!options.some((o) => o.key === resolvedRecoveredKey)) {
               console.error(
                 `  Recorded provider '${recordedProvider}' is not available in this environment.`,
               );
               console.error(
                 "  Set NEMOCLAW_PROVIDER explicitly, or restore the missing local-inference dependency.",
               );
               process.exit(1);
             }
-            providerKey = recoveredKey;
+            providerKey = resolvedRecoveredKey;
             recoveredFromSandbox = true;
             recoveredModel = readRecordedModel(sandboxName);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/onboard.ts` around lines 4772 - 4813, The recovery path sets
providerKey (from recoveredKey or "build") and then looks up selected via
options.find; when recovered/translated providerKey === "ollama" we must also
accept Windows-host actions (e.g., "start-windows-ollama" or
"install-windows-ollama") if those are present in options. Modify the logic
around providerKey/selected (the block that uses providerKey, options, and
selected) to, before the final error, if providerKey === "ollama" and options
does not contain key "ollama" but does contain either "start-windows-ollama" or
"install-windows-ollama", alias providerKey to the available Windows-host key
(prefer start- over install- if both exist) so selected can be resolved; keep
the existing special-case for "install-ollama" unchanged.
🧹 Nitpick comments (1)
src/lib/onboard.ts (1)

4574-5471: Run the onboarding E2E trio for this core src/lib/onboard.ts flow change

Given the WSL provider menu/state-machine changes in this core path, it’s worth running the recommended workflow matrix before merge:
cloud-e2e,sandbox-operations-e2e,rebuild-openclaw-e2e.

As per coding guidelines: src/lib/onboard.ts — “E2E test recommendation: cloud-e2e, sandbox-operations-e2e, rebuild-openclaw-e2e”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/onboard.ts` around lines 4574 - 5471, The change in
src/lib/onboard.ts (setupNim and its WSL/provider state machine) requires
running the three recommended E2E suites: cloud-e2e, sandbox-operations-e2e, and
rebuild-openclaw-e2e against this branch; run each suite locally/CI, exercise
WSL provider scenarios (WSL Ollama vs Windows-host Ollama,
install/start/switch/restart flows), verify provider selection, model recovery,
nim-local start/pull/health paths, and that prompts/transitions in setupNim
behave as expected, record and attach the passing test logs to the PR (or note
failures and fix regressions before merging).
🤖 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-windows-ollama.ts`:
- Around line 136-142: launchAndAwaitWindowsOllama currently discards the result
of runCapture so PowerShell Start-Process failures become a 30s readiness
timeout; change it to capture the runCapture result (call site:
launchAndAwaitWindowsOllama, variables: watcherPath, launchScript, runCapture)
and if runCapture indicates an error (non-zero exit or thrown error) immediately
surface that error (throw or return false) instead of calling
awaitWindowsOllamaReady(); only call awaitWindowsOllamaReady() when runCapture
succeeded so launch failures are reported promptly.

---

Duplicate comments:
In `@src/lib/onboard.ts`:
- Around line 4772-4813: The recovery path sets providerKey (from recoveredKey
or "build") and then looks up selected via options.find; when
recovered/translated providerKey === "ollama" we must also accept Windows-host
actions (e.g., "start-windows-ollama" or "install-windows-ollama") if those are
present in options. Modify the logic around providerKey/selected (the block that
uses providerKey, options, and selected) to, before the final error, if
providerKey === "ollama" and options does not contain key "ollama" but does
contain either "start-windows-ollama" or "install-windows-ollama", alias
providerKey to the available Windows-host key (prefer start- over install- if
both exist) so selected can be resolved; keep the existing special-case for
"install-ollama" unchanged.

---

Nitpick comments:
In `@src/lib/onboard.ts`:
- Around line 4574-5471: The change in src/lib/onboard.ts (setupNim and its
WSL/provider state machine) requires running the three recommended E2E suites:
cloud-e2e, sandbox-operations-e2e, and rebuild-openclaw-e2e against this branch;
run each suite locally/CI, exercise WSL provider scenarios (WSL Ollama vs
Windows-host Ollama, install/start/switch/restart flows), verify provider
selection, model recovery, nim-local start/pull/health paths, and that
prompts/transitions in setupNim behave as expected, record and attach the
passing test logs to the PR (or note failures and fix regressions before
merging).
🪄 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: 0a201d06-0cea-4acd-81ce-4e831304f12b

📥 Commits

Reviewing files that changed from the base of the PR and between 7972ecd and d1632ab.

📒 Files selected for processing (3)
  • src/lib/onboard-windows-ollama.ts
  • src/lib/onboard.ts
  • test/get-ollama-model-options.test.ts

Comment thread src/lib/onboard-windows-ollama.ts
zyang-dev added 2 commits May 1, 2026 11:59
…ative on recovery

Signed-off-by: zyang-dev <267119621+zyang-dev@users.noreply.github.com>
Signed-off-by: zyang-dev <267119621+zyang-dev@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/onboard.ts (1)

4770-4799: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Recorded ollama-local can still auto-switch to the Windows daemon.

providerNameToOptionKey() always recovers ollama-local as "ollama", and this branch only checks key availability. On WSL, if the saved provider was WSL Ollama but the only reachable daemon is already host.docker.internal, the recovered "ollama" path now succeeds and silently changes the daemon/model cache instead of failing loud.

Suggested guard
           const recoveredKey = providerNameToOptionKey(recordedProvider, { hasNimContainer });
           if (recoveredKey) {
+            const recoveredWouldSwitchOllamaHost =
+              isWsl() &&
+              recordedProvider === "ollama-local" &&
+              ollamaHost === OLLAMA_HOST_DOCKER_INTERNAL;
+            if (recoveredWouldSwitchOllamaHost) {
+              console.error(
+                "  Recorded provider 'ollama-local' is not available in this environment.",
+              );
+              console.error(
+                "  Hint: Windows-host Ollama is reachable here; re-run with NEMOCLAW_PROVIDER=ollama to use it explicitly.",
+              );
+              process.exit(1);
+            }
             // Refuse to silently switch providers behind the user's back; if
             // the previously-recorded one is gone, surface the recorded value
             // so the user can fix the dependency or override via env var.
             if (!options.some((o) => o.key === recoveredKey)) {

Based on learnings: "Repo NVIDIA/NemoClaw preference: In WSL onboarding, do not remap a recorded 'ollama-local' (WSL Ollama) to Windows-host actions ('start-windows-ollama'/'install-windows-ollama'). Prefer fail-loud to avoid silently switching the actual daemon and model cache. If needed, provide guidance rather than aliasing."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/onboard.ts` around lines 4770 - 4799, The code currently treats a
recovered provider of "ollama-local" as the generic recoveredKey "ollama" and
may silently accept Windows-host options; modify the logic after computing
recoveredKey to detect if recordedProvider === "ollama-local" and the only
matching option(s) are Windows-host variants (e.g., keys "start-windows-ollama"
or "install-windows-ollama") and, in that case, treat the recovered provider as
unavailable and fail-loud (same behavior as the existing console.error +
process.exit(1) branch) instead of accepting the Windows-host mapping; use the
existing symbols readRecordedProvider, providerNameToOptionKey, recoveredKey,
recordedProvider, options, winHostKey, sandboxName and continue to set
providerKey/recoveredFromSandbox/recoveredModel only when a true non-Windows
match exists.
🧹 Nitpick comments (1)
src/lib/onboard.ts (1)

4574-5482: Please run the onboarding E2Es on this branch.

This change rewires core src/lib/onboard.ts selection/recovery behavior across WSL, Windows-host Ollama, and rebuild paths. I'd run cloud-e2e, sandbox-operations-e2e, and rebuild-openclaw-e2e before merging.

As per coding guidelines: "src/lib/onboard.ts: This file contains core onboarding logic. Changes here affect the full sandbox creation and configuration flow. E2E test recommendation: cloud-e2e — full onboard + cloud inference; sandbox-operations-e2e — multi-sandbox lifecycle; rebuild-openclaw-e2e — workspace state survives rebuild."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/onboard.ts` around lines 4574 - 5482, Summary: The onboarding changes
in setupNim touch WSL/Windows-host Ollama selection and recovery; please run
full E2Es to validate behavior. Run the cloud-e2e, sandbox-operations-e2e, and
rebuild-openclaw-e2e pipelines and verify selection/recovery flows around
setupNim, especially branches using findReachableOllamaHost,
windowsOllamaReachable, winOllamaLoopbackOnly, selectAndValidateOllamaModel,
resetOllamaHostCache and nim-local flows; confirm that provider/model recovery
from readRecordedProvider/readRecordedModel and non-interactive paths behave
correctly across WSL vs Windows host, that start/install/switch Windows Ollama
branches succeed, and that rebuild preserves sandbox state and recorded
nimContainer behavior—if failures appear, add targeted fixes/logging and re-run
the specific failing E2E until green.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/lib/onboard.ts`:
- Around line 4770-4799: The code currently treats a recovered provider of
"ollama-local" as the generic recoveredKey "ollama" and may silently accept
Windows-host options; modify the logic after computing recoveredKey to detect if
recordedProvider === "ollama-local" and the only matching option(s) are
Windows-host variants (e.g., keys "start-windows-ollama" or
"install-windows-ollama") and, in that case, treat the recovered provider as
unavailable and fail-loud (same behavior as the existing console.error +
process.exit(1) branch) instead of accepting the Windows-host mapping; use the
existing symbols readRecordedProvider, providerNameToOptionKey, recoveredKey,
recordedProvider, options, winHostKey, sandboxName and continue to set
providerKey/recoveredFromSandbox/recoveredModel only when a true non-Windows
match exists.

---

Nitpick comments:
In `@src/lib/onboard.ts`:
- Around line 4574-5482: Summary: The onboarding changes in setupNim touch
WSL/Windows-host Ollama selection and recovery; please run full E2Es to validate
behavior. Run the cloud-e2e, sandbox-operations-e2e, and rebuild-openclaw-e2e
pipelines and verify selection/recovery flows around setupNim, especially
branches using findReachableOllamaHost, windowsOllamaReachable,
winOllamaLoopbackOnly, selectAndValidateOllamaModel, resetOllamaHostCache and
nim-local flows; confirm that provider/model recovery from
readRecordedProvider/readRecordedModel and non-interactive paths behave
correctly across WSL vs Windows host, that start/install/switch Windows Ollama
branches succeed, and that rebuild preserves sandbox state and recorded
nimContainer behavior—if failures appear, add targeted fixes/logging and re-run
the specific failing E2E until green.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 838326b4-9db7-45ee-b6f4-acfe12d9193c

📥 Commits

Reviewing files that changed from the base of the PR and between d1632ab and 8aca72a.

📒 Files selected for processing (2)
  • src/lib/onboard-windows-ollama.ts
  • src/lib/onboard.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/onboard-windows-ollama.ts

zyang-dev added 3 commits May 1, 2026 13:51
Signed-off-by: zyang-dev <267119621+zyang-dev@users.noreply.github.com>
… switch to Windows-host

Signed-off-by: zyang-dev <267119621+zyang-dev@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/lib/onboard.ts (2)

5539-5548: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Print the actual Ollama host in the WSL ollama branch.

When Line 4883 labels this option as Windows host:11434, this branch can still print Using Ollama on localhost:11434 just because isWsl() is true. That makes it unclear which daemon/model cache was actually selected.

Suggested fix
         if (isWsl()) {
           // WSL2 doesn't need the proxy — Docker can reach the host directly.
-          console.log(`  ✓ Using Ollama on localhost:${OLLAMA_PORT}`);
+          const resolvedHost = getResolvedOllamaHost();
+          const hostLabel =
+            resolvedHost === OLLAMA_HOST_DOCKER_INTERNAL
+              ? "host.docker.internal"
+              : "localhost";
+          console.log(`  ✓ Using Ollama on ${hostLabel}:${OLLAMA_PORT}`);
         } else {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/onboard.ts` around lines 5539 - 5548, The WSL branch prints a
hardcoded "localhost" even when a different Ollama host was selected; change the
log to use the actual resolved Ollama host variable (the one used to produce the
"Windows host:11434" label) instead of "localhost". Update the message inside
the isWsl() true branch and the proxy branch that calls startOllamaAuthProxy()
to interpolate that resolved host value (alongside OLLAMA_PORT and
OLLAMA_PROXY_PORT as appropriate) so the console shows the real
daemon/model-cache host chosen.

4799-4944: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Recompute Ollama probes/options after install/start actions.

ollamaHost, hasWindowsOllama, windowsOllamaReachable, and the options list are all captured before Line 4961, but the new Windows-host branches can change that state and then continue selectionLoop from Line 5637. After a successful install/start, the next menu still reflects the pre-action state, so it can keep offering install-windows-ollama even though Ollama is now installed/running and omit the newly valid ollama / start-windows-ollama paths.

Please rebuild the WSL/Windows Ollama probe state at the top of each loop iteration, or explicitly refresh it before re-entering the provider picker after those state-changing branches.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/onboard.ts` around lines 4799 - 4944, The Ollama/vLLM probe and
options are computed once (using hostCommandExists, findReachableOllamaHost,
runCapture, isWsl, VLLM_PORT, OLLAMA_PORT, winOllamaLoopbackOnly,
windowsOllamaReachable, etc.) but never refreshed after install/start actions
before continuing the selectionLoop; extract that probe + options-building logic
into a single function (e.g., refreshOllamaState or rebuildProviderOptions) that
recomputes ollamaHost, ollamaRunning, hasWindowsOllama, winOllamaLoopbackOnly,
windowsOllamaReachable, vllmRunning and the options array, and call it at the
top of each iteration and immediately after any state-changing branch (the
install/start-windows-ollama and related branches) before continue selectionLoop
so the menu reflects the updated runtime state.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/lib/onboard.ts`:
- Around line 5539-5548: The WSL branch prints a hardcoded "localhost" even when
a different Ollama host was selected; change the log to use the actual resolved
Ollama host variable (the one used to produce the "Windows host:11434" label)
instead of "localhost". Update the message inside the isWsl() true branch and
the proxy branch that calls startOllamaAuthProxy() to interpolate that resolved
host value (alongside OLLAMA_PORT and OLLAMA_PROXY_PORT as appropriate) so the
console shows the real daemon/model-cache host chosen.
- Around line 4799-4944: The Ollama/vLLM probe and options are computed once
(using hostCommandExists, findReachableOllamaHost, runCapture, isWsl, VLLM_PORT,
OLLAMA_PORT, winOllamaLoopbackOnly, windowsOllamaReachable, etc.) but never
refreshed after install/start actions before continuing the selectionLoop;
extract that probe + options-building logic into a single function (e.g.,
refreshOllamaState or rebuildProviderOptions) that recomputes ollamaHost,
ollamaRunning, hasWindowsOllama, winOllamaLoopbackOnly, windowsOllamaReachable,
vllmRunning and the options array, and call it at the top of each iteration and
immediately after any state-changing branch (the install/start-windows-ollama
and related branches) before continue selectionLoop so the menu reflects the
updated runtime state.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1b0d1a84-0b88-434d-b11a-85d40afabb5f

📥 Commits

Reviewing files that changed from the base of the PR and between 4d2d93c and 951a217.

📒 Files selected for processing (1)
  • src/lib/onboard.ts

@cv cv self-requested a review May 1, 2026 21:44
@cv cv added v0.0.34 and removed v0.0.33 labels May 2, 2026
@zyang-dev zyang-dev self-assigned this May 3, 2026
@ericksoa ericksoa merged commit b04a483 into main May 3, 2026
16 checks passed
miyoungc added a commit that referenced this pull request May 5, 2026
## Summary
Catch up the docs for user-facing changes that landed over the weekend
and today, so the published guidance matches current installer,
onboarding, status, logs, local inference, rebuild backup behavior, the
next docs version selector, and refreshed generated user skills.

## Related Issue
None.

## Changes
- Document WSL Windows-host Ollama onboarding actions, including use,
start, restart, install, and `host.docker.internal` model pulls from
#2800; clarify that onboard owns Ollama install and model pulls from
#2952.
- Document installer fail-fast behavior for non-TTY third-party software
acceptance from #2706.
- Update sandbox-name guidance and Brev deploy validation behavior from
#2948.
- Add `nemoclaw <name> logs --tail/--since` coverage from #2825.
- Add global `nemoclaw status --json` coverage from #2822.
- Document verified-gateway status behavior and non-zero degraded exits
from #2884.
- Clarify that rebuild stops before deleting the original sandbox when
backup fails, including unreadable or root-owned state paths.
- Bump docs switcher metadata from 0.0.33 to 0.0.34 without changing
package versions or creating release tags.
- Regenerate `.agents/skills/nemoclaw-user-*` from docs, including the
new `nemoclaw-user-manage-sandboxes` generated skill and removal of the
stale `nemoclaw-user-workspace` output.

## Type of Change
- [ ] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [x] Doc only (includes code sample changes)

## Verification
- [ ] `npx prek run --all-files` passes
- [ ] `npm test` passes
- [ ] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [x] Docs updated for user-facing behavior changes
- [x] `make docs` builds without warnings (doc changes only)
- [x] 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)

---
<!-- DCO sign-off required by CI. Run: git config user.name && git
config user.email -->
Signed-off-by: Miyoung Choi <miyoungc@nvidia.com>

Made with [Cursor](https://cursor.com)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Expanded Ollama/local inference guidance with detailed WSL and
Windows-host workflows, proxy/token behavior, and onboarding options
* Standardized sandbox name validation and updated troubleshooting, CLI,
and deploy docs to surface the rules and validation timing
* Added/rewrote Manage Sandboxes, policy management, backup/restore,
messaging channels, workspace persistence, and CLI selection guides
* Refreshed quickstart/Hermes guidance, skill mappings, and bumped docs
version to 0.0.34
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
@wscurran wscurran added the feature PR adds or expands user-visible functionality label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature PR adds or expands user-visible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants