Skip to content

fix(onboard): inject Ollama interaction state - #5898

Merged
cv merged 3 commits into
mainfrom
codex/ollama-interaction-boundary
Jun 27, 2026
Merged

fix(onboard): inject Ollama interaction state#5898
cv merged 3 commits into
mainfrom
codex/ollama-interaction-boundary

Conversation

@cv

@cv cv commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR removes the Ollama tools-capability gate's hidden dependency on the onboarding entrypoint. Onboarding now supplies its interaction state explicitly, fixing --non-interactive and --yes behavior without a circular lazy import.

Related Issue

Fixes #4139.

Replacement for #4140, which identified the moved-path regression and established the initial test direction but cannot be updated without rewriting its unsigned, conflicting history.

Changes

  • Add a typed OllamaToolCapabilityInteraction boundary for non-interactive, auto-yes, and confirmation decisions.
  • Pass onboarding's in-memory interaction state into prepareOllamaModel explicitly.
  • Keep environment and credential-prompt defaults for standalone capability checks.
  • Remove all three lazy onboarding lookups and their swallowed exceptions from the Ollama proxy.
  • Add focused regressions for caller-supplied non-interactive, auto-yes, and interactive confirmation behavior.

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: the proxy and onboarding-selection suites cover the surrounding pull, validation, and selection flows.
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: this restores the already-documented --non-interactive, --yes, and Ollama tools-gate semantics without changing commands or output contracts.
  • 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: focused diff review verified that only interaction-state ownership changes; capability validation, override requirements, and credential handling are unchanged.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Git hooks passed during commit and push, or npx prek run --from-ref main --to-ref HEAD passes
  • Targeted tests pass for changed behavior
  • Full npm test passes (broad runtime changes only)
  • 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: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • Bug Fixes
    • Improved Ollama model tool-capability checks to consistently respect interaction modes (non-interactive, auto-yes, and explicit yes/no confirmation), skipping prompts when appropriate.
    • Updated onboarding flow so confirmation behavior is delegated cleanly when interactive input is required.
  • Tests
    • Expanded unit coverage to ensure non-interactive/auto-yes short-circuit correctly and that interactive confirmation receives the expected question and default choice.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c39e0fd5-9017-4c8d-aeb8-3f46a4b06a42

📥 Commits

Reviewing files that changed from the base of the PR and between 385cc01 and a870ac1.

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

📝 Walkthrough

Walkthrough

The Ollama tool-capability gate now uses an injected interaction policy threaded from onboarding into model preparation. The gate behavior, onboarding wiring, and tests were updated to handle non-interactive, auto-yes, and confirmation flows through that policy.

Changes

Ollama tool-capability gate

Layer / File(s) Summary
Interaction policy contract
src/lib/inference/ollama/proxy.ts
Defines OllamaToolCapabilityInteraction, adds the default env-backed implementation, and routes tool-capability handling through the injected policy.
Model preparation threading
src/lib/inference/ollama/proxy.ts
prepareOllamaModel accepts the interaction policy and forwards it into checkOllamaModelToolSupport.
Onboard wiring
src/lib/onboard.ts
selectAndValidateOllamaModel constructs the interaction object from current state and passes it into model preparation.
Test coverage
test/ollama-tools-capability.test.ts
Updates the module contract and adds cases for non-interactive, auto-yes, delegated confirmation, module loading order, and interaction threading behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

v0.0.69

🚥 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 is concise and accurately summarizes the main change: injecting Ollama interaction state into onboarding/proxy handling.
Linked Issues check ✅ Passed The PR replaces the hidden lazy onboard dependency with explicit interaction injection and preserves nonInteractive, autoYes, and prompt behavior required by #4139.
Out of Scope Changes check ✅ Passed The changes stay focused on Ollama interaction propagation and related tests, with no unrelated functional additions.
✨ 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 codex/ollama-interaction-boundary

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

@github-code-quality

github-code-quality Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in the codex/ollama-interac... branch is 96%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main codex/ollama-interac... a870ac1 +/-
nemoclaw/src/se...cret-scanner.ts 100%
nemoclaw/src/commands/slash.ts 100%
nemoclaw/src/li...bprocess-env.ts 100%
nemoclaw/src/bl...eprint/state.ts 98%
nemoclaw/src/onboard/config.ts 98%
nemoclaw/src/bl...int/snapshot.ts 97%
nemoclaw/src/bl...print/runner.ts 95%
nemoclaw/src/co...ration-state.ts 94%
nemoclaw/src/bl...ate-networks.ts 94%
nemoclaw/src/index.ts 94%

TypeScript / code-coverage/cli

The overall coverage in the codex/ollama-interac... branch is 47%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main codex/ollama-interac... a870ac1 +/-
src/lib/state/o...oard-session.ts 91%
src/lib/actions...dbox/rebuild.ts 73%
src/lib/sandbox/config.ts 72%
src/lib/onboard/preflight.ts 62%
src/lib/shields/index.ts 62%
src/lib/actions...licy-channel.ts 60%
src/lib/state/sandbox.ts 56%
src/lib/policy/index.ts 48%
src/lib/onboard...er-gpu-patch.ts 47%
src/lib/onboard.ts 18%

Updated June 27, 2026 07:12 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor (Nemotron Ultra) — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: Resolve or justify PRA-1: Pre-existing @ts-nocheck directive on proxy.ts.
Open items: 0 required · 1 warning · 2 suggestions · 3 test follow-ups
Since last review: 1 prior item resolved · 1 still applies · 0 new items found

Action checklist

  • PRA-1 Resolve or justify: Pre-existing @ts-nocheck directive on proxy.ts in src/lib/inference/ollama/proxy.ts:1
  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Runtime validation
  • PRA-T3 Add or justify test follow-up: Four new tests verify DI interaction injection boundary
  • PRA-2 In-scope improvement: prepareOllamaModel signature change — verified safe in src/lib/inference/ollama/proxy.ts:860
  • PRA-3 In-scope improvement: Four new tests verify DI interaction injection boundary in test/ollama-tools-capability.test.ts:430

Findings index

ID Severity Category Location Required action
PRA-1 Resolve/justify security src/lib/inference/ollama/proxy.ts:1 Consider removing @ts-nocheck in a follow-up if the file can be made type-safe, but not a blocker for this refactor.
PRA-2 Improvement correctness src/lib/inference/ollama/proxy.ts:860 Confirmed no external/standalone callers exist via grep. This item is resolved — no action needed.
PRA-3 Improvement tests test/ollama-tools-capability.test.ts:430 Tests are well-scoped. Consider adding a test for prepareOllamaModel with custom interaction to verify end-to-end propagation through pull → capability check → warmup → validate.
Review findings by urgency: 0 required fixes, 1 item to resolve/justify, 2 in-scope improvements

⚠️ Resolve or justify before merge

Investigate these in the current review; either fix them, explain why they are not applicable, or document the accepted risk.

PRA-1 Resolve/justify — Pre-existing @ts-nocheck directive on proxy.ts

  • Location: src/lib/inference/ollama/proxy.ts:1
  • Category: security
  • Problem: File retains pre-existing @ts-nocheck directive. No new TypeScript suppressions introduced by this PR.
  • Impact: TypeScript type safety not enforced for this file; could hide type errors in future changes.
  • Recommended action: Consider removing @ts-nocheck in a follow-up if the file can be made type-safe, but not a blocker for this refactor.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check line 1 of proxy.ts — // @ts-nocheck unchanged by this PR
  • Missing regression test: N/A — pre-existing suppression
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check line 1 of proxy.ts — // @ts-nocheck unchanged by this PR.
  • Evidence: Line 1 of proxy.ts shows // @ts-nocheck unchanged by this PR

💡 In-scope improvements

These are lower-risk, not throwaway. Prefer fixing them in this PR when they are local to changed code; defer only with rationale or a linked follow-up.

PRA-2 Improvement — prepareOllamaModel signature change — verified safe

  • Location: src/lib/inference/ollama/proxy.ts:860
  • Category: correctness
  • Problem: prepareOllamaModel now requires interaction parameter (was optional with default). Only caller is onboard.ts which now passes it. Default parameter preserves backward compatibility for standalone callers.
  • Impact: If any external/standalone callers exist, they would break at compile time (TypeScript) or runtime. Grep confirms only onboard.ts calls it.
  • Suggested action: Confirmed no external/standalone callers exist via grep. This item is resolved — no action needed.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Run grep -r 'prepareOllamaModel' --include='*.ts' across repo to confirm only onboard.ts calls it
  • Missing regression test: Integration test covering standalone proxy usage (if supported) would catch regression
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: proxy.ts:860 signature change; grep shows only onboard.ts:3326 calls it

PRA-3 Improvement — Four new tests verify DI interaction injection boundary

  • Location: test/ollama-tools-capability.test.ts:430
  • Category: tests
  • Problem: New tests cover: caller's non-interactive state, caller's auto-yes state, caller's confirm delegation, and threading through prepareOllamaModel. Good coverage of the new DI contract.
  • Impact: Ensures the new DI contract is tested; prevents regression of the fixed issue Ollama tools-capability gate still lazy-loads ./onboard after #3195 move and misses onboard non-interactive state #4139.
  • Suggested action: Tests are well-scoped. Consider adding a test for prepareOllamaModel with custom interaction to verify end-to-end propagation through pull → capability check → warmup → validate.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Run vitest on ollama-tools-capability.test.ts — new tests should pass
  • Missing regression test: prepareOllamaModel integration test with custom interaction
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Tests at lines 439, 462, 482, 502 in ollama-tools-capability.test.ts
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — prepareOllamaModel integration test with custom interaction to verify end-to-end propagation through pull → capability check → warmup → validate. Unit tests mock spawnSync/curl and cover all DI boundary behaviors (4 new + existing 17). Runtime/sandbox/infrastructure paths need behavioral runtime validation against real Ollama daemon for full confidence.
  • PRA-T2 Runtime validation — Non-interactive + NEMOCLAW_OLLAMA_REQUIRE_TOOLS=0 path against real Ollama. Unit tests mock spawnSync/curl and cover all DI boundary behaviors (4 new + existing 17). Runtime/sandbox/infrastructure paths need behavioral runtime validation against real Ollama daemon for full confidence.
  • PRA-T3 Four new tests verify DI interaction injection boundary — Tests are well-scoped. Consider adding a test for prepareOllamaModel with custom interaction to verify end-to-end propagation through pull → capability check → warmup → validate.
Since last review details

Current findings, using the urgency labels above:

PRA-1 Resolve/justify — Pre-existing @ts-nocheck directive on proxy.ts

  • Location: src/lib/inference/ollama/proxy.ts:1
  • Category: security
  • Problem: File retains pre-existing @ts-nocheck directive. No new TypeScript suppressions introduced by this PR.
  • Impact: TypeScript type safety not enforced for this file; could hide type errors in future changes.
  • Recommended action: Consider removing @ts-nocheck in a follow-up if the file can be made type-safe, but not a blocker for this refactor.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check line 1 of proxy.ts — // @ts-nocheck unchanged by this PR
  • Missing regression test: N/A — pre-existing suppression
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check line 1 of proxy.ts — // @ts-nocheck unchanged by this PR.
  • Evidence: Line 1 of proxy.ts shows // @ts-nocheck unchanged by this PR

PRA-2 Improvement — prepareOllamaModel signature change — verified safe

  • Location: src/lib/inference/ollama/proxy.ts:860
  • Category: correctness
  • Problem: prepareOllamaModel now requires interaction parameter (was optional with default). Only caller is onboard.ts which now passes it. Default parameter preserves backward compatibility for standalone callers.
  • Impact: If any external/standalone callers exist, they would break at compile time (TypeScript) or runtime. Grep confirms only onboard.ts calls it.
  • Suggested action: Confirmed no external/standalone callers exist via grep. This item is resolved — no action needed.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Run grep -r 'prepareOllamaModel' --include='*.ts' across repo to confirm only onboard.ts calls it
  • Missing regression test: Integration test covering standalone proxy usage (if supported) would catch regression
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: proxy.ts:860 signature change; grep shows only onboard.ts:3326 calls it

