fix(core): add Claude Opus 4.6-4.8 token limits - #6718
Conversation
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
Reviewed — no blockers. Suggestions are inline.
…-limits # Conflicts: # packages/core/src/tools/glob.test.ts # packages/core/src/tools/glob.ts
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. |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
Reviewed — no blockers. Suggestions are inline.
|
Addressed the PR-caused CI failure in I am not taking the three suggestion-only follow-ups in this closeout pass. Extracting/anchoring the repeated regex and adding an explanatory comment are maintainability hardening rather than current correctness gaps, while the case-dedup test targets unrelated glob work already present in the branch history. Keeping this pass scoped to the token-limit behavior and its failing CI coverage. |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅
— qwen3.7-max via Qwen Code /review
What this PR does
Updates the built-in token limits for Claude Opus 4.6, 4.7, and 4.8 to a 1M context window and a 128K synchronous output cap. The existing model-name normalization applies the same limits to provider-prefixed IDs such as
vertex/claude-opus-4-8.Why it's needed
These models currently fall through to the generic Claude 200K context and 64K output defaults. That can trigger compaction earlier than necessary and restrict the default output budget used by OpenAI-compatible endpoints.
Reviewer Test Plan
How to verify
Confirm that Opus 4.6, 4.7, and 4.8 resolve to a 1M input window and 128K output limit. Confirm that an OpenAI-compatible request for
vertex/claude-opus-4-8without an explicitmax_tokensreceives the 128K default.Evidence (Before & After)
N/A (non-UI token-limit metadata change).
Tested on
Environment (optional)
Local Node.js 22 workspace.
npm run buildnpm run typechecknpx vitest run src/core/tokenLimits.test.ts src/core/openaiContentGenerator/provider/default.test.ts src/core/anthropicContentGenerator/anthropicContentGenerator.test.ts(182 tests passed)npx eslint packages/core/src/core/tokenLimits.ts packages/core/src/core/tokenLimits.test.ts packages/core/src/core/openaiContentGenerator/provider/default.test.tsRisk & Scope
Linked Issues
Fixes #6719.
中文说明
此 PR 的改动
将 Claude Opus 4.6、4.7 和 4.8 的内置模型限制更新为 1M 上下文窗口和 128K 单次同步输出上限。模型 ID 带有
vertex/claude-opus-4-8等 provider 前缀时,也会通过现有模型名称规范化逻辑得到相同限制。为什么需要
这些模型当前会落入 Claude 的通用 200K 上下文和 64K 输出默认值。这可能导致过早触发压缩,并限制 OpenAI 兼容端点在未显式配置
max_tokens时的默认输出预算。Reviewer Test Plan
如何验证
确认 Opus 4.6、4.7、4.8 都解析为 1M 输入窗口和 128K 输出上限。确认 OpenAI 兼容请求在未显式配置
max_tokens时,对vertex/claude-opus-4-8使用 128K 默认值。证据(修改前后)
不适用(非 UI 的 token-limit 元数据变更)。
已测试环境
环境(可选)
本地 Node.js 22 workspace。
npm run buildnpm run typechecknpx vitest run src/core/tokenLimits.test.ts src/core/openaiContentGenerator/provider/default.test.ts src/core/anthropicContentGenerator/anthropicContentGenerator.test.ts(182 项通过)npx eslint packages/core/src/core/tokenLimits.ts packages/core/src/core/tokenLimits.test.ts packages/core/src/core/openaiContentGenerator/provider/default.test.ts风险与范围
关联 Issue
修复 #6719。