fix: stop sending adaptive thinking to pre-4.6 Anthropic models - #27314
Conversation
2cfe034 to
918973c
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 918973c06f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
918973c to
ce9feca
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
ce9feca to
5d75eaa
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
5d75eaa to
4d592f5
Compare
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…pic models A model config with reasoning_effort on a legacy Anthropic model such as claude-haiku-4-5 failed every generation with HTTP 400 "adaptive thinking is not supported on this model", because the fantasy Anthropic provider always serialized effort as adaptive thinking plus output_config.effort. Bump the coder/fantasy pin to coder/fantasy#47, which converts effort into enabled budget thinking (budget derived from max_tokens) on models older than Claude 4.6 and keeps the adaptive shape for newer ones. Effort values outside the API enum are normalized, and none now disables thinking entirely. Update the compaction override test to cover both the legacy and the adaptive-capable request shapes, and add a regression test asserting a claude-haiku-4-5 config with reasoning_effort produces enabled thinking with the derived budget and no output_config.
|
@codex review |
4d592f5 to
b321451
Compare
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…legacy-effort # Conflicts: # coderd/x/chatd/chatd_test.go
coder/fantasy#47 merged; replace the PR-head pseudo-version with the squash commit a63de4b40315 on coder_2_33 (identical tree).
Problem
A chat model config with
reasoning_effortset on a pre-4.6 Anthropic model (for exampleclaude-haiku-4-5) fails every generation with HTTP 400adaptive thinking is not supported on this model, surfaced in chat as "Anthropic returned an unexpected error." The fantasy Anthropic provider always serialized effort asthinking: {type: "adaptive"}plusoutput_config.effort, a shape only Claude 4.6+ accepts.Changes
{type: "enabled", budget_tokens}on models older than Claude 4.6, with the budget derived from the call'smax_tokens(aibridge-mirroring ratios, 1024-token API floor; below the floor thinking is omitted, which keeps small-budget calls like title generation working). Adaptive-capable models keep the current shape, and Opus 4.5 keepsoutput_config.effortalongside the derived budget since it supports effort without adaptive thinking. Models older than Claude 3.7 predate extended thinking, so effort sends no thinking at all there.minimalis normalized tolow,xhighfalls back tomaxon adaptive models that predate the xhigh tier (Claude 4.7+); effortnonedisables thinking, including an explicitthinking: {type: "disabled"}on Claude 5+ models that otherwise run adaptive thinking by default. The Bedrock provider wraps the Anthropic one, so both are covered, and Vertex-style@datemodel IDs parse correctly.TestActiveServer_CompactionModelOverridepreviously codified the buggy shape (assertingoutput_config.effortsent toclaude-3-5-haiku-latest). The summary-routing subtest is now a three-case table: pre-thinking override models (Claude 3.5) expect no thinking, legacy budget-thinking ones (Haiku 4.5) expect enabled thinking with the derived budget, adaptive-capable ones still expectoutput_config.effort.TestActiveServer_AnthropicModelReasoningEffort: aclaude-haiku-4-5config withreasoning_effortproduces enabled thinking with the derived budget and nooutput_configon the wire, and aclaude-sonnet-5config with effortnonesends an explicit thinking disable.chattest.AnthropicRequestgains aThinkingfield so tests can assert the thinking config.No chatd production code changes:
ApplyReasoningEffortkeeps settingEffort, which is now valid for every Anthropic model.Validation
go test ./coderd/x/chatd/...passes (19 packages).noneincl. Claude 5+ disable, Opus 4.5 effort preservation, sampling-param stripping), golangci-lint clean.Closes CODAGT-812.