PRA-3 Improvement — Four new tests verify DI interaction injection boundary

  • Location: test/ollama-tools-capability.test.ts:430
  • Category: tests
  • Problem: New tests cover: caller's non-interactive state, caller's auto-yes state, caller's confirm delegation, and threading through prepareOllamaModel. Good coverage of the new DI contract.
  • Impact: Ensures the new DI contract is tested; prevents regression of the fixed issue Ollama tools-capability gate still lazy-loads ./onboard after #3195 move and misses onboard non-interactive state #4139.
  • Suggested action: Tests are well-scoped. Consider adding a test for prepareOllamaModel with custom interaction to verify end-to-end propagation through pull → capability check → warmup → validate.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Run vitest on ollama-tools-capability.test.ts — new tests should pass
  • Missing regression test: prepareOllamaModel integration test with custom interaction
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Tests at lines 439, 462, 482, 502 in ollama-tools-capability.test.ts

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: Add or justify PRA-T1 and any related test follow-ups.
Open items: 0 required · 0 warnings · 0 suggestions · 4 test follow-ups
Since last review: 2 prior items resolved · 0 still apply · 0 new items found

Action checklist

  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Runtime validation
  • PRA-T3 Add or justify test follow-up: Runtime validation
  • PRA-T4 Add or justify test follow-up: Acceptance clause
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — prepareOllamaModel(model) uses standalone env/prompt defaults without throwing when installedModels and interaction are omitted.. The changed unit-style tests cover the key injected helper branches, negative prompt paths, and prepareOllamaModel threading. Because this is onboarding/inference host glue in a runtime-sensitive path, targeted runtime-style validation would further increase confidence without relying on external E2E status.
  • PRA-T2 Runtime validation — onboard({ nonInteractive: true, ... }) with an Ollama no-tools model and NEMOCLAW_NON_INTERACTIVE unset passes in-memory nonInteractive to the capability gate and does not invoke the credential-store prompt.. The changed unit-style tests cover the key injected helper branches, negative prompt paths, and prepareOllamaModel threading. Because this is onboarding/inference host glue in a runtime-sensitive path, targeted runtime-style validation would further increase confidence without relying on external E2E status.
  • PRA-T3 Runtime validation — onboard({ autoYes: true, ... }) or the sandbox rebuild autoYes path accepts an Ollama no-tools model without NEMOCLAW_YES and propagates allowToolsIncompatible into validation.. The changed unit-style tests cover the key injected helper branches, negative prompt paths, and prepareOllamaModel threading. Because this is onboarding/inference host glue in a runtime-sensitive path, targeted runtime-style validation would further increase confidence without relying on external E2E status.
  • PRA-T4 Acceptance clause — One concrete path is sandbox rebuild, which calls: ```ts onboard({ resume: true, nonInteractive: true, recreateSandbox: true, autoYes: skipConfirm || rebuildConfirmed, }) ``` from `src/lib/actions/sandbox/rebuild.ts`. — add test evidence or identify existing coverage. The shared onboard Ollama-selection code now passes in-memory interaction state to prepareOllamaModel, which should cover rebuild callers. The changed tests do not directly drive the rebuild/onboard entrypoint through the Ollama no-tools gate.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: gpu-e2e
Optional E2E: gpu-double-onboard-e2e, ollama-proxy-e2e

Dispatch hint: gpu-e2e

Auto-dispatched E2E: gpu-e2e via nightly-e2e.yaml at a870ac10a94f35888ef3c6f388b310b91093ea98nightly run

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • gpu-e2e (high): Required because the PR affects the real local Ollama onboarding path: install/onboard starts Ollama, pulls or prepares the model, configures the auth proxy/provider, creates a sandbox, and verifies inference through the sandbox.

Optional E2E

  • gpu-double-onboard-e2e (high): Useful adjacent coverage for repeat Ollama onboarding and persisted proxy/provider behavior after the interaction-state refactor, but not merge-blocking because the changed code is primarily first-pass model preparation/confirmation.
  • ollama-proxy-e2e (medium): Optional host-side Ollama proxy confidence because the changed file also owns Ollama proxy helpers, though this PR does not directly modify token auth, proxy lifecycle, or persistence behavior.

