Skip to content

fix(onboard): resolve moved Ollama lazy-load path - #4140

Closed
fallintoplace wants to merge 2 commits into
NVIDIA:mainfrom
fallintoplace:fix/ollama-onboard-lazy-load-path
Closed

fix(onboard): resolve moved Ollama lazy-load path#4140
fallintoplace wants to merge 2 commits into
NVIDIA:mainfrom
fallintoplace:fix/ollama-onboard-lazy-load-path

Conversation

@fallintoplace

@fallintoplace fallintoplace commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • resolve the moved onboard lazy-load path inside the Ollama tools-capability gate
  • restore access to onboard-backed nonInteractive state and the shared prompt helper after the #3195 file move
  • add regression coverage for onboard-backed non-interactive and prompt-helper paths

Root cause

#3195 moved src/lib/onboard-ollama-proxy.ts to src/lib/inference/ollama/proxy.ts, but the lazy-load sites kept require("./onboard").

That path was correct in the old location, but from src/lib/inference/ollama/proxy.ts it resolves to a nonexistent sibling module instead of src/lib/onboard.ts. The catch blocks then silently fall back to env vars only.

Scope

This change keeps the fix narrow and only repairs the moved-module path regression plus the missing regression coverage.

It does not expand the in-memory autoYes behavior, since isAutoYes is not currently exported from src/lib/onboard.ts and would be a separate scope decision.

Testing

  • npm run build:cli
  • npm test -- test/ollama-tools-capability.test.ts

Fixes #4139

Summary by CodeRabbit

  • Chores

    • Updated internal module loading patterns.
  • Tests

    • Enhanced test infrastructure and expanded test coverage for proxy configuration scenarios.

Review Change Stack

@copy-pr-bot

copy-pr-bot Bot commented May 23, 2026

Copy link
Copy Markdown

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

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

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: c0cc5f84-b625-4a5d-88b2-165a65f0c0c7

📥 Commits

Reviewing files that changed from the base of the PR and between de3b9ba and a16be7f.

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

📝 Walkthrough

Walkthrough

Two files were updated to fix a regression where the Ollama tools-capability gate lost access to onboard module state after a directory refactor. The relative require paths are corrected from ./onboard to ../../onboard, and test harness infrastructure is extended to stub onboard exports and validate the fix with new test coverage.

Changes

Ollama tools-capability gate onboard access restoration

Layer / File(s) Summary
Path correction in proxy.ts
src/lib/inference/ollama/proxy.ts
Three lazy-require call sites (isProxyNonInteractive, isProxyAutoYes, promptProxyYesNo) update their relative paths from ./onboard to ../../onboard to correctly resolve the onboard module from its new location.
Test harness onboard stubbing infrastructure
test/ollama-tools-capability.test.ts
Expands the proxy test harness to capture, stub, and restore the onboard module's cached entry, introducing OnboardModuleExports interface, a setOnboardExports() setter, and helpers to manipulate the require-cache state during test setup/teardown.
Test cases for onboard export behavior
test/ollama-tools-capability.test.ts
Adds two new test cases: one verifying that the gate respects onboard isNonInteractive export state and blocks without prompting, and another verifying that the gate uses onboard's promptYesNoOrDefault export when available instead of the local fallback.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Suggested labels

bug, NemoClaw CLI, fix

Suggested reviewers

  • ericksoa
  • cv

Poem

🐰 Three paths were lost in the module maze,
Where onboard light no longer plays,
A fix hops in—../../ shows the way,
Tests guard the gate through night and day. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately reflects the main change: fixing the lazy-load path for the relocated onboard module in the Ollama proxy.
Linked Issues check ✅ Passed The PR directly addresses all coding objectives from issue #4139: correcting the lazy require path from './onboard' to '../../onboard', ensuring access to onboard module state for nonInteractive and prompt helper, and adding regression test coverage.
Out of Scope Changes check ✅ Passed All changes are within scope: path corrections in proxy.ts and test infrastructure/coverage additions in the test file align with the stated narrow fix and regression testing objectives.

✏️ 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.

@fallintoplace
fallintoplace marked this pull request as ready for review May 23, 2026 23:37
@wscurran

Copy link
Copy Markdown
Contributor

✨ Thanks for submitting this detailed PR about resolving the moved onboard lazy-load path inside the Ollama tools-capability gate. This proposes a fix for the regression caused by the file move in #3195 and adds regression coverage for onboard-backed non-interactive and prompt-helper paths.


Related open PRs:


Related open issues:

@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure area: local-models Local model providers, downloads, launch, or connectivity area: providers Inference provider integrations and provider behavior bug-fix PR fixes a bug or regression feature PR adds or expands user-visible functionality and removed Local Models feature PR adds or expands user-visible functionality labels Jun 3, 2026
@cv

cv commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Thanks for identifying the moved-path regression and establishing the initial regression-test direction here. #5898 is a fresh replacement because this branch now conflicts with main and its unsigned published commit cannot be rewritten under the repository's current verification policy. The replacement preserves the issue intent while removing the Ollama proxy's onboarding dependency entirely through an explicit interaction boundary. Please continue review on #5898.

cv added a commit that referenced this pull request Jun 27, 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 #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

- [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>
@fallintoplace

Copy link
Copy Markdown
Contributor Author

I am glad this issue is fixed. @cv

Feel free to close or amend this PR.

@apurvvkumaria apurvvkumaria self-assigned this Jul 8, 2026
@apurvvkumaria

Copy link
Copy Markdown
Collaborator

Closing as superseded by #5898, which merged as 2330e39552b0405345c1777883f4f6dacef24105 and closed #4139.

There is no remaining gap on current main (fed46043459497011c65884720cb24a354cfb2bb):

That explicit interaction boundary supersedes this PR's path-only change in a07b5c29deea1404243bfc03bb65cfde42bfeaf8. This branch is also conflicting; that first commit is unsigned/unverified and has no sign-off, while the later verified merge commit does not repair its history and the PR body has no DCO declaration.

Thank you @fallintoplace for the original moved-path diagnosis and regression-test direction. #5898 explicitly preserved and credited that contribution, and your follow-up here confirmed that this PR may be closed.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure area: local-models Local model providers, downloads, launch, or connectivity 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

4 participants