fix(core): use decimal Claude output limits - #6735
Conversation
|
Thanks for the PR! Template looks good ✓ Problem: Observed bug with evidence. Linked issue #6734 provides a clear reproduction — Anthropic's API rejects Direction: Correctly aligned. The fix targets a real user-facing 400 error for anyone using Claude Opus 4.6-4.8 without an explicit Size: 1 production line + 7 test lines. Minimal and focused. Approach: Scope is exactly right. One line changed in production code, tests updated to match. No scope creep, no drive-by refactors. The inline Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓ 问题:已观测到的 bug,有证据支持。 关联 issue #6734 提供了清晰的复现——Anthropic API 拒绝 方向:正确对齐。修复的是真实用户场景下的 400 错误——使用 Claude Opus 4.6-4.8 且不手动配置 规模:1 行生产代码 + 7 行测试。极简且聚焦。 方案:范围合理。生产代码只改了一行,测试同步更新。没有 scope creep,没有顺手重构。内联的 进入代码审查 🔍 — Qwen Code · qwen3.7-max |
Code ReviewThe diff is a single-line production change: the Claude Opus 4.6-4.8 output pattern switches from Independent proposal: I would have done exactly this — use an inline literal for the Claude-specific decimal limit rather than mutating the shared No issues found. The change is correct, minimal, and well-tested. The regex pattern Unit tests: 75/75 pass in Real-Scenario Testing (tmux)Verified the Before (installed build / main branch)After (this PR)All three Claude Opus models now correctly resolve to 128000. Sonnet 4.6 remains at 65536 (unchanged, correct). 中文说明代码审查diff 只改了一行生产代码:Claude Opus 4.6-4.8 的输出模式从 独立方案: 我会做完全一样的事情——用内联字面量表示 Claude 专属的十进制限制,而不是修改共享的 未发现问题。 改动正确、极简、测试覆盖充分。正则 单元测试: 真实场景测试(tmux)修复前后对比验证了 修复前(main 分支):三个 Claude Opus 模型的 output 均为 131072(超出 Anthropic API 上限 128000)。 修复后(本 PR):三个 Claude Opus 模型的 output 均为 128000(正确匹配 Anthropic API 上限)。Sonnet 4.6 保持 65536 不变。 — Qwen Code · qwen3.7-max |
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
|
This is a clean, well-evidenced bugfix. One line of production code changed, tests updated, before/after tmux output confirms the fix works exactly as described. The problem is real — Anthropic's API rejects I'd have written the same fix myself. Ships it. ✅ 中文说明这是一个干净、有充分证据的 bugfix。生产代码改了一行,测试同步更新,tmux 前后对比确认修复效果与描述一致。 问题是真实的——Anthropic API 拒绝 如果是我自己写,也会写出一模一样的修复。合并吧。✅ — Qwen Code · qwen3.7-max |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
Reviewed — no blockers. Suggestions are inline.
✅ Local verification — merge referenceI built and ran the real test suite locally in an isolated git worktree checked out at the PR head ( TL;DR: the fix is correct, minimal and centralized. Claude Opus 4.6–4.8 now default to Anthropic's exact decimal ceiling Before / AfterRan the PR's updated specs against the pre-PR source ( Runtime evidencePrinted the values the CLI actually resolves at runtime. Opus 4.6–4.8 → One policy point → propagates everywhere
Checks
Environment: macOS arm64 · isolated worktree at PR head Recommendation: LGTM — safe to merge. Single-line behavioral change ( 🇨🇳 中文版本(点击展开)✅ 本地验证 —— 合并参考我在一个隔离的 git worktree 中(检出到 PR head 结论: 该修复正确、最小化且集中。Claude Opus 4.6–4.8 现在默认使用 Anthropic 精确的十进制上限 前后对比将 PR 更新后的测试分别跑在合并前源码( 运行时证据打印了 CLI 在运行时实际解析出的数值:Opus 4.6–4.8 → 单一策略点 → 全链路生效
检查项
环境:macOS arm64 · 检出到 PR head 建议:LGTM —— 可以安全合并。 单行行为变更( |
|
Reviewed the remaining suggestion-only thread. I am not changing code for this PR because moving the inline |


What this PR does
Updates the default
max_tokensfor Claude Opus 4.6, 4.7, and 4.8 from the binary131072value to Anthropic's exact API ceiling of128000. The sharedLIMITS['128k']value remains unchanged, so models such as GLM that accept131072are unaffected.Why it's needed
#6718 added the 1M context and 128K output rules for Opus 4.6-4.8, but reused the binary 128K constant. Anthropic-compatible endpoints reject
131072because their maximum is128000, causing a 400 for users who do not explicitly configuresamplingParams.max_tokens.Reviewer Test Plan
How to verify
Remove any explicit
samplingParams.max_tokensfrom a Claude Opus model configuration, then confirm thatclaude-opus-4-6,claude-opus-4-7, and provider-prefixed IDs such asvertex/claude-opus-4-8resolve to128000. Also confirm that an OpenAI-compatible request withoutmax_tokensinjects128000.Evidence (Before & After)
Tmux testing: before this change,
claude-opus-4-6was rejected withmax_tokens: 131072 > 128000. After this change, the same path with an isolatedQWEN_HOMEand no explicitmax_tokensreturnedTMUX_46_128000_OKwith exit code 0.Tested on
Environment (optional)
macOS arm64;
npm run dev; isolatedQWEN_HOME; qwen-code 0.19.9.Risk & Scope
claude-opus-4-8tmux request was blocked by test-account model authorization. Full typecheck is blocked by pre-existingpackages/web-shelldaemon SDK type errors on currentmain.samplingParams.max_tokensbehavior is unchanged.Linked Issues
Resolves #6734