New E2E recommendations

  • ollama-tools-capability-onboarding (medium): Existing GPU E2E exercises successful local Ollama onboarding but may not force a tools-incompatible model path or verify non-interactive/auto-yes/interactive confirmation behavior end-to-end through onboard.
    • Suggested test: Add an E2E or live scenario that uses a controlled Ollama model/capability stub or tiny no-tools model to verify --yes, non-interactive rejection, NEMOCLAW_OLLAMA_REQUIRE_TOOLS=0 override, and interactive decline/accept during onboarding.

Dispatch hint

  • Workflow: nightly-e2e.yaml
  • jobs input: gpu-e2e

@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Recommendation

Required Vitest E2E scenarios: gpu-e2e-vitest
Optional Vitest E2E scenarios: None

Dispatch required Vitest E2E scenarios:

  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=gpu-e2e-vitest

Workflow run

Full Vitest E2E advisor summary

Vitest E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required Vitest E2E scenarios

  • gpu-e2e-vitest: The PR changes local Ollama onboarding/model-preparation behavior, including how tools-capability confirmation state is injected from onboarding into the Ollama proxy helpers. The GPU Ollama free-standing Vitest job is the live Vitest path wired to exercise local Ollama onboarding with NEMOCLAW_PROVIDER=ollama.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=gpu-e2e-vitest

Optional Vitest E2E scenarios

  • None.

Relevant changed files

  • src/lib/inference/ollama/proxy.ts
  • src/lib/onboard.ts

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

🧹 Nitpick comments (1)
test/ollama-tools-capability.test.ts (1)

421-483: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add one regression through prepareOllamaModel() as well.

These cases prove the injected policy works when checkOllamaModelToolSupport() is called directly, but the bug described in this PR is the forwarding path from prepareOllamaModel(). Without one assertion through that entrypoint, a future break in the wiring can pass this file while reintroducing the original regression. As per path instructions, “Prefer observable outcomes through the public boundary over source-text, private-shape, or mock-call assertions.”

🤖 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 `@test/ollama-tools-capability.test.ts` around lines 421 - 483, Add a
regression test that exercises the public prepareOllamaModel() path, not just
checkOllamaModelToolSupport() directly, to verify the caller’s
non-interactive/auto-yes policy is forwarded correctly. Reuse the existing stub
setup in this test file, invoke prepareOllamaModel() with the same injected
state/confirm behavior, and assert the observable outcome matches the
tools-incompatible handling without relying on internal mock-call details.

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.

Nitpick comments:
In `@test/ollama-tools-capability.test.ts`:
- Around line 421-483: Add a regression test that exercises the public
prepareOllamaModel() path, not just checkOllamaModelToolSupport() directly, to
verify the caller’s non-interactive/auto-yes policy is forwarded correctly.
Reuse the existing stub setup in this test file, invoke prepareOllamaModel()
with the same injected state/confirm behavior, and assert the observable outcome
matches the tools-incompatible handling without relying on internal mock-call
details.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2aa5eb7d-963d-4bef-a037-c35982e040b4

📥 Commits

Reviewing files that changed from the base of the PR and between ab582f7 and d0b35cb.

📒 Files selected for processing (3)
  • src/lib/inference/ollama/proxy.ts
  • src/lib/onboard.ts
  • test/ollama-tools-capability.test.ts

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv

cv commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator Author

Review follow-up:

  • Resolved the exported-contract findings from both advisors in a870ac1: prepareOllamaModel again defaults installedModels to [] and defaults its interaction policy, preserving the standalone call shapes while onboarding still injects its live CLI state explicitly.
  • Added a focused regression test that exercises caller interaction propagation through prepareOllamaModel; the targeted CLI suite now passes 111 tests.
  • Repository search confirms onboarding is the only source caller. Direct checkOllamaModelToolSupport env/prompt defaults remain covered independently.
  • A real Ollama pull/probe test is not warranted for this policy-boundary change: pull, warmup, and validation behavior are unchanged, and the existing Ollama proxy E2E lane covers that runtime surface.
  • The pre-existing file-wide @ts-nocheck is intentionally out of scope; removing it is a substantially broader type-safety migration and this PR adds no new suppression.

