Skip to content

fix(onboard): default the interactive Ollama menu to the requested model - #6876

Closed
laitingsheng wants to merge 5 commits into
mainfrom
fix/6869-ollama-interactive-model-default
Closed

fix(onboard): default the interactive Ollama menu to the requested model#6876
laitingsheng wants to merge 5 commits into
mainfrom
fix/6869-ollama-interactive-model-default

Conversation

@laitingsheng

@laitingsheng laitingsheng commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The interactive onboarding wizard chose the Ollama model menu default from installed-model memory fit alone, so a NEMOCLAW_MODEL set by the user was ignored and the first fitting model was pre-selected. The menu now pre-selects NEMOCLAW_MODEL (then any recovered model) when it is one of the offered options, and a non-interactive run reports the model it auto-selects when none is requested.

Related Issue

Fixes #6869

Changes

  • promptOllamaModel accepts an optional preferredModel and uses it as the menu default when it matches an offered option (src/lib/inference/ollama/proxy.ts).
  • Interactive Ollama onboarding sources the preferred model from NEMOCLAW_MODEL, falling back to any recovered model, and passes it to the menu (src/lib/onboard.ts).
  • Non-interactive selection reports the auto-selected model and points to NEMOCLAW_MODEL when no model is requested (src/lib/inference/local.ts).
  • Document the interactive default and the non-interactive auto-select report (docs/inference/set-up-ollama.mdx).
  • Add tests for the menu default following the requested model and for the non-interactive auto-select notice (src/lib/inference/ollama/proxy.test.ts, src/lib/inference/local.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)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification:
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification:
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: npx vitest run --project cli src/lib/inference/ollama/proxy.test.ts src/lib/inference/local.test.ts → 75 passed
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run 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: Tinson Lai tinsonl@nvidia.com

Summary by CodeRabbit

  • New Features

    • Enhanced Ollama model selection during onboarding, including preference-based defaults and interactive pre-selection when the requested model is installed.
    • Non-interactive onboarding now reports the auto-selected Ollama model.
    • Added improved guidance for selecting a specific model using NEMOCLAW_MODEL.
  • Bug Fixes

    • Ensured preferred models aren’t promoted to the interactive default unless they’re actually available in the installed menu (not only in fallback options).
  • Documentation / Tests

    • Updated onboarding documentation wording for interactive vs non-interactive behavior.
    • Extended coverage with new model-resolution and selection tests.

The interactive onboarding wizard chose the Ollama model menu default from
installed-model memory fit alone, so a set NEMOCLAW_MODEL was ignored and the
first fitting entry was pre-selected. Thread the requested model
(NEMOCLAW_MODEL, then any recovered model) into the menu and pre-select it when
it is one of the offered options.

Also report the auto-selected model during non-interactive onboarding when no
model is requested, so an unintended default is not applied silently.

Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Ollama onboarding now logs non-interactive auto-selected models and supports NEMOCLAW_MODEL. Interactive selection resolves a preferred model, defaults to matching installed options, and falls back to installed models when no match exists. Documentation and tests cover these behaviors.

Changes

Ollama model selection

Layer / File(s) Summary
Non-interactive model resolution
src/lib/inference/local.ts, src/lib/inference/local.test.ts, docs/inference/set-up-ollama.mdx
Unrequested models are auto-selected through the default-model resolver, logged explicitly, tested, and documented with the NEMOCLAW_MODEL override.
Interactive preferred-model selection
src/lib/onboard/ollama-model-preference.ts, src/lib/onboard.ts, src/lib/inference/ollama/proxy.ts, src/lib/inference/ollama/proxy.test.ts
Onboarding resolves requested, environment, or recovered preferences, passes them to the prompt, defaults to matching installed options, and otherwise selects an installed model.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: area: local-models

Suggested reviewers: cv, ericksoa

Sequence Diagram(s)

