Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bin/lib/onboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const {
const {
inferContainerRuntime,
isUnsupportedMacosRuntime,
isWsl,
shouldPatchCoredns,
} = require("./platform");
const { resolveOpenshell } = require("./resolve-openshell");
Expand Down Expand Up @@ -2192,7 +2193,11 @@ async function setupNim(gpu) {
} else if (selected.key === "ollama") {
if (!ollamaRunning) {
console.log(" Starting Ollama...");
run("OLLAMA_HOST=0.0.0.0:11434 ollama serve > /dev/null 2>&1 &", { ignoreError: true });
// On WSL2, binding to 0.0.0.0 creates a dual-stack socket that Docker
// cannot reach via host-gateway. The default 127.0.0.1 binding works
// because WSL2 relays IPv4-only sockets to the Windows host.
const ollamaEnv = isWsl() ? "" : "OLLAMA_HOST=0.0.0.0:11434 ";
run(`${ollamaEnv}ollama serve > /dev/null 2>&1 &`, { ignoreError: true });
Comment on lines +2196 to +2200

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.

⚠️ Potential issue | 🟡 Minor

Update local-validation guidance to include the WSL exception.

With Line 2199 intentionally avoiding 0.0.0.0 on WSL, the current validateLocalProvider("ollama-local") message in bin/lib/local-inference.js still tells users to bind 0.0.0.0:11434, which is now the known-bad path on WSL.

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

In `@bin/lib/onboard.js` around lines 2196 - 2200, The
validateLocalProvider("ollama-local") guidance needs to reflect the WSL
exception used in onboard.js (isWsl() causes ollama to bind to 127.0.0.1 instead
of 0.0.0.0); update the user-facing message in bin/lib/local-inference.js so it
conditionally recommends 127.0.0.1:11434 when isWsl() is true and 0.0.0.0:11434
otherwise (or add a short note that WSL should use 127.0.0.1), keeping the check
consistent with the isWsl() logic used around run(`${ollamaEnv}ollama serve
...`) and ensuring validateLocalProvider("ollama-local") outputs the correct
host suggestion.

Comment on lines +2199 to +2200

@coderabbitai coderabbitai Bot Mar 30, 2026

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.

⚠️ Potential issue | 🟡 Minor

Clear inherited OLLAMA_HOST in the WSL path.

At Line 2199, omitting inline assignment does not remove an already-exported OLLAMA_HOST from the parent environment. That can silently bypass this fix on WSL.

💡 Proposed fix
-        const ollamaEnv = isWsl() ? "" : "OLLAMA_HOST=0.0.0.0:11434 ";
-        run(`${ollamaEnv}ollama serve > /dev/null 2>&1 &`, { ignoreError: true });
+        const ollamaEnvPrefix = isWsl() ? "env -u OLLAMA_HOST " : "OLLAMA_HOST=0.0.0.0:11434 ";
+        run(`${ollamaEnvPrefix}ollama serve > /dev/null 2>&1 &`, { ignoreError: true });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const ollamaEnv = isWsl() ? "" : "OLLAMA_HOST=0.0.0.0:11434 ";
run(`${ollamaEnv}ollama serve > /dev/null 2>&1 &`, { ignoreError: true });
const ollamaEnvPrefix = isWsl() ? "env -u OLLAMA_HOST " : "OLLAMA_HOST=0.0.0.0:11434 ";
run(`${ollamaEnvPrefix}ollama serve > /dev/null 2>&1 &`, { ignoreError: true });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bin/lib/onboard.js` around lines 2199 - 2200, The WSL branch currently sets
ollamaEnv = "" which leaves any parent OLLAMA_HOST exported and can leak into
the child; change the assignment so the WSL branch explicitly clears the
variable for the child process (e.g., set ollamaEnv to "OLLAMA_HOST= " or use
"unset OLLAMA_HOST &&" before the command) so the run call
(run(`${ollamaEnv}ollama serve ...`, { ignoreError: true })) executes with
OLLAMA_HOST cleared; update the code that defines ollamaEnv (the isWsl()
ternary) accordingly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The fix intentionally avoids overriding OLLAMA_HOST on WSL2 to let Ollama use its default binding. If a user has explicitly exported OLLAMA_HOST=0.0.0.0 in their environment, that's an intentional configuration choice - overriding it silently would be surprising. This is an unlikely edge case since neither the Ollama installer nor NemoClaw sets this variable in shell profiles.

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.

@jieunl24, that's a fair point — respecting an explicitly exported OLLAMA_HOST is consistent with the principle of least surprise for users who intentionally configure their own binding. The edge case is unlikely enough that silently clearing it would probably cause more confusion than it prevents. I'll defer to your judgment here.


✏️ Learnings added
Learnt from: jieunl24
Repo: NVIDIA/NemoClaw PR: 1104
File: bin/lib/onboard.js:2199-2200
Timestamp: 2026-03-30T17:32:13.519Z
Learning: In `bin/lib/onboard.js` (NemoClaw project), the WSL2 Ollama startup path intentionally does NOT clear an inherited `OLLAMA_HOST` environment variable (e.g., via `env -u OLLAMA_HOST`). The design decision is to respect any explicitly exported `OLLAMA_HOST` as an intentional user configuration choice. The fix only avoids *setting* `OLLAMA_HOST=0.0.0.0:11434` inline on WSL2; it does not override pre-existing env values. This is considered acceptable because neither the Ollama installer nor NemoClaw sets `OLLAMA_HOST` in shell profiles.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

sleep(2);
}
console.log(" ✓ Using Ollama on localhost:11434");
Expand Down Expand Up @@ -2230,6 +2235,7 @@ async function setupNim(gpu) {
}
break;
} else if (selected.key === "install-ollama") {
// macOS only — this option is gated by process.platform === "darwin" above
console.log(" Installing Ollama via Homebrew...");
run("brew install ollama", { ignoreError: true });
console.log(" Starting Ollama...");
Expand Down
Loading