Skip to content

fix: Updated the effort level in Claude's adaptive thinking configuration, adding the “xhigh” option#1026

Merged
ding113 merged 2 commits into
ding113:devfrom
ilnli:dev
Apr 17, 2026
Merged

fix: Updated the effort level in Claude's adaptive thinking configuration, adding the “xhigh” option#1026
ding113 merged 2 commits into
ding113:devfrom
ilnli:dev

Conversation

@ilnli

@ilnli ilnli commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Add the xhigh effort level to Anthropic's adaptive thinking configuration, expanding the available options from low | medium | high | max to low | medium | high | xhigh | max.

Problem

The Anthropic API supports xhigh as an effort level for adaptive thinking, but the proxy only allowed configuring low, medium, high, and max. Users who needed xhigh effort had no way to set it through the provider settings UI.

Related:

Solution

Add xhigh as a valid effort level across the type system, validation layer, and UI selector.

Changes

Core Changes

  • src/types/provider.ts - Add "xhigh" to AnthropicAdaptiveThinkingEffort union type
  • src/lib/validation/schemas.ts - Add "xhigh" to the Zod enum for effort validation
  • src/lib/provider-patch-contract.ts - Add "xhigh" to the effort values set in contract validation
  • src/app/[locale]/settings/providers/_components/adaptive-thinking-editor.tsx - Add "xhigh" to the effort level selector options

Missing Changes (Needs Attention)

  • i18n translations missing - The xhigh label 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.json
    • messages/zh-TW/settings/providers/form/sections.json
    • messages/ja/settings/providers/form/sections.json
    • messages/ru/settings/providers/form/sections.json

    Without these translations, the UI will display the raw i18n key instead of a localized label when xhigh is selected.

  • No test updates - Existing tests in tests/unit/settings/providers/adaptive-thinking-editor.test.tsx and tests/unit/actions/providers-patch-contract.test.ts do not verify the xhigh option.

Files Changed (4 files, +4/-4)

File Change
src/types/provider.ts Add "xhigh" to effort type
src/lib/validation/schemas.ts Add "xhigh" to Zod enum
src/lib/provider-patch-contract.ts Add "xhigh" to validation set
src/app/[locale]/settings/providers/_components/adaptive-thinking-editor.tsx Add "xhigh" to UI options

Description enhanced by Claude AI

Greptile Summary

This PR adds xhigh as a valid effort level for Anthropic's adaptive thinking configuration, extending the existing low | medium | high | max options. 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

Filename Overview
src/types/provider.ts Adds "xhigh" to AnthropicAdaptiveThinkingEffort union type; change is minimal and correct.
src/lib/validation/schemas.ts Adds "xhigh" to Zod enum for effort validation; consistent with type change.
src/lib/provider-patch-contract.ts Adds "xhigh" to the effortValues Set for contract validation; consistent with other changes.
src/app/[locale]/settings/providers/_components/adaptive-thinking-editor.tsx Adds "xhigh" to the UI selector array; placed semantically between "high" and "max".
messages/en/settings/providers/form/sections.json Adds "xhigh": "Xhigh (Recommended)" label; the "(Recommended)" tag is inconsistent with all other effort level labels and lacks documentation backing.
messages/zh-CN/settings/providers/form/sections.json Adds "xhigh": "超高(推荐)"; consistently marks as recommended across all 5 locales.

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)"| I18N
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: messages/en/settings/providers/form/sections.json
Line: 266

Comment:
**Unsupported "(Recommended)" designation**

Only `xhigh` is labelled as "Recommended" across all five locales, while `low`, `medium`, `high`, and `max` carry no such tag. There is no reference in the PR or the Anthropic docs to indicate that `xhigh` is the recommended effort level over `max`. This label is inconsistent with the rest of the selector and may mislead users into choosing `xhigh` based on a claim that isn't backed by the API specification.

```suggestion
            "xhigh": "Extra High",
```
The same adjustment should be applied to the other four locale files (`zh-CN`, `zh-TW`, `ja`, `ru`).

How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "fix: Update on i18n for Claude Effort xH..." | Re-trigger Greptile

Copilot AI review requested due to automatic review settings April 16, 2026 15:48
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

将 Anthropic 自适应思考(adaptive thinking)的努力级别枚举扩展为包含新值 "xhigh",并在类型定义、验证 schema、补丁合约、UI 编辑器和多语言文案中同步添加/更新该选项。

Changes

Cohort / File(s) Summary
类型与 schema
src/types/provider.ts, src/lib/validation/schemas.ts
AnthropicAdaptiveThinkingEffort 类型与 anthropic_adaptive_thinking schema 的 effort 枚举从 ["low","medium","high","max"] 扩展为包含 "xhigh",更新允许的值。
补丁/验证合约
src/lib/provider-patch-contract.ts
isAdaptiveThinkingConfig 验证器接受新的 effort: "xhigh" 值,保持与 schema 一致。
UI 编辑器组件
src/app/[locale]/settings/providers/_components/adaptive-thinking-editor.tsx
AdaptiveThinkingEditorSelectContent 选项数组中加入 "xhigh",使此选项可在前端选择并通过 onValueChange 传播。
多语言文案(i18n)
messages/en/settings/providers/form/sections.json, messages/ja/.../sections.json, messages/ru/.../sections.json, messages/zh-CN/.../sections.json, messages/zh-TW/.../sections.json
将各语言的 adaptiveThinking.effort.optionshigh 标签去掉“(推荐)”字样,并新增 xhigh 对应的本地化标签(如 “Xhigh (Recommended)”、超高(推薦) 等)。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive PR描述提及相关问题#758(原始自适应思考覆盖支持),但未明确链接待解决的问题或关联的问题。 建议在PR中明确链接相关的GitHub问题,以便追踪和关联相关工作。
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰准确地总结了主要变更:为Claude的自适应思考配置添加"xhigh"选项,这正是此PR的核心目标。
Out of Scope Changes check ✅ Passed 所有变更都直接相关于添加"xhigh"effort选项,包括类型、验证、UI和i18n更新,范围明确且集中。
Description check ✅ Passed 拉取请求描述清楚地说明了问题、解决方案和具体的代码更改。描述与变更集直接相关,涵盖了为自适应思维配置添加'xhigh'努力级别的目标。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added size/XS Extra Small PR (< 50 lines) bug Something isn't working area:UI area:provider labels Apr 16, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

  1. Missing i18n key adaptiveThinking.effort.options.xhigh in all 5 localessrc/app/[locale]/settings/providers/_components/adaptive-thinking-editor.tsx:88 renders the option label via t('sections.routing.anthropicOverrides.adaptiveThinking.effort.options.${level}'), but none of messages/{en,zh-CN,zh-TW,ja,ru}/settings/providers/form/sections.json define an xhigh entry under adaptiveThinking.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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AnthropicAdaptiveThinkingEffort to 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.xhigh is 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 new xhigh entry under adaptiveThinking.effort.options for 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.

Comment on lines 61 to 66
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),
})

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@ding113
ding113 merged commit 232631b into ding113:dev Apr 17, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Claude Code Hub Roadmap Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:provider area:UI bug Something isn't working size/XS Extra Small PR (< 50 lines)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants