Add Claude xhigh effort support for Opus 4.7#21
Conversation
- Allow xhigh for Claude Opus 4.7 in contracts, UI, and persistence - Forward xhigh through the server adapter and add coverage
📝 WalkthroughWalkthroughThe changes add support for the "xhigh" reasoning effort level for Claude Opus 4.7 models. This new effort option is added to contract definitions, server adapter layers, and web components, enabling it to be selected and passed through the system to the Claude API. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/server/src/provider/Layers/ClaudeAdapter.ts (1)
934-939: Extract the SDK compatibility bridge into a named helper function.Line 938 casts
ClaudeQueryOptionsWithXHightoClaudeQueryOptionsto work around the SDK's lack of support foreffort: "xhigh". The@anthropic-ai/claude-agent-sdk(^0.2.77) does not officially includexhighin its effort options, making this cast necessary but opaque. Extract it into a dedicated helper to explicitly document the boundary:♻️ Suggested boundary helper
+function toSdkClaudeQueryOptions(options: ClaudeQueryOptionsWithXHigh): ClaudeQueryOptions { + // SDK (^0.2.77) does not officially support "xhigh" effort mode. + return options as unknown as ClaudeQueryOptions; +} ... - query({ - prompt: input.prompt, - options: input.options as ClaudeQueryOptions, - }) as ClaudeQueryRuntime); + query({ + prompt: input.prompt, + options: toSdkClaudeQueryOptions(input.options), + }) as ClaudeQueryRuntime);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server/src/provider/Layers/ClaudeAdapter.ts` around lines 934 - 939, The cast from ClaudeQueryOptionsWithXHigh to ClaudeQueryOptions inside the query(...) call is an opaque SDK compatibility hack; extract that logic into a named helper (e.g., normalizeClaudeOptionsForSdk or bridgeClaudeOptions) that accepts ClaudeQueryOptionsWithXHigh and returns a ClaudeQueryOptions by mapping/validating effort:"xhigh" to the nearest supported SDK value, then replace the inline cast in the call to query({ prompt: input.prompt, options: /* use helper result */ }) as ClaudeQueryRuntime; update any related types or comments in ClaudeAdapter.ts to document the SDK boundary.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/server/src/provider/Layers/ClaudeAdapter.ts`:
- Around line 934-939: The cast from ClaudeQueryOptionsWithXHigh to
ClaudeQueryOptions inside the query(...) call is an opaque SDK compatibility
hack; extract that logic into a named helper (e.g., normalizeClaudeOptionsForSdk
or bridgeClaudeOptions) that accepts ClaudeQueryOptionsWithXHigh and returns a
ClaudeQueryOptions by mapping/validating effort:"xhigh" to the nearest supported
SDK value, then replace the inline cast in the call to query({ prompt:
input.prompt, options: /* use helper result */ }) as ClaudeQueryRuntime; update
any related types or comments in ClaudeAdapter.ts to document the SDK boundary.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a86c58f9-e9bd-414e-a04d-fe7bf317d1c5
📒 Files selected for processing (8)
apps/server/src/git/Layers/ClaudeTextGeneration.test.tsapps/server/src/provider/Layers/ClaudeAdapter.test.tsapps/server/src/provider/Layers/ClaudeAdapter.tsapps/server/src/provider/Layers/ClaudeProvider.tsapps/web/src/components/chat/TraitsPicker.browser.tsxapps/web/src/composerDraftStore.tspackages/contracts/src/model.tspackages/contracts/src/provider.test.ts
Summary
xhighas a supported Claude effort level across shared contracts, UI state, and provider model definitions.xhighthrough to the Claude CLI query options for Opus 4.7.Testing
bun fmt.bun lint.bun typecheck.bun run test.Summary by CodeRabbit
New Features
Tests