feat(onboard): warn on Ollama models without tools capability (#2667) - #3097
Conversation
…#2667) Users who pick an Ollama model that lacks tool-calling capability (e.g. phi4) hit "HTTP 400 ... does not support tools" the first time the agent tries to invoke a tool. The TUI surfaces only the raw error and there is no early signal during onboarding that the chosen model will not work. Add an onboard-time capability check and a friendlier runtime mapping so the user finds out as early as possible. Onboard-time check (primary fix): - New `probeOllamaModelCapabilities` POSTs `/api/show` against the local Ollama daemon and parses the `capabilities` array. Defensive parsing returns "unknown" on any failure (HTTP error, empty body, malformed JSON, missing field) so we never false-positive-block. - New `checkOllamaModelToolSupport` runs inside `prepareOllamaModel` after the pull and before warmup. When the model lacks `tools`: prints a warning naming the model and tools-capable alternatives (qwen2.5:7b, llama3.1, mistral-nemo, nemotron-3-nano:30b), then branches on auto-yes / non-interactive / interactive prompt. - `NEMOCLAW_OLLAMA_REQUIRE_TOOLS=0` is the non-interactive override (default 1: block). Runtime fallback: - `validateOllamaModel` now detects `/does not support tools/i` in the /api/generate error payload and rewrites the user-facing message to name the model and recommend a replacement, so even users who already onboarded against an incompatible model get an actionable hint. 13 unit tests cover the 13 architect-specified scenarios; 70/70 across the broader Ollama suite still pass. Signed-off-by: Tony Luo <xialuo@nvidia.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Ollama tool-capability detection and gating: a /api/show probe returning a new ChangesOllama Tool-Capability Detection
Sequence DiagramsequenceDiagram
actor User
participant TUI
participant OnboardProxy as onboard-ollama-proxy
participant LocalInf as local-inference
participant OllamaAPI as Ollama /api/show
User->>TUI: Request load model
TUI->>OnboardProxy: prepareOllamaModel(model)
OnboardProxy->>OnboardProxy: checkOllamaModelToolSupport(model)
OnboardProxy->>LocalInf: probeOllamaModelCapabilities(model)
LocalInf->>OllamaAPI: POST /api/show { name: model }
OllamaAPI-->>LocalInf: { capabilities: [...], ... } or error
LocalInf-->>OnboardProxy: OllamaCapabilities (supportsTools: true/false/null)
alt supportsTools is false & interactive
OnboardProxy->>User: print warning + prompt
User-->>OnboardProxy: response
alt User declines
OnboardProxy-->>TUI: { ok: false, message }
else User accepts or auto-yes
OnboardProxy-->>TUI: { ok: true }
end
else supportsTools is true OR null
OnboardProxy-->>TUI: { ok: true }
end
OnboardProxy->>OnboardProxy: proceed with pull/load sequence
OnboardProxy-->>TUI: model ready / streaming responses
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
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 `@test/ollama-tools-capability.test.ts`:
- Around line 236-238: The cast on localInference is too direct; update it to go
through unknown first to satisfy TypeScript (i.e., cast localInference to
unknown then to Record<string, unknown>) before assigning
probeOllamaModelCapabilities so the assignment to SHARED.scriptedCaps is
type-safe; locate the expression using localInference and
probeOllamaModelCapabilities and replace the direct cast with the intermediate
unknown cast.
🪄 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: a88c8b90-13dd-4243-9178-3f75cf64b1d3
📒 Files selected for processing (3)
src/lib/local-inference.tssrc/lib/onboard-ollama-proxy.tstest/ollama-tools-capability.test.ts
CodeRabbit and CI typecheck flagged the direct `localInference as Record<string, unknown>` cast as a non-overlapping type assertion. Use the documented `as unknown as ...` pattern. Signed-off-by: Tony Luo <xialuo@nvidia.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
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 `@test/ollama-tools-capability.test.ts`:
- Around line 230-266: The proxy module is cached and can be loaded before our
stubs are installed, causing order-dependent tests; in loadProxyWithStubs() call
the installSharedStubs() first (already done) and then clear Node's require
cache for the onboard proxy module (resolve ONBOARD_OLLAMA_PROXY_PATH and delete
its entry from require.cache) before requiring it so the module re-evaluates and
picks up the patched probeOllamaModelCapabilities and credential.prompt stubs;
keep SHARED resets and then require the proxy as before.
🪄 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: f2d578d6-1436-46e4-8381-31d0630fe91a
📒 Files selected for processing (1)
test/ollama-tools-capability.test.ts
CodeRabbit flagged that loadProxyWithStubs reuses the cached onboard-ollama-proxy module. The proxy destructures probeOllamaModelCapabilities at module load, so if another test file loaded it first, the cached copy is bound to the original probe and our stub never takes effect. Delete require.cache for the proxy path before re-requiring, so the fresh module run picks up the stubbed local-inference exports. Signed-off-by: Tony Luo <xialuo@nvidia.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cv pointed out the curated list of tools-capable Ollama models will go stale fast (and was already out of date). Remove TOOLS_CAPABLE_OLLAMA_MODELS and direct users to discover capabilities themselves via 'ollama show <model>' — the same source of truth NemoClaw probes during onboarding. User-facing changes: - Onboard warning: "Inspect a model's capabilities with `ollama show <model>` and pick one whose list includes 'tools'." - Runtime error rewrite (validateOllamaModel): same guidance, no recommended models. Test assertion updated to check for the `ollama show` guidance instead of the (now removed) hardcoded list membership. Signed-off-by: Tony Luo <xialuo@nvidia.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
## Summary - Bump docs metadata to 0.0.36 and refresh generated NemoClaw user skills. - Document Model Router onboarding, validation retries, Ollama tool checks, Hermes policy behavior, and deployment verification updates. - Remove suppressed experimental command references from public docs per `docs/.docs-skip`. ## Source summary - #2202 -> `docs/get-started/quickstart.md`, `docs/inference/inference-options.md`, `docs/reference/architecture.md`: Document Model Router setup and routed inference architecture. - #3128 -> `docs/get-started/quickstart.md`, `docs/reference/commands.md`: Document deployment verification and HTTP 401 health handling. - #3104 -> `docs/inference/inference-options.md`: Document retry behavior for transient provider validation failures. - #3121 -> `docs/reference/architecture.md`: Document agent-scoped model/provider compatibility manifests. - #3046 -> `docs/reference/architecture.md`: Tie model-specific compatibility setup to known model/provider behavior. - #3097 -> `docs/inference/use-local-inference.md`: Document Ollama tool-calling capability validation. - #3082 -> `docs/reference/commands.md`: Document `NEMOCLAW_SANDBOX_NAME` as the interactive sandbox-name default. - f586cc5, 3442adf -> `docs/get-started/quickstart-hermes.md`, `docs/reference/network-policies.md`: Document Hermes agent-specific baseline policy endpoints. ## Test plan - `python3 scripts/docs-to-skills.py docs/ .agents/skills/ --prefix nemoclaw-user` - `make docs` - `npm run build:cli` - `rg` skip-term scan for `docs/` and generated user skills Made with [Cursor](https://cursor.com) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Model Router provider for complexity-based routed inference. * Ollama/local inference onboarding now validates tool-calling capability. * Added `local-inference` network policy preset. * **Documentation** * New integration policy examples (Outlook, Telegram, Slack, Discord, GitHub, Jira, etc.). * Clarified config immutability workflow and sandbox writable paths. * Hermes baseline network policy documented. * **Improvements** * Health checks treat device-auth responses as live; transient validation retries. * Installer performs pre-install reachability checks; CLI onboarding gained a --fresh option. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Fixes #2667 — users who picked an Ollama model without tool-calling support (e.g. `phi4`) hit `HTTP 400 ... does not support tools` the first time the agent invoked a tool, with no early signal during onboarding that the chosen model would not work.
This adds an onboard-time capability check plus a friendlier runtime mapping so users find out as early as possible and get an actionable hint either way.
What changed
Onboard-time check (primary fix)
Runtime fallback
No new CLI flags. One env var: `NEMOCLAW_OLLAMA_REQUIRE_TOOLS` (default `1`).
Architectural notes
Test plan
Signed-off-by: Tony Luo xialuo@nvidia.com
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests