Skip to content

fix(onboard): detect installed Windows Ollama when daemon is stopped#4089

Open
Thabhelo wants to merge 1 commit into
NVIDIA:mainfrom
Thabhelo:fix/onboard-wsl-ollama-known-path
Open

fix(onboard): detect installed Windows Ollama when daemon is stopped#4089
Thabhelo wants to merge 1 commit into
NVIDIA:mainfrom
Thabhelo:fix/onboard-wsl-ollama-known-path

Conversation

@Thabhelo
Copy link
Copy Markdown

@Thabhelo Thabhelo commented May 22, 2026

Summary

Probe known Windows Ollama install paths even when the daemon is not running and ollama.exe is missing from PATH, so WSL onboarding offers Start Ollama on Windows host instead of Install.

Related Issue

Fixes #4066

Changes

  • Check GET_KNOWN_OLLAMA_INSTALL_PATH after PATH/process probes in probeInstalledPath()
  • Add regression test in src/lib/onboard/windows-host-ollama.test.ts

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)

Signed-off-by: Thabhelo 50872400+Thabhelo@users.noreply.github.com

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Enhanced detection of Ollama installations on Windows by checking standard installation paths even when the application is not actively running, ensuring more reliable setup detection.
  • Tests

    • Added unit test coverage for Windows Ollama detection functionality.

Review Change Stack

Probe known install paths even when Ollama is not on PATH and not running,
so WSL onboarding offers Start instead of Install.

Fixes NVIDIA#4066.
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 22, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

This PR fixes detection of installed-but-not-running Ollama on Windows by removing a PID-visibility gate that was preventing fallback to known installer paths, and adds test coverage validating the corrected behavior.

Changes

Windows Ollama Detection Fallback

Layer / File(s) Summary
Probe path reordering in probeInstalledPath
src/lib/onboard/windows-host-ollama.ts
Removes PID gate that blocked fallback to known Ollama installer paths; now checks $LOCALAPPDATA\Programs\Ollama\ollama.exe before gating on process availability, allowing detection when Ollama is installed but not running.
detectWindowsHostOllama test for installed-but-not-running case
src/lib/onboard/windows-host-ollama.test.ts
Adds Vitest unit test mocking PowerShell execution and WSL detection to verify correct detection result when Ollama exists at known path but process is not running.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly Related PRs

  • NVIDIA/NemoClaw#3969: Related PR that introduced the initial Windows-host Ollama detection logic that this fix and test coverage target.

Suggested Labels

Platform: Windows/WSL, Local Models, fix

Suggested Reviewers

  • ericksoa

Poem

A rabbit hops through Windows halls,
Finding Ollama in its walls,
Not running now, but still there waits—
Detection works at any gates! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: detecting installed Windows Ollama when the daemon is stopped, which aligns with the core change in windows-host-ollama.ts.
Linked Issues check ✅ Passed The code changes fully address issue #4066: the probeInstalledPath() function now checks known install paths before the PID guard, allowing detection of installed-but-stopped Ollama, and a regression test validates this behavior.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing issue #4066: modifications to windows-host-ollama.ts and addition of windows-host-ollama.test.ts, with no unrelated alterations detected.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/onboard/windows-host-ollama.test.ts`:
- Around line 6-10: The mock for runCapture has the wrong signature; update the
mock declaration and implementation to match the real function signature
runCapture(cmd: readonly string[], opts: CaptureOptions = {}): string by
changing the vi.fn to accept two parameters (cmd: readonly string[], opts?:
CaptureOptions) and updating the vi.mock implementation to forward both
arguments (command and opts) to the runCapture mock; import or reference the
CaptureOptions type if needed so TypeScript types line up with the real
runCapture used by the tests.
🪄 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: 1b2ee34a-c5d9-49ef-8684-74a3bfd69b7e

📥 Commits

Reviewing files that changed from the base of the PR and between da85c5d and 9329124.

📒 Files selected for processing (2)
  • src/lib/onboard/windows-host-ollama.test.ts
  • src/lib/onboard/windows-host-ollama.ts

Comment on lines +6 to +10
const runCapture = vi.fn<(command: string | string[]) => string>(() => "");

vi.mock("../runner", () => ({
runCapture: (command: string | string[]) => runCapture(command),
}));
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 | ⚡ Quick win

Fix mock signature to match the real runCapture signature.

The mock signature doesn't match the actual runCapture function. Looking at src/lib/runner.ts:216-261, the real signature is:

function runCapture(cmd: readonly string[], opts: CaptureOptions = {}): string

But the mock only declares one parameter. This may cause TypeScript compilation errors when the code under test calls runCapture([...], { ignoreError: true }).

🔧 Proposed fix to match the real signature
-const runCapture = vi.fn<(command: string | string[]) => string>(() => "");
+const runCapture = vi.fn<(cmd: readonly string[], opts?: { ignoreError?: boolean }) => string>(() => "");

 vi.mock("../runner", () => ({
-  runCapture: (command: string | string[]) => runCapture(command),
+  runCapture: (cmd: readonly string[], opts?: { ignoreError?: boolean }) => runCapture(cmd, opts),
 }));

Then update the mock implementation to use the correct parameter name:

-    runCapture.mockImplementation((command) => {
-      const cmd = Array.isArray(command) ? command.join(" ") : command;
+    runCapture.mockImplementation((cmd) => {
+      const cmdStr = cmd.join(" ");
-      if (cmd.includes("Get-Command ollama.exe")) return "";
+      if (cmdStr.includes("Get-Command ollama.exe")) return "";
       // ... update other checks similarly
     });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/onboard/windows-host-ollama.test.ts` around lines 6 - 10, The mock
for runCapture has the wrong signature; update the mock declaration and
implementation to match the real function signature runCapture(cmd: readonly
string[], opts: CaptureOptions = {}): string by changing the vi.fn to accept two
parameters (cmd: readonly string[], opts?: CaptureOptions) and updating the
vi.mock implementation to forward both arguments (command and opts) to the
runCapture mock; import or reference the CaptureOptions type if needed so
TypeScript types line up with the real runCapture used by the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WSL2][Onboard] nemoclaw onboard shows "Install Ollama on Windows host" instead of "Start" when Ollama binary exists but is not running and not in PATH

1 participant