sequenceDiagram
  participant Onboarding
  participant PreferenceResolver
  participant OllamaPrompt
  participant InstalledModels
  Onboarding->>PreferenceResolver: resolve requested, environment, or recovered model
  Onboarding->>OllamaPrompt: pass preferredModel and excluded probe failures
  OllamaPrompt->>InstalledModels: match preferredModel against installed options
  InstalledModels-->>OllamaPrompt: matching or fallback options
  OllamaPrompt-->>Onboarding: selected Ollama model
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed It clearly describes the main onboarding change: defaulting the interactive Ollama menu to the requested model.
Linked Issues check ✅ Passed The changes address #6869 by preferring the requested Ollama model when installed and avoiding fallback to uninstalled options.
Out of Scope Changes check ✅ Passed The added docs and tests support the onboarding model-selection fix and stay within the stated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/6869-ollama-interactive-model-default

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

@github-code-quality

github-code-quality Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage remains at 96%, unchanged from the main branch.

TypeScript / code-coverage/cli

The overall coverage in the fix/6869-ollama-inte... branch remains at 79%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main 64140e3 fix/6869-ollama-inte... 9ea68a3 +/-
src/lib/inferen...ollama/proxy.ts 34% 34% 0%
src/lib/onboard.ts 29% 29% 0%
src/lib/onboard...l-preference.ts 0% 0% 0%
src/lib/inference/local.ts 71% 72% +1%
src/lib/securit...ntial-filter.ts 98% 99% +1%

Updated July 14, 2026 18:05 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

Copy link
Copy Markdown
Contributor

@laitingsheng laitingsheng added NV QA Bugs found by the NVIDIA QA Team provider: ollama Ollama local model provider behavior area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression labels Jul 14, 2026
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / high confidence
Next action: Review the warnings below.
Findings: 0 blockers · 1 warning · 0 suggestions
Status: Canonical ledger: 0 blocker(s), 1 warning(s), 0 suggestion(s).

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 1 warning · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings differ; normalized E2E selections differ; Nemotron reported the same number of blockers, 1 fewer warning, the same number of suggestions.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: inference-routing, network-policy, onboard-repair, onboard-resume, cloud-onboard

2 optional E2E recommendations
  • ollama-auth-proxy
  • onboard-negative-paths
1 warning · 0 suggestions

Warnings

Warnings do not block.

PRA-1 Warning — Cover preference resolution at the onboarding bridge

  • Location: src/lib/onboard/ollama-model-preference.ts:8
  • Category: tests
  • Problem: The new bridge derives the interactive preferred model from requested, environment, and recovered values, but no test exercises that derivation. Existing proxy tests inject `preferredModel` directly, so they cannot detect a regression in the newly added environment/preference precedence before the value reaches the menu.
  • Impact: Interactive onboarding can again ignore `NEMOCLAW_MODEL`, or select a recovered model over an explicit request, while the proxy-level menu tests continue to pass.
  • Recommendation: Add a focused unit test for `resolvePreferredOllamaModel` covering environment-only selection, requested-model precedence over the environment, and recovered-model fallback only when request and environment are absent.
  • Verification: Inspect a test importing `resolvePreferredOllamaModel` and stubbing `NEMOCLAW_MODEL` for the three precedence cases.
  • Test coverage: A unit test that asserts requested > nonempty NEMOCLAW_MODEL > recovered > null precedence in `resolvePreferredOllamaModel`.
  • Evidence: `src/lib/onboard/ollama-model-preference.ts:12` introduces the preference precedence chain. `src/lib/inference/ollama/proxy.test.ts` tests supplied `preferredModel` values but does not import or invoke `resolvePreferredOllamaModel`. The static test inventory lists no `ollama-model-preference` test file.

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@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

🤖 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/inference/ollama/proxy.test.ts`:
- Around line 223-235: Strengthen the test around promptOllamaModel so the
not-installed preferredModel case asserts the exact computed fallback selected
by this fixture, rather than accepting either installed model. Also assert the
prompt default index if it is exposed by the existing setup, while keeping the
test focused on fallback behavior rather than implementation details.
🪄 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: 0d30493f-f539-4a64-be17-e00b70ee80a2

📥 Commits

Reviewing files that changed from the base of the PR and between cf04a13 and f10f0cb.

📒 Files selected for processing (6)
  • docs/inference/set-up-ollama.mdx
  • src/lib/inference/local.test.ts
  • src/lib/inference/local.ts
  • src/lib/inference/ollama/proxy.test.ts
  • src/lib/inference/ollama/proxy.ts
  • src/lib/onboard.ts

Comment thread src/lib/inference/ollama/proxy.test.ts
…oard.ts

Keeps the top-level onboard entrypoint net-neutral per the codebase
growth guardrail.

Signed-off-by: Tinson Lai <tinsonl@nvidia.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

🤖 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/ollama-model-preference.ts`:
- Around line 15-24: Update promptOllamaModel in the Ollama proxy flow so
preferredModel is matched only when fitting installed models are available;
otherwise do not use the unavailable preference when selecting from bootstrap
options. Add a regression test covering an unavailable requested preference that
appears in the bootstrap list, ensuring it is not selected by default.
🪄 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: 89d319fd-7e98-4a52-8a01-d085b6e6d184

