fix: Updated the effort level in Claude's adaptive thinking configuration, adding the “xhigh” option#1026
Conversation
…tion, adding the “xhigh” option
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
📝 WalkthroughWalkthrough将 Anthropic 自适应思考(adaptive thinking)的努力级别枚举扩展为包含新值 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a new "xhigh" effort level for Anthropic's adaptive thinking configuration, updating the UI components, validation schemas, and type definitions. A review comment identifies that the corresponding translation keys for the new "xhigh" option must be added to the locale files to ensure the UI displays human-readable labels instead of raw keys.
There was a problem hiding this comment.
Code Review Summary
This small PR adds a new xhigh effort level to the Anthropic adaptive thinking configuration. The type, validation schema, contract check, and Select dropdown are updated consistently. However, the corresponding i18n translations for the new dropdown option are missing in all 5 language files, which will cause a broken/raw label to render in the UI.
PR Size: XS
- Lines changed: 8 (4 additions, 4 deletions)
- Files changed: 4
Issues Found
| Category | Critical | High | Medium | Low |
|---|---|---|---|---|
| Logic/Bugs | 0 | 0 | 0 | 0 |
| Security | 0 | 0 | 0 | 0 |
| Error Handling | 0 | 0 | 0 | 0 |
| Types | 0 | 0 | 0 | 0 |
| Comments/Docs | 0 | 0 | 0 | 0 |
| Tests | 0 | 0 | 0 | 0 |
| Standards (i18n) | 0 | 1 | 0 | 0 |
| Simplification | 0 | 0 | 0 | 0 |
High Priority Issues (Should Fix)
- Missing i18n key
adaptiveThinking.effort.options.xhighin all 5 locales —src/app/[locale]/settings/providers/_components/adaptive-thinking-editor.tsx:88renders the option label viat('sections.routing.anthropicOverrides.adaptiveThinking.effort.options.${level}'), but none ofmessages/{en,zh-CN,zh-TW,ja,ru}/settings/providers/form/sections.jsondefine anxhighentry underadaptiveThinking.effort.options. The dropdown option will render a missing-key fallback. Violates CLAUDE.md rule: "i18n Required - All user-facing strings must use i18n (5 languages supported)". See inline comment for the suggested fix.
Review Coverage
- Logic and correctness - Clean
- Security (OWASP Top 10) - Clean
- Error handling - Clean
- Type safety - Clean (enum consistently extended across type, schema, contract)
- Documentation accuracy - Clean
- Test coverage - Existing tests should continue to pass; no new branches require coverage
- Code clarity - Good
Automated review by Claude AI
There was a problem hiding this comment.
Pull request overview
Adds support for a new "xhigh" effort level in the Anthropic/Claude adaptive thinking configuration so it can be represented consistently across types, validation, patch-contract validation, and the settings UI.
Changes:
- Extend
AnthropicAdaptiveThinkingEffortto include"xhigh". - Update Zod schemas and patch contract validation to accept
"xhigh". - Expose
"xhigh"in the Adaptive Thinking settings dropdown.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/types/provider.ts |
Extends the adaptive thinking effort union type with "xhigh". |
src/lib/validation/schemas.ts |
Updates ANTHROPIC_ADAPTIVE_THINKING_CONFIG schema to allow "xhigh". |
src/lib/provider-patch-contract.ts |
Updates runtime patch validation to accept "xhigh" effort. |
src/app/[locale]/settings/providers/_components/adaptive-thinking-editor.tsx |
Adds "xhigh" to the effort dropdown options. |
Comments suppressed due to low confidence (1)
src/app/[locale]/settings/providers/_components/adaptive-thinking-editor.tsx:92
- The UI now renders an "xhigh" effort option, but the corresponding i18n message key
sections.routing.anthropicOverrides.adaptiveThinking.effort.options.xhighis missing in the locale message files (e.g.messages/en/settings/providers/form/sections.json). This will cause the option label to fall back to the raw key at runtime; add the newxhighentry underadaptiveThinking.effort.optionsfor each supported locale.
{(["low", "medium", "high", "xhigh", "max"] as const).map((level) => (
<SelectItem key={level} value={level}>
{t(
`sections.routing.anthropicOverrides.adaptiveThinking.effort.options.${level}`
)}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const ANTHROPIC_ADAPTIVE_THINKING_CONFIG = z | ||
| .object({ | ||
| effort: z.enum(["low", "medium", "high", "max"]), | ||
| effort: z.enum(["low", "medium", "high", "xhigh", "max"]), | ||
| modelMatchMode: z.enum(["specific", "all"]), | ||
| models: z.array(z.string().min(1).max(100)).max(50), | ||
| }) |
There was a problem hiding this comment.
Please add/extend schema tests to cover the new "xhigh" adaptive thinking effort value (e.g. assert UpdateProviderSchema accepts { anthropic_adaptive_thinking: { effort: "xhigh", modelMatchMode: "all", models: [] } }). Without a test, it’s easy for future refactors to accidentally drop xhigh support from the validator.
Summary
Add the
xhigheffort level to Anthropic's adaptive thinking configuration, expanding the available options fromlow | medium | high | maxtolow | medium | high | xhigh | max.Problem
The Anthropic API supports
xhighas an effort level for adaptive thinking, but the proxy only allowed configuringlow,medium,high, andmax. Users who neededxhigheffort had no way to set it through the provider settings UI.Related:
low/medium/high/maxeffort levelsSolution
Add
xhighas a valid effort level across the type system, validation layer, and UI selector.Changes
Core Changes
src/types/provider.ts- Add"xhigh"toAnthropicAdaptiveThinkingEffortunion typesrc/lib/validation/schemas.ts- Add"xhigh"to the Zod enum for effort validationsrc/lib/provider-patch-contract.ts- Add"xhigh"to the effort values set in contract validationsrc/app/[locale]/settings/providers/_components/adaptive-thinking-editor.tsx- Add"xhigh"to the effort level selector optionsMissing Changes (Needs Attention)
i18n translations missing - The
xhighlabel has not been added to the adaptive thinking effort options in any of the 5 language files:messages/en/settings/providers/form/sections.json(needs"xhigh": "Extra High")messages/zh-CN/settings/providers/form/sections.jsonmessages/zh-TW/settings/providers/form/sections.jsonmessages/ja/settings/providers/form/sections.jsonmessages/ru/settings/providers/form/sections.jsonWithout these translations, the UI will display the raw i18n key instead of a localized label when
xhighis selected.No test updates - Existing tests in
tests/unit/settings/providers/adaptive-thinking-editor.test.tsxandtests/unit/actions/providers-patch-contract.test.tsdo not verify thexhighoption.Files Changed (4 files, +4/-4)
src/types/provider.ts"xhigh"to effort typesrc/lib/validation/schemas.ts"xhigh"to Zod enumsrc/lib/provider-patch-contract.ts"xhigh"to validation setsrc/app/[locale]/settings/providers/_components/adaptive-thinking-editor.tsx"xhigh"to UI optionsDescription enhanced by Claude AI
Greptile Summary
This PR adds
xhighas a valid effort level for Anthropic's adaptive thinking configuration, extending the existinglow | medium | high | maxoptions. The core change is propagated consistently across the type definition, Zod validation schema, contract validation set, UI selector, and all five i18n locale files — the second commit resolved the initially missing translations noted in the PR description.Confidence Score: 5/5
Safe to merge; the new effort level is propagated consistently across type, validation, contract, UI, and all i18n files.
All changed layers (type, Zod schema, contract Set, UI array, 5 locale files) are updated in sync. The only remaining finding is a P2 label wording concern — the "(Recommended)" designation on xhigh is unsupported by docs and inconsistent with other options, but it does not affect runtime correctness or data integrity.
All five locale files carry the potentially misleading "(Recommended)" suffix on the xhigh label.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD UI["UI Selector\nadaptive-thinking-editor.tsx\n[low, medium, high, xhigh, max]"] TYPE["Type Definition\nsrc/types/provider.ts\nAnthropicAdaptiveThinkingEffort"] ZOD["Zod Validation\nsrc/lib/validation/schemas.ts\nz.enum(...)"] CONTRACT["Contract Validation\nsrc/lib/provider-patch-contract.ts\nnew Set(...)"] I18N["i18n Files\nen / zh-CN / zh-TW / ja / ru\neffort.options.xhigh"] UI -->|"value='xhigh'"| TYPE TYPE -->|"satisfies"| ZOD TYPE -->|"satisfies"| CONTRACT UI -->|"t(effort.options.xhigh)"| I18NPrompt To Fix All With AI
Reviews (2): Last reviewed commit: "fix: Update on i18n for Claude Effort xH..." | Re-trigger Greptile