Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Claude thinking before a tool call stays a collapsed Thought #18887

Mergedmaria-rcksmerged 1 commit intomain fromrefs/pull/18887/headmerged by maria-rcks View on GitHub

maria-rckscommented

Problem

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.

Before: Claude Opus 5.5 reasoning rendered as chat text above the tool calls

After: the same reasoning shows as collapsed Thought rows beside the tool calls

Recordings of the same Opus 5.5 turn streaming, before and after:

https://uploads-production-47e4.up.railway.app/files/765d93ec-5cad-4ee7-a715-5445f629819b/claude-opus-reasoning-before.mp4

https://uploads-production-47e4.up.railway.app/files/385935e4-77e4-4d9a-9350-1e7f4dff4121/claude-opus-reasoning-after.mp4

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

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at d1e02cc

      Macroscope'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.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. juliusmarminge added labelsmacroscope-review

    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      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.ts
      • apps/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.ts
      The adapter removes model-version detection and lastThinking state. 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

      Merge Risk: ⚪ Minimal · up to d1e02

      Thinking before tool calls remains a Thought rather than assistant text. No actionable merge risk remains.

      ### Architecture Summary

      Architecture risk: 🔵 Low · up to d1e02

      The change affects 1 system.

      Changed systems: apps/server

      Architecture 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 reasoning item 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 lastThinking from 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 · Passed 4
      Passed Passed checks (4 passed)
      Check nameStatusExplanation
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Title checkPassedThe title is concise, specific, and accurately describes the primary change: Claude thinking before tool calls remains a collapsed Thought.
      Description checkPassedThe 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
      Comment `@coderabbitai help` to get the list of available commands.
    5. maria-rcks merged this06620fa

    6. maria-rcks closed this

    7. maria-rcks changed the title

    8. maria-rcks changed the title

Sign in to join this conversation.