📥 Commits

Reviewing files that changed from the base of the PR and between f10f0cb and fd3a0cc.

📒 Files selected for processing (2)
  • src/lib/onboard.ts
  • src/lib/onboard/ollama-model-preference.ts

Comment thread src/lib/onboard/ollama-model-preference.ts
…ptions

promptOllamaModel matched preferredModel against bootstrap fallback
options too, so an uninstalled requested model could become the
Enter-key default and trigger an unrequested pull. Gate the match on
usingInstalled so the preference only applies to installed options.

Signed-off-by: Tinson Lai <tinsonl@nvidia.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/inference/ollama/proxy.test.ts (1)

195-195: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Append the issue reference to both test titles.

These titles are behavior-oriented, but the repository guideline requires local issue references as a final (#1234) suffix. These tests cover issue #6869.

Proposed fix
-  it("defaults the menu to the requested model rather than a fixed computed default", async () => {
+  it("defaults the menu to the requested model rather than a fixed computed default (`#6869`)", async () => {

-  it("ignores a preferred model that is only present in the bootstrap fallback, never the installed menu", async () => {
+  it("ignores a preferred model that is only present in the bootstrap fallback, never the installed menu (`#6869`)", async () => {

Also applies to: 237-237

🤖 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/inference/ollama/proxy.test.ts` at line 195, Append the issue
reference suffix “(`#6869`)” to both affected test titles in the Ollama proxy
test, including the test at the shown location and the additional matching test,
while preserving their existing behavior-oriented wording.

Source: Coding guidelines

src/lib/onboard.ts (1)

3022-3022: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add onboarding-boundary coverage for preferred Ollama models.

proxy.promptOllamaModel tests don’t cover the selectAndValidateOllamaModelpromptOllamaModelWithPreference wiring. Add a public-boundary test for installed, unavailable, and probe-excluded preferred models so onboarding exercises the preference/exclusion inputs end to end.

🤖 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.ts` at line 3022, Add public-boundary tests for the
onboarding flow that reaches selectAndValidateOllamaModel and
promptOllamaModelWithPreference, covering preferred models that are installed,
unavailable, and excluded by probing. Assert each scenario passes preference and
exclusion inputs through the public proxy.promptOllamaModel path and preserves
the expected model-selection outcome.

Source: Path instructions

🤖 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.

Outside diff comments:
In `@src/lib/inference/ollama/proxy.test.ts`:
- Line 195: Append the issue reference suffix “(`#6869`)” to both affected test
titles in the Ollama proxy test, including the test at the shown location and
the additional matching test, while preserving their existing behavior-oriented
wording.

In `@src/lib/onboard.ts`:
- Line 3022: Add public-boundary tests for the onboarding flow that reaches
selectAndValidateOllamaModel and promptOllamaModelWithPreference, covering
preferred models that are installed, unavailable, and excluded by probing.
Assert each scenario passes preference and exclusion inputs through the public
proxy.promptOllamaModel path and preserves the expected model-selection outcome.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d57bd574-f613-4e35-be95-7850860a50dc

📥 Commits

Reviewing files that changed from the base of the PR and between fd3a0cc and 9ea68a3.

📒 Files selected for processing (3)
  • src/lib/inference/ollama/proxy.test.ts
  • src/lib/inference/ollama/proxy.ts
  • src/lib/onboard.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/inference/ollama/proxy.ts

@laitingsheng
laitingsheng deleted the fix/6869-ollama-interactive-model-default branch July 15, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression NV QA Bugs found by the NVIDIA QA Team provider: ollama Ollama local model provider behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[All Platforms][Onboard] NEMOCLAW_PROVIDER_MODEL ignored — Ollama onboard auto-selects the alphabetically-first model

1 participant