@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ⚠️ No requested jobs ran

Run: 28282125719
Target ref: a870ac10a94f35888ef3c6f388b310b91093ea98
Workflow ref: main
Requested jobs: gpu-e2e
Summary: 0 passed, 0 failed, 0 cancelled, 1 skipped

Job Result
gpu-e2e ⏭️ skipped

@cv

cv commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator Author

GPT advisor follow-up (PRA-T1PRA-T4): these are justified without expanding this PR further. The restored standalone defaults are the pre-existing contract, and their env/prompt behavior is already exercised directly; driving prepareOllamaModel(model) would add a real model pull rather than isolate the compatibility property. The new tests separately prove all in-memory policy branches and prove that the policy is forwarded through model preparation. Onboarding and sandbox rebuild both feed the same isNonInteractive / isAutoYes functions into that now-tested boundary; exercising either whole entrypoint would mostly duplicate the large onboarding harness and unrelated sandbox lifecycle. The existing Ollama proxy E2E lane remains the appropriate runtime check and is green on this head.

@cv
cv merged commit 2330e39 into main Jun 27, 2026
46 checks passed
@cv
cv deleted the codex/ollama-interaction-boundary branch June 27, 2026 07:15
@cv cv added the v0.0.69 label Jun 27, 2026
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary
This PR removes the Ollama tools-capability gate's hidden dependency on
the onboarding entrypoint. Onboarding now supplies its interaction state
explicitly, fixing `--non-interactive` and `--yes` behavior without a
circular lazy import.

## Related Issue
Fixes NVIDIA#4139.

Replacement for NVIDIA#4140, which identified the moved-path regression and
established the initial test direction but cannot be updated without
rewriting its unsigned, conflicting history.

## Changes
- Add a typed `OllamaToolCapabilityInteraction` boundary for
non-interactive, auto-yes, and confirmation decisions.
- Pass onboarding's in-memory interaction state into
`prepareOllamaModel` explicitly.
- Keep environment and credential-prompt defaults for standalone
capability checks.
- Remove all three lazy onboarding lookups and their swallowed
exceptions from the Ollama proxy.
- Add focused regressions for caller-supplied non-interactive, auto-yes,
and interactive confirmation behavior.

## 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)

## Quality Gates
<!-- Check all that apply. For any "covered by existing tests", "not
applicable", or waiver entry, add a brief justification on the same line
or in the Changes section. -->
- [x] Tests added or updated for changed behavior
- [x] Existing tests cover changed behavior — justification: the proxy
and onboarding-selection suites cover the surrounding pull, validation,
and selection flows.
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: this restores the
already-documented `--non-interactive`, `--yes`, and Ollama tools-gate
semantics without changing commands or output contracts.
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: focused diff review
verified that only interaction-state ownership changes; capability
validation, override requirements, and credential handling are
unchanged.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification
<!-- Check each item you ran and confirmed. Leave unchecked items you
skipped. Doc-only changes do not require npm test unless you ran it. -->
- [x] PR description includes the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [x] Git hooks passed during commit and push, or `npx prek run
--from-ref main --to-ref HEAD` passes
- [x] Targeted tests pass for changed behavior
- [ ] Full `npm test` passes (broad runtime changes only)
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run 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)

---
<!-- DCO sign-off is required in this PR description, and every commit
must appear as Verified in GitHub. Run: git config user.name && git
config user.email -->
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


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

* **Bug Fixes**
* Improved Ollama model tool-capability checks to consistently respect
interaction modes (non-interactive, auto-yes, and explicit yes/no
confirmation), skipping prompts when appropriate.
* Updated onboarding flow so confirmation behavior is delegated cleanly
when interactive input is required.
* **Tests**
* Expanded unit coverage to ensure non-interactive/auto-yes
short-circuit correctly and that interactive confirmation receives the
expected question and default choice.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@wscurran wscurran added area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: providers Inference provider integrations and provider behavior bug-fix PR fixes a bug or regression labels Aug 1, 2026
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 area: providers Inference provider integrations and provider behavior bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ollama tools-capability gate still lazy-loads ./onboard after #3195 move and misses onboard non-interactive state

2 participants