Skip to content

Add Claude xhigh effort support for Opus 4.7#21

Merged
Ffinnis merged 1 commit intomainfrom
workspace-mo2jvivo
Apr 17, 2026
Merged

Add Claude xhigh effort support for Opus 4.7#21
Ffinnis merged 1 commit intomainfrom
workspace-mo2jvivo

Conversation

@Ffinnis
Copy link
Copy Markdown
Owner

@Ffinnis Ffinnis commented Apr 17, 2026

Summary

  • Adds xhigh as a supported Claude effort level across shared contracts, UI state, and provider model definitions.
  • Updates the Claude adapter to pass xhigh through to the Claude CLI query options for Opus 4.7.
  • Extends tests to cover decoding, persistence, adapter forwarding, and PR text generation behavior.

Testing

  • Not run bun fmt.
  • Not run bun lint.
  • Not run bun typecheck.
  • Not run bun run test.

Summary by CodeRabbit

  • New Features

    • Introduced a new "Extra High" reasoning effort level for Claude Opus 4.7, enabling users to select this option when configuring model behavior.
  • Tests

    • Added comprehensive test coverage for the new effort level option, verifying proper integration with Claude Opus 4.7 configuration.

- Allow xhigh for Claude Opus 4.7 in contracts, UI, and persistence
- Forward xhigh through the server adapter and add coverage
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Contract Type Definitions
packages/contracts/src/model.ts, packages/contracts/src/provider.test.ts
Added "xhigh" to the CLAUDE_CODE_EFFORT_OPTIONS constant between "high" and "max", updating derived ClaudeCodeEffort type. Added test case verifying decoding of claude-opus-4-7 with options.effort: "xhigh".
Server Provider Adapter
apps/server/src/provider/Layers/ClaudeAdapter.ts, apps/server/src/provider/Layers/ClaudeAdapter.test.ts
Introduced ClaudeSdkEffort and ClaudeQueryOptionsWithXHigh types to support "xhigh" at compile time. Updated createQuery input type and added test asserting "xhigh" effort is forwarded to SDK query options.
Server Model Configuration
apps/server/src/provider/Layers/ClaudeProvider.ts
Added { value: "xhigh", label: "Extra High" } reasoning effort level to claude-opus-4-7 model capabilities.
Server Integration Test
apps/server/src/git/Layers/ClaudeTextGeneration.test.ts
Added live integration test verifying TextGeneration.generatePrContent forwards effort: "xhigh" to Claude CLI invocation and validates generated content structure.
Web UI Components
apps/web/src/components/chat/TraitsPicker.browser.tsx, apps/web/src/composerDraftStore.ts
Updated fallbackModelOptions.effort type union to include "xhigh". Enhanced normalizeProviderModelOptions to recognize "xhigh" as a valid Claude effort value.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A whisper through the layers flows,

From UI clicks to API calls it goes,

"xhigh" effort now joins the quest,

Extra reasoning, putting Claude to the test! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete. While it provides a summary and mentions testing notes, it lacks the required 'What Changed', 'Why', and UI Changes sections from the template, and doesn't explain the problem being solved. Add 'What Changed' and 'Why' sections following the template structure, explaining the motivation and problem being solved by this feature addition.
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.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the primary change: adding 'xhigh' effort support for Claude's Opus 4.7 model.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch workspace-mo2jvivo

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

@github-actions github-actions Bot added size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Apr 17, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 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 ClaudeQueryOptionsWithXHigh to ClaudeQueryOptions to work around the SDK's lack of support for effort: "xhigh". The @anthropic-ai/claude-agent-sdk (^0.2.77) does not officially include xhigh in 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8b5d587 and c62244e.

📒 Files selected for processing (8)
  • apps/server/src/git/Layers/ClaudeTextGeneration.test.ts
  • apps/server/src/provider/Layers/ClaudeAdapter.test.ts
  • apps/server/src/provider/Layers/ClaudeAdapter.ts
  • apps/server/src/provider/Layers/ClaudeProvider.ts
  • apps/web/src/components/chat/TraitsPicker.browser.tsx
  • apps/web/src/composerDraftStore.ts
  • packages/contracts/src/model.ts
  • packages/contracts/src/provider.test.ts

@Ffinnis Ffinnis merged commit 538f8c7 into main Apr 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant