Skip to content

fix(anthropic): honor adaptive thinking config for newer Claude models#12909

Open
syf2211 wants to merge 3 commits into
continuedev:mainfrom
syf2211:fix/12908-anthropic-adaptive-thinking-config
Open

fix(anthropic): honor adaptive thinking config for newer Claude models#12909
syf2211 wants to merge 3 commits into
continuedev:mainfrom
syf2211:fix/12908-anthropic-adaptive-thinking-config

Conversation

@syf2211

@syf2211 syf2211 commented Jun 27, 2026

Copy link
Copy Markdown

Summary

Parse and forward Anthropic thinking / output_config completion options from config.yaml instead of always mapping the legacy reasoning toggle to thinking.type: enabled.

Motivation

Claude Opus 4.x models reject thinking.type.enabled and require thinking.type.adaptive with output_config.effort. Users who configured adaptive thinking in YAML still got API errors because Continue stripped unknown completion-option fields and the chat UI forced reasoning: true.

Fixes #12908

Changes

File Change
packages/config-yaml/src/schemas/models.ts Add thinking and output_config to completion options schema
core/index.d.ts Extend BaseCompletionOptions types
core/llm/llms/Anthropic.ts Prefer explicit thinking config over legacy reasoning boolean
gui/src/redux/thunks/streamNormalInput.ts Skip legacy reasoning toggle when model config already sets thinking.type
core/llm/llms/Anthropic.vitest.ts Regression tests for adaptive thinking request bodies

Tests

  • Added Anthropic.vitest.ts cases for adaptive thinking + output_config, and for config precedence over legacy reasoning: true
  • Full vitest suite could not be executed locally due to monorepo workspace package resolution in this environment; CI should run project tests

Notes

  • Legacy reasoning: true behavior is unchanged when no thinking block is configured
  • output_config.effort enum currently covers low/medium/high; API may add more values later
  • Bedrock provider may need a similar follow-up for Opus 4.x on Bedrock

Summary by cubic

Honor Anthropic thinking and output_config from YAML and per-request options, preferring them over the legacy reasoning flag. Fixes Claude Opus 4.x errors by supporting thinking.type: adaptive with output_config.effort, and forwards output_config even when set without thinking (fixes #12908).

  • Bug Fixes
    • Parse thinking and output_config in packages/config-yaml; add types in core/index.d.ts.
    • Build Anthropic requests with explicit thinking (budget_tokens for enabled) and always include output_config; fall back to legacy reasoning only if thinking isn’t set.
    • In gui, skip adding the legacy reasoning toggle when thinking.type is configured.
    • Add tests for adaptive thinking/output_config, output_config-only, output_config on the legacy reasoning path, and config precedence over legacy reasoning; include required model in completionOptions.

Written for commit 69f7f0f. Summary will update on new commits.

Review in cubic

@syf2211 syf2211 requested a review from a team as a code owner June 27, 2026 06:13
@syf2211 syf2211 requested review from sestinj and removed request for a team June 27, 2026 06:13
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 27, 2026
@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread core/llm/llms/Anthropic.ts Outdated
@syf2211

syf2211 commented Jun 27, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@syf2211

syf2211 commented Jun 27, 2026

Copy link
Copy Markdown
Author

recheck

- Parse thinking and output_config in completion options schema
- Forward adaptive thinking/output_config to Anthropic API requests
- Skip legacy reasoning toggle when model config specifies thinking
- Add regression tests for adaptive thinking request bodies
- test: add required model field to completionOptions in vitest

Fixes continuedev#12908
@syf2211 syf2211 force-pushed the fix/12908-anthropic-adaptive-thinking-config branch from 5b16ed6 to 8f4d77d Compare June 27, 2026 06:59
@syf2211

syf2211 commented Jun 27, 2026

Copy link
Copy Markdown
Author

recheck

@itxaiohanglover

Copy link
Copy Markdown

Solid implementation! The buildThinkingParams method cleanly handles the three thinking modes (enabled/adaptive/disabled) with proper budget_tokens fallback. Adding thinking and output_config to the type definitions is important for API compatibility.

syf2211 added 2 commits June 27, 2026 15:33
Address cubic P2 review: output_config was only included when
thinking.type was set, so configs with output_config alone (or on
the legacy reasoning path) were dropped from API requests.

Add regression test for output_config-only completion options.
@syf2211

syf2211 commented Jun 27, 2026

Copy link
Copy Markdown
Author

Addressed cubic P2 review in 9d1784e: output_config is now forwarded independently of thinking.type, including when only output_config is configured or on the legacy reasoning: true path. Added regression tests for both cases. Composer-2.5 review: APPROVE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

continue seems to be ignoring my thinking type in the config

2 participants