fix(server): Claude thinking before a tool call stays a collapsed Thought #18887
main fromrefs/pull/18887/head·merged by maria-rcks View on GitHubProblem#
On Claude Opus 5.5, Fable 5.1, and other Claude 5.1+ models, reasoning often renders as plain chat text instead of a collapsed Thought. #18364 promotes the last non-empty thinking block before a tool_use to assistant text, assuming it is a progress update. T3 requests display: "summarized", and Anthropic's progress updates table says that under summarized a progress update is "not distinguishable from a reasoning block". The model can also skip the update, so the block right before a tool call is often real reasoning.
Change#
Revert the promotion. Every Claude thinking block stays a reasoning item and renders collapsed with the tool calls. The existing test now asserts that thinking right before a tool call stays reasoning for Opus 5.5, Fable 5.1, Opus 5, and Sonnet 4.6. This brings back #18355: a Claude 5.1+ progress update before a tool call shows as a Thought, not as chat text. Splitting the two needs display: "updates", which hides reasoning, so it is out of scope here.
Verification#
Same read-only prompt on Claude Opus 5.5 in a dev server, before and after. Before, the reasoning ("Since my working directory is apps/server…") was stored as assistant_message and rendered as chat text. After, both thoughts are reasoning items shown as collapsed Thought rows.


Recordings of the same Opus 5.5 turn streaming, before and after:
Other providers with the same prompt: Grok and Muse stored reasoning as reasoning. Codex used 0 reasoning tokens on this prompt, and recent real Codex turns store reasoning summaries correctly. OpenCode with Claude Fable 5.1 got an empty reasoning part from OpenCode itself, since it does not request summarized thinking. Pi hit an Anthropic 401 and Cursor was unavailable in the dev environment, so neither is verified. ClaudeAdapterV2.test.ts: 252 passed.
Implemented with Claude Opus 5.5 through the Claude Code harness (T3 Code).
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Approvability#
Verdict: Approved at
d1e02ccMacroscope's review found this PR approvable — This is a small, self-contained Claude adapter fix that keeps ambiguous thinking blocks collapsed as reasoning instead of emitting them as chat text. The behavior is covered by focused tests across the affected model variants, with no schema, deployment, security, or configuration changes.
Notes:
- Diff unchanged. Approvability was decided on eligibility alone.
juliusmarminge added labelsmacroscope-review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
78785d67-f263-4feb-827f-6120e3cf5b28
📥 Commits
-
Reviewing files that changed from the base of the PR and between e24ea1d28ef9159cc6cc98a1e9d9de5f52ed385c and d1e02cc6c2a54e8dbc2a2877c9105d6821159567.
📒 Files selected for processing (2)
-
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
📝 Walkthrough
-
ClaudeAdapterV2 no longer uses model-version detection or saved thinking snapshots to emit pre-tool assistant text. Tests now expect summarized thinking to remain a reasoning item across the listed models.
Changes: Claude thinking item classification
Layer / File(s) Summary Keep thinking snapshots as reasoning
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts,apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsThe adapter removes model-version detection and lastThinkingstate. The snapshot loop processes thinking blocks, and tests expect reasoning items for Opus 5.5, Fable 5.1, Opus 5, and Sonnet 4.6.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge
### Architecture SummaryMerge Risk: ⚪ Minimal · up to
d1e02-
Thinking before tool calls remains a Thought rather than assistant text. No actionable merge risk remains.
Architecture risk: 🔵 Low · up to
d1e02The change affects 1 system.
Changed systems:
apps/serverArchitecture concerns No architecture-level concerns identified.
Review details
-
Systems and components
- observed — apps/server (service) was modified; 2 changed files map to changed impact.
Before / after behavior
- observed — Modified behavior in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: The test now describes summarized thinking as reasoning and runs the same expectation for Opus 5.5, Fable 5.1, Opus 5, and Sonnet 4.6; it replaces the per-model expected-type cases.
- observed — Modified behavior in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: The assertion now expects the pre-tool reply text to be a
reasoningitem for all tested models, replacing the model-dependent expected type. - observed — Modified behavior in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts: Removed
claudeWritesUpdatesAsThinking, which parsed Claude model versions and returned true for versions 5.1 and later. - observed — Modified behavior in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts: Removed
lastThinkingfrom the reasoning state, which previously retained the latest non-empty thinking snapshot’s message ID, item ID, and text for possible reuse as assistant output.
Pre-merge checks ·
4-
Passed checks (4 passed)-
Check name Status Explanation Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Title check The title is concise, specific, and accurately describes the primary change: Claude thinking before tool calls remains a collapsed Thought. Description check The description clearly covers the problem, change, and verification, including test results and limitations. The Scope and approval section is not explicit, but the focused fix and related issue refe…
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
maria-rcks merged this06620fa
maria-rcks closed this
maria-rcks changed the title
maria-rcks changed the title
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed