fix: show Anthropic Opus 4.7+ thinking#26026
Conversation
|
/coder-agents-review |
|
Chat: Review in progress | View chat deep-review v0.6.1 | Round 4 | Last posted: Round 4, 14 findings (8 P3, 1 P4, 5 Nit), APPROVE. Review Finding inventoryFindings
Contested and acknowledgedCRF-10 (P4, anthropic_thinking_display.go:60) - Transport body-patching boilerplate duplication
Round logRound 1Panel (18 reviewers: Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Ging-Go, Ging-TS, Gon, Leorio, Meruem, Chopper, Melody, Ryosuke, Nami, Robin, Kite, Knov, Takumi). Netero: 0 findings. 9 P3, 1 P4, 3 Nit, 1 Note (dropped). 13 posted. Reviewed against b9c3eea..06d97e2. Round 2Churn guard: PROCEED. 12 addressed, 1 contested (CRF-10). Netero: 0 findings. Panel (8 reviewers: Bisky, Hisoka, Mafuuu, Pariston, Meruem, Chopper, Melody, Knov). CRF-10 closed by panel (7/7 accept). 1 P3, 1 Nit new. Reviewed against b9c3eea..b76f980. Round 3BLOCKED. CRF-15 addressed. CRF-16 (Nit) silent. No review. Round 4Churn guard: PROCEED. CRF-16 addressed. All findings resolved. Netero: 0 findings. Panel (4 reviewers: Mafuuu, Bisky, Hisoka, Pariston): 0 findings. Reviewed against b9c3eea..2407b2e. About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
Well-designed transport-level fix. The two-layer defense (admin config + model-name fallback) is clean, context propagation through the chat loop is sound, and test coverage is thorough across both languages.
Severity breakdown: 9 P3, 1 P4, 3 Nit, 1 Note.
The P3s are a Bedrock provider gap, a missing test preservation case, a silent enum validation gap, several comment/doc quality items, and the dual-source model list coupling. Nothing blocks the fix, but the Bedrock gap (CRF-1) deserves a decision: fix in this PR, file a ticket, or document the limitation.
"Request-capture channels, table-driven boundaries, internal+integration layering. Real stone." (Bisky)
site/src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/anthropic.ts:12-19
P3 [CRF-5] This comment explains per-model field divergences to help developers add new models, but it does not mention thinkingDisplay. A developer adding claude-opus-4-9 will check this comment, find no mention of thinkingDisplay, and have to reverse-engineer why two entries carry it and four don't.
Two reviewers flag this block from opposite directions: Gon notes it restates what the model entries show; Leorio notes it omits the new field. Suggested rewrite:
// Adaptive-thinking models use `reasoningEffort`; legacy models use
// `thinkingBudgetTokens`. Using `effort` on a legacy model produces
// an Anthropic HTTP 400. Opus 4.7+ defaults `thinking.display` to
// omitted, so those entries carry `thinkingDisplay: "summarized"`.(Leorio P3, Gon P2)
🤖
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
All 12 R1 findings addressed cleanly. The Bedrock extension, API validation, version parsing, and naming/doc fixes are well-executed. Test density improved to 60%.
CRF-10 (transport boilerplate duplication, P4) closed by unanimous panel vote (7/7). The two transports have divergent patch signatures; extraction cost exceeds duplication cost at two call sites.
Two new findings this round: 1 P3 (enum coupling), 1 Nit (dead code).
"I tried to build a case against this change and could not." (Pariston)
coderd/x/chatd/chatprovider/chatprovider.go:1214
Nit [CRF-16] withAnthropicThinkingDisplayPatches(httpClient) always returns a non-nil *http.Client (creates &http.Client{} when input is nil). The Anthropic branch (line 1181) correctly removed the equivalent if httpClient != nil guard, but this Bedrock branch still wraps the append in a nil check. Dead code.
Fix: remove the if wrapper and always append fantasybedrock.WithHTTPClient(httpClient), matching the Anthropic branch. (Mafuuu)
🤖
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
CRF-15 (P3, enum coupling) addressed in 15f39e9: exported shared constants from chatprovider and referenced them in the validation switch. Two of three locations are now compile-time coupled; the SDK struct tag remains a string literal (Go language constraint). Fix looks correct.
CRF-16 (Nit, dead nil check on Bedrock branch at chatprovider.go:1214) has no author response and no code change. withAnthropicThinkingDisplayPatches always returns non-nil, so the if httpClient != nil guard is dead code. The Anthropic branch already removed the equivalent check.
Further panel review is blocked until CRF-16 is addressed: fix the dead code, or respond explaining why it should stay.
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
All 16 findings resolved across 4 rounds (14 fixed, 1 closed by panel vote, 1 dropped).
The fix is well-scoped: transport-level patching at the Anthropic/Bedrock provider boundary, admin-configurable thinking display, version-aware auto-default for Opus 4.7+, API-boundary validation with shared constants, and thorough test coverage (60% test density, 479 lines of test code).
No open findings remain.
🤖 This review was automatically generated with Coder Agents.
Anthropic Claude Opus 4.7 and newer default
thinking.displayto omitted, so Coder could receive only thinking signatures and persist empty reasoning text.Expose Anthropic
thinking.displayin chat model config, default the known Opus 4.7 and 4.8 models tosummarized, and patch Anthropic Messages requests at the provider transport boundary so omitted-default Opus models return visible thinking content. Opus 4.6 and Sonnet 4.6 remain unchanged because Anthropic defaults them to summarized.The patch also covers Anthropic-on-Bedrock request paths, validates configured Anthropic
thinking.displayvalues, and improves the model options layout so the Anthropic controls fit without cramped wrapping or clipping.Validation notes
Root cause was verified with AI Gateway dumps showing
claude-opus-4-8requests using adaptive thinking withoutthinking.display, followed by responses containing thinking signatures but nothinking_deltatext.After the initial change, a local
develop.shvalidation chat against Claude Opus 4.8 produced a request containing"thinking":{"display":"summarized","type":"adaptive"}, a streaming response withthinking_delta, and a persisted non-empty reasoning message part.Additional validation:
make genmake lintgo test ./coderd/x/chatd/chatprovider ./codersdkgo test ./coderd/x/chatd/chatprovider -run 'TestModelFromConfig_(AnthropicThinkingDisplayPatch|BedrockThinkingDisplayPatch)|TestMergeMissingProviderOptions_AnthropicThinking'go test ./coderd -run TestValidateChatModelProviderOptions_AnthropicThinkingDisplaygo test ./codersdkpnpm --dir site exec -- vitest run --project=unit src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/anthropic.test.ts src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/applyKnownModelDefaults.test.ts --reporter=dotpnpm --dir site exec -- vitest run --project=unit src/pages/AgentsPage/components/ChatModelAdminPanel/modelConfigFormLogic.test.ts --reporter=dotpnpm --dir site exec -- vitest run --project=unit src/pages/AgentsPage/components/ChatModelAdminPanel/modelConfigFormLogic.test.ts src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/anthropic.test.ts --reporter=dotpnpm --dir site exec -- biome lint --error-on-warnings src/pages/AgentsPage/components/ChatModelAdminPanel/ModelConfigFields.tsx src/api/chatModelOptionsGenerated.jsonpnpm --dir site exec -- biome lint --error-on-warnings src/pages/AgentsPage/components/ChatModelAdminPanel/ModelConfigFields.tsx src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/anthropic.ts src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/types.ts src/api/chatModelOptionsGenerated.jsonpnpm --dir site exec -- biome lint --error-on-warnings src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/anthropic.ts src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/anthropic.test.ts src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/applyKnownModelDefaults.ts src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/applyKnownModelDefaults.test.ts src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/types.ts