fix(inference): use model-aware token field in rebuild preflight - #6860
Conversation
…PT-5 The chat completions branch hardcoded max_tokens, which GPT-5 and o-series reject (HTTP 400). Route the reply-budget field through resolveMaxTokensField to match the fixed request path. Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
📝 WalkthroughWalkthroughThe inference preflight probe now selects the max-token field based on the model. Tests verify GPT-5 and o-series models use ChangesInference preflight token selection
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage remains at 96%, unchanged from the TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most impacted files.
Updated |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/actions/sandbox/rebuild-inference-preflight.test.ts (1)
67-80: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover the o-series branch as well.
The resolver also maps
o1/o3/o4models tomax_completion_tokens, but these action-level tests cover only GPT-5 and the fallback branch. Add an o-series case to protect the full model-selection contract.Suggested test
+ it("sends max_completion_tokens for an o-series model on the chat completions route (`#6850`)", () => { + const command = buildRebuildInferenceProbeCommand({ ...input, model: "o3-mini" }); + + expect(command).toContain('"max_completion_tokens":8'); + expect(command).not.toContain('"max_tokens"'); + });🤖 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/actions/sandbox/rebuild-inference-preflight.test.ts` around lines 67 - 80, Add an action-level test alongside the existing GPT-5 and non-GPT-5 cases in the resolver test suite, using an o-series model such as o1, o3, or o4. Verify the generated chat-completions command contains max_completion_tokens with the expected value and excludes max_tokens, covering the resolver’s o-series branch.
🤖 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 `@src/lib/actions/sandbox/rebuild-inference-preflight.test.ts`:
- Around line 67-80: Add an action-level test alongside the existing GPT-5 and
non-GPT-5 cases in the resolver test suite, using an o-series model such as o1,
o3, or o4. Verify the generated chat-completions command contains
max_completion_tokens with the expected value and excludes max_tokens, covering
the resolver’s o-series branch.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 335b4448-bbdd-4793-bbe8-97c1ad0b04e5
📒 Files selected for processing (2)
src/lib/actions/sandbox/rebuild-inference-preflight.test.tssrc/lib/actions/sandbox/rebuild-inference-preflight.ts
PR Review Advisor — InformationalAdvisor assessment: Informational / high confidence Model lanes
Nemotron output stays in workflow artifacts and does not change the assessment above. E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: 1 optional E2E recommendation
This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
## Summary Add v0.0.83 release notes to `docs/about/release-notes.mdx` for pre-tag release prep. ## Source Summary - #6773 -> `docs/about/release-notes.mdx`: Shared inference route changes are explicit and fail-safe; status shows recorded route, live route, and drift. - #6875 -> `docs/about/release-notes.mdx`: DGX Station GB300 express setup restored; vLLM storage preflight narrowed. - #6770 -> `docs/about/release-notes.mdx`: Risky Spark vLLM server warning during onboarding. - #6856 -> `docs/about/release-notes.mdx`: Re-onboard reuse preserves tier-default brave/tavily presets. - #6867 -> `docs/about/release-notes.mdx`: Unreachable custom endpoint routed through transport-recovery path. - #6860 -> `docs/about/release-notes.mdx`: Rebuild preflight uses model-aware token field for o-series/GPT-5. - #6845 -> `docs/about/release-notes.mdx`: Corporate CA anchored for image build TLS. - #6833 -> `docs/about/release-notes.mdx`: SSH ControlMaster-delegated forwards recognized in fallback. - #6837 -> `docs/about/release-notes.mdx`: Hermes light skin writes via stdin on macOS. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [x] 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: - [x] Tests not applicable — justification: doc-only release notes - [x] Docs updated for user-facing behavior changes - [ ] Docs not applicable — justification: - [ ] Sensitive paths changed - [ ] Non-success, skipped, or missing CI check accepted by maintainer ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub - [x] Normal pre-commit, commit-msg, and pre-push hooks passed - [x] `npm run docs` passes with 0 errors Signed-off-by: Jessica Yaunches <jyaunches@nvidia.com> Signed-off-by: Jessica Yaunches <jyaunches@nvidia.com>
Summary
The atomic DCode rebuild gate probes the sandbox's recorded OpenAI-compatible route before making changes. Its Chat Completions payload hard-coded
max_tokens, so rebuilds configured with GPT-5 or o-series models could fail with HTTP 400 before rebuild processing began.This PR makes that rebuild-only probe use the shared model-aware token-field resolver. It does not change the managed gateway's ongoing route-health validation.
Scope
preflightRebuildInferenceRouteis called only by the DCode rebuild preflight. This PR intentionally does not change the managed gateway's ongoing route-health validation or claim broader runtime behavior.Changes
resolveMaxTokensField(input.model).max_completion_tokensfor GPT-5 and o1/o3/o4 model families.max_tokensfor models that support the legacy field.Type of Change
Quality Gates
Verification
Signed-off-by:lines and every commit is signednpm run check:diffnpm run build:clinpm run typecheck:clinpx vitest run --project cli src/lib/actions/sandbox/rebuild-inference-preflight.test.ts- 7 passedSigned-off-by: Tinson Lai tinsonl@nvidia.com
Signed-off-by: Prekshi Vyas prekshiv@nvidia.com
Summary by CodeRabbit