Skip to content

fix: show Anthropic Opus 4.7+ thinking#26026

Draft
ibetitsmike wants to merge 1 commit into
mainfrom
fix/anthropic-thinking-display-opus-48
Draft

fix: show Anthropic Opus 4.7+ thinking#26026
ibetitsmike wants to merge 1 commit into
mainfrom
fix/anthropic-thinking-display-opus-48

Conversation

@ibetitsmike
Copy link
Copy Markdown
Collaborator

@ibetitsmike ibetitsmike commented Jun 3, 2026

Summary

  • Updates Coder's pinned github.com/coder/fantasy fork to include fix(providers/anthropic): send thinking display fantasy#39.
  • Relies on fantasy's native Anthropic thinking_display support instead of Coder-side transport patching.
  • Removes the prior API, SDK, generated UI, known-model, and transport workaround changes from this PR.

Tests

  • go mod tidy
  • go test ./codersdk ./coderd/x/chatd/chatprovider ./coderd/x/chatd/chatloop
  • go test ./coderd -run '^TestValidateChatModel|^TestChat'
  • go test ./coderd/x/chatd/... ./codersdk
  • pre-commit hook, including fmt, lint, and slim build

Mux working on behalf of Mike.

@ibetitsmike ibetitsmike changed the title fix: show Anthropic Opus 4.8 thinking fix: show Anthropic Opus 4.7+ thinking Jun 3, 2026
@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@coder-agents-review
Copy link
Copy Markdown
Contributor

coder-agents-review Bot commented Jun 3, 2026

Chat: Review in progress | View chat
Requested: 2026-06-03 23:01 UTC by @ibetitsmike
Spend: $67.59 / $100.00

deep-review v0.6.1 | Round 4 | b9c3eea..2407b2e

Last posted: Round 4, 14 findings (8 P3, 1 P4, 5 Nit), APPROVE. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Author fixed (b76f980) chatprovider.go:1170 Bedrock Opus 4.7/4.8 has same omitted-display bug; transport patch only on direct Anthropic path R1 Pariston P3, Meruem Note Yes
CRF-2 P3 Author fixed (b76f980) chatprovider_test.go:1595 MergeMissing test missing Display preservation case when already set R1 Bisky Yes
CRF-3 P3 Author fixed (b76f980) anthropic_thinking_display.go:45 Invalid display enum values silently accepted and dropped with no signal R1 Chopper Yes
CRF-4 P3 Author fixed (b76f980) ModelConfigFields.tsx:509 colSpan returns 1 3 in a 2-column grid; 3 no longer corresponds to column count R1 Gon P3, Mafuuu Nit, Nami Nit
CRF-5 P3 Author fixed (b76f980) anthropic.ts:12 Catalog header comment omits thinkingDisplay and restates what model entries show R1 Leorio P3, Gon P2 Yes
CRF-6 P3 Author fixed (b76f980) ModelConfigFields.tsx:504 colSpan JSDoc restates function body; new text less precise than old R1 Gon P2, Leorio Nit Yes
CRF-7 P3 Author fixed (b76f980) types.ts:15 thinkingDisplay field missing JSDoc; sibling thinkingBudgetTokens has full JSDoc block R1 Leorio Yes
CRF-8 Nit Author fixed (b76f980) chats.go:1225 Display field missing label tag; BudgetTokens has label in same struct R1 Hisoka Nit, Ryosuke Nit, Knov Nit Yes
CRF-9 P3 Author fixed (b76f980) anthropic_thinking_display.go:179 Hardcoded model list in Go+TS needs coordinated updates for future Opus models R1 Meruem P3, Hisoka P4, Mafuuu Note, Robin Note, Knov Note, Ryosuke Note Yes
CRF-10 P4 Author contested; panel closed R2 (7/7 accept) anthropic_thinking_display.go:60 Transport body-patching boilerplate duplicates openai_compat_patches.go R1 Robin Yes
CRF-11 Nit Author fixed (b76f980) anthropic_thinking_display.go:45 anthropicThinkingDisplayFromChat name describes neither input nor operation R1 Gon Yes
CRF-12 Nit Author fixed (b76f980) anthropic_thinking_display.go:177 isAnthropicThinkingDisplayOmittedByDefaultModel parses ambiguously R1 Gon Yes
CRF-13 Nit Author fixed (b76f980) anthropic_thinking_display.go:123 Eight return body exits mix no-op and error-path returns without distinguishing comment R1 Chopper Yes
CRF-14 Note Dropped by orchestrator (commit already pushed) N/A Commit subject "improve" is vague R1 Leorio No
CRF-15 P3 Author fixed (15f39e9) exp_chats.go:7442 Display enum values defined in 3 independent locations with no compile-time coupling R2 Knov Yes
CRF-16 Nit Author fixed (2407b2e) chatprovider.go:1214 Dead nil check on Bedrock branch after function that never returns nil R2 Mafuuu Yes

Contested and acknowledged

CRF-10 (P4, anthropic_thinking_display.go:60) - Transport body-patching boilerplate duplication

  • Finding: The transport body-patching scaffold (read body, close, clone request, NopCloser, ContentLength, GetBody) in anthropicThinkingDisplayTransport.RoundTrip is structurally identical to openAICompatRequestPatchTransport.RoundTrip. A shared helper could extract the common scaffold.
  • Author defense: Kept out of this PR. Only two call sites exist, and extracting a shared helper would widen the diff beyond the Anthropic thinking-display fix.
  • Panel closure (R2, 7/7): All seven reviewers (Hisoka, Mafuuu, Pariston, Meruem, Chopper, Melody, Knov) accepted the defense. The two transports have divergent patch signatures (patchOpenAICompatChatCompletionsBody(body, baseURL, modelID) vs patchAnthropicThinkingDisplayBody(body, setting, modelHint)). A shared helper would need to abstract over both callback shapes, path predicates, and context logic. At two call sites, extraction cost exceeds duplication cost.

Round log

Round 1

Panel (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 2

Churn 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 3

BLOCKED. CRF-15 addressed. CRF-16 (Nit) silent. No review.

Round 4

Churn 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-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

Copy link
Copy Markdown
Contributor

@coder-agents-review coder-agents-review Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread coderd/x/chatd/chatprovider/chatprovider.go Outdated
Comment thread coderd/x/chatd/chatprovider/chatprovider_test.go Outdated
Comment thread coderd/x/chatd/chatprovider/anthropic_thinking_display.go Outdated
Comment thread coderd/x/chatd/chatprovider/anthropic_thinking_display.go Outdated
Comment thread coderd/x/chatd/chatprovider/anthropic_thinking_display.go Outdated
Comment thread coderd/x/chatd/chatprovider/anthropic_thinking_display.go Outdated
Comment thread coderd/x/chatd/chatprovider/anthropic_thinking_display.go Outdated
Comment thread coderd/x/chatd/chatprovider/anthropic_thinking_display.go Outdated
@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

Copy link
Copy Markdown
Contributor

@coder-agents-review coder-agents-review Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread coderd/exp_chats.go Outdated
@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

Copy link
Copy Markdown
Contributor

@coder-agents-review coder-agents-review Bot left a comment

Choose a reason for hiding this comment

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

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.

@ibetitsmike
Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

Copy link
Copy Markdown
Contributor

@coder-agents-review coder-agents-review Bot left a comment

Choose a reason for hiding this comment

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

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.

@ibetitsmike ibetitsmike force-pushed the fix/anthropic-thinking-display-opus-48 branch from 2407b2e to 2ae471c Compare June 4, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant