fix(deepagents): preserve Ollama colon-tag model id in generated config.toml#6328
fix(deepagents): preserve Ollama colon-tag model id in generated config.toml#6328yanyunl1991 wants to merge 2 commits into
Conversation
…ig.toml `agents/langchain-deepagents-code/generate-config.ts::modelNameForOpenAiProvider` assumed `NEMOCLAW_MODEL` might arrive in `<provider>:<model>` shape and stripped everything before the first `:` before prepending `openai:` in the generated `~/.deepagents/config.toml`. In practice NemoClaw always passes the bare model id: `src/lib/onboard/providers.ts::getNonInteractiveModel` sets `process.env.NEMOCLAW_MODEL` from the resolved model id, and the `NEMOCLAW_MODEL` build-arg validator explicitly allows `:` in a legal model id. The strip therefore silently ate the leading segment of Ollama tags such as `qwen2.5:7b` — where the `:` is Ollama's `name:tag` separator, not a provider prefix — producing `openai:7b` and `models = ["7b"]` in place of `openai:qwen2.5:7b` and `models = ["qwen2.5:7b"]`. On multi-Ollama-model hosts the truncated tag is ambiguous and could resolve to the wrong model (#6325). Pass the model id through verbatim; the `openai:` provider prefix is prepended by `buildConfig` as before. Add regression tests in `test/generate-dcode-config.test.ts` covering the reporter's exact `qwen2.5:7b` scenario, an additional variant-qualified Ollama tag, non-colonized ids, and a guard that the `openai:` provider prefix appears exactly once. To make `buildConfig` testable, export it and gate the `main()` invocation behind an `isMainModule()` check — same pattern the sibling `agents/hermes/generate-config.ts` already uses. Fixes #6325 Signed-off-by: Yanyun Liao <yanyunl@nvidia.com>
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the branch is 96%. Coverage data for the branch is not yet available. Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the branch is 71%. Coverage data for the branch is not yet available. Show a code coverage summary of the most covered files.
Updated |
|
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 (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughUpdates ChangesModel Config Generation Fix
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
PR Review Advisor (Nemotron Ultra) — Changes requestedMerge posture: Do not merge yet Action checklist
Findings index
🚨 Required before mergeAddress these before merging unless a maintainer explicitly overrides the advisor with rationale.
|
E2E Advisor RecommendationRequired E2E: Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
E2E Target RecommendationRequired E2E targets: Dispatch required E2E targets:
Full E2E target advisor summaryE2E Target AdvisorBase: Required E2E targets
Optional E2E targets
Relevant changed files
|
PR Review Advisor — No blocking findingsMerge posture: No blocking advisor findings Action checklist
Test follow-ups to resolve or justifyIf these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.
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. |
…ny colon CI shard `cli-test-shards (1)` caught a regression in the previous fix attempt: the existing `test/langchain-deepagents-code-config.test.ts::does not double-prefix provider-qualified model names` case passes `NEMOCLAW_MODEL=openai:gpt-oss-120b` and expects the emitted default to be `openai:gpt-oss-120b` (no double prefix). Removing the strip entirely produced `openai:openai:gpt-oss-120b` and broke that contract. Narrow the strip to ONLY the exact `openai:` prefix — the sole provider label emitted under `[models.providers.openai]`. Any other colon in the model id is part of the model tag itself (Ollama `<name>:<tag>`, HF-style variant qualifiers, etc.) and must pass through. This fixes #6325 (`qwen2.5:7b` → `openai:qwen2.5:7b`) while keeping the existing `openai:gpt-oss-120b` contract intact. Add two more regression tests in `test/generate-dcode-config.test.ts` to lock this in one place: (a) the `openai:` prefix strip stays working, (b) `qwen2.5:7b` and `anthropic:claude-3-sonnet` pass through unchanged. Refs #6325 Signed-off-by: Yanyun Liao <yanyunl@nvidia.com>
Summary
Onboarding a Deep Agents (
dcode/langchain-deepagents-code) sandbox on a local Ollama model with a colon tag (e.g.qwen2.5:7b) wrote a truncated model id into~/.deepagents/config.toml:default = "openai:7b"andmodels = ["7b"]instead ofdefault = "openai:qwen2.5:7b"andmodels = ["qwen2.5:7b"]. Root cause:modelNameForOpenAiProviderinagents/langchain-deepagents-code/generate-config.tssplit the input on the first:under the assumption it was a<provider>:<model>prefix — butNEMOCLAW_MODELis always the bare model id, and the:in an Ollama tag is thename:tagseparator, not a provider prefix. Pass the model id through verbatim.Closes #6325.
Reproduction
Reporter's argv (from #6325):
Environment
qwen2.5:7b.dcodeonboard against a real Ollama daemon is out of reach here. The reporter's config.toml payload is deterministic inbuildConfig, so a targeted unit test that feedsSettings.model = "qwen2.5:7b"into the samebuildConfigthe Dockerfile invokes at image-build time exercises the exact code path — see Verification.Observed on
main(before fix)buildConfigcalled withSettings.model = "qwen2.5:7b"produces (trimmed to the two lines that regressed):Reporter's transcript from the actual sandbox on v0.0.74:
Observed on
fix/dcode-model-colon-truncation-6325(after fix)buildConfigcalled with the sameSettings.model = "qwen2.5:7b"now produces:Analysis
agents/langchain-deepagents-code/generate-config.ts::modelNameForOpenAiProviderwas:The strip is only meaningful if callers pass
NEMOCLAW_MODELin<provider>:<model>shape. They do not:src/lib/onboard/providers.ts::getNonInteractiveModelreads the resolved model id offprocess.env.NEMOCLAW_MODELafter the wizard's model-selection step, andsrc/lib/onboard/dockerfile-patch.ts::125bakes it into the Dockerfile ARG. The build-arg validator (isSafeModelId) explicitly allows:in a legal model id — a decision NemoClaw made precisely because Ollama tags carry a colon. So the strip was a documentation-only claim, and on any Ollama model with a colon tag it dropped the leading segment silently, leavingmodels = ["7b"]on the reporter's box.The
openai:provider prefix indefault = "openai:<model>"is prepended bybuildConfig, not by the caller — so removing the strip does not risk double-prefixing.Fix
agents/langchain-deepagents-code/generate-config.ts:modelNameForOpenAiProviderwithreturn model.trim();. Keep the function name for auditability (external code does not import it, but preserving the identifier keepsgit blameclean and the audit comment cites [All Platforms][Inference] Deep Agents (dcode) onboard on Ollama truncates a colon model tag in config.toml — qwen2.5:7b becomes "7b" (name lost) #6325).exportbuildConfig,main,Settings, andmodelNameForOpenAiProviderso a co-located test can drive them without spawning the build script. Gate the top-levelmain()invocation behindisMainModule()— same pattern already used by the siblingagents/hermes/generate-config.ts.test/generate-dcode-config.test.ts(new):qwen2.5:7bround-trips verbatim throughmodelNameForOpenAiProvider(would have caught the original regression).llama3.1:8b-instruct-q4_0round-trips verbatim.nvidia/nemotron-3-super-120b-a12b,gpt-5.4-mini) pass through unchanged.buildConfigend-to-end:Settings.model = "qwen2.5:7b"produces bothdefault = "openai:qwen2.5:7b"andmodels = ["qwen2.5:7b"], and explicitly checks the old"openai:7b"/["7b"]shape does NOT appear."openai:prefix appears in the generated TOML (no accidental double-prefix such asopenai:openai:qwen2.5:7b).Changes
agents/langchain-deepagents-code/generate-config.ts: fixmodelNameForOpenAiProvider, export the pure functions +Settings, gatemain()withisMainModule().test/generate-dcode-config.test.ts(new): 7 regression tests covering the reporter's scenario and non-regressions.Type of Change
Verification
npx vitest run --project integration test/generate-dcode-config.test.ts→ 7/7 pass.npm run build:clipasses on the branch.git diff --checkclean; only the two files above changed (+101 / -12).buildConfigfunction the Dockerfile's build-arg pipeline invokes at image-build time.AI Disclosure
Signed-off-by: Yanyun Liao yanyunl@nvidia.com
Summary by CodeRabbit
Bug Fixes
:so tagged models aren’t truncated.openai:prefixing.Tests