fix(claude): restore live thinking stream by ungating claude-code thinking-chunk - #1289
Conversation
…nking-chunk Claude Code's inline thinking display stopped streaming on ordinary turns. StdoutHandler gates `thinking-chunk` emission behind `requiresReasoningTag`, and `claude-code` had been swept into that set alongside Grok/Codex/OpenCode by two earlier Grok fixes (c9ee7d6, 1a7951d). But the Claude parser only tags extended-thinking blocks with `isReasoning: true`; ordinary assistant text partials come through with `isReasoning === undefined`. With claude-code in the gate, every non-extended-thinking turn (the default) emitted zero thinking-chunk events, so the live thinking display never populated. The gate exists to stop Grok/Codex/OpenCode's final answer (streamed as `text` with no `isReasoning` and no tool events) from leaking into the thinking panel and looking "done" while tools still run. That does not apply to Claude: its answer partials are the intended live preview, and the renderer replaces them with the final `result` (useBatchedSessionUpdates drops non-sticky thinking/tool logs when assistant stdout arrives; cleanupExitedTabLogs on exit). Fix: drop `claude-code` from `requiresReasoningTag` so it forwards all partials (like Factory Droid). Grok/Codex/OpenCode stay gated. Extended thinking still routes correctly and stays out of streamedText. Adds a regression suite driving the real ClaudeOutputParser through StdoutHandler: an ordinary text partial now emits thinking-chunk and accumulates into streamedText; a thinking block emits thinking-chunk and stays out of streamedText.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughClaude partial text routing now emits ChangesClaude thinking-chunk routing
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryRestores Claude Code live answer previews by forwarding untagged assistant partials through thinking-chunk.
Confidence Score: 3/5The PR should not merge until Claude answer previews are separated from retained and reasoning-specific thinking consumers. Ordinary Claude answer text now reaches both final stdout and thinking-specific consumers, producing duplicate completed output in sticky mode and misclassifying answers in the Auto Run Thought Stream. src/main/process-manager/handlers/StdoutHandler.ts Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Claude assistant partial] --> B[ClaudeOutputParser]
B -->|isReasoning true| C[thinking-chunk]
B -->|isReasoning undefined| D[StdoutHandler]
D --> C
D --> E[streamedText]
C --> F[Inline thinking log]
C --> G[Auto Run Thought Stream]
E --> H[Final stdout]
F -->|non-sticky cleanup| H
F -->|sticky retains preview| I[Duplicate answer]
Reviews (1): Last reviewed commit: "fix(claude): restore live thinking strea..." | Re-trigger Greptile |
|
@chr1syy Thanks for the contribution, and especially for the write-up. The root-cause trace here is excellent: this is exactly the kind of report that makes a review fast. I verified the history and agree with the fix:
On Greptile's confidence-3 flag (sticky-mode duplication and Auto Run Thought Stream classification): I looked at both and they are pre-existing semantics rather than something this PR introduces.
CI note: No merge conflicts, scope is tight, and the comment block you left explains the "why" for the next person who touches this list. Approving. |
…user logs Resolves the CI transform failure and PR RunMaestro#1273 review threads. - StdoutHandler.test.ts: drop the duplicate ClaudeOutputParser import (merge artifact that made the whole suite fail oxc transform), and align the double-count guard assertions with RunMaestro#1289: claude-code prose partials drive the live thinking preview (fire thinking-chunk) while the flagged textAlreadyStreamed assistant event is still skipped, so prose is counted exactly once. The guard being tested is unchanged. - LogItem.tsx: scope the TTSR interrupt-details disclosure to user-source entries, mirroring the footer badge. The ttsr marker is only ever set on the user injection log, so a non-user entry carrying it now falls through to normal rendering instead of a bare disclosure. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Problem
Claude Code's inline thinking display stopped streaming on ordinary turns. The live reasoning/answer preview never populated during a turn; users just saw the busy state and then the final answer appearing at the end.
Root cause
StdoutHandlergatesthinking-chunkemission behindrequiresReasoningTag, andclaude-codehad been swept into that set alongside Grok/Codex/OpenCode by two earlier Grok fixes (c9ee7d686,1a7951d1f).But the Claude parser only tags extended-thinking blocks with
isReasoning: true; ordinary assistant text partials come through withisReasoning === undefined(confirmed by driving the realClaudeOutputParser). Withclaude-codein the gate, every non-extended-thinking turn (the default) emitted zerothinking-chunkevents, so the live thinking display never populated.The gate exists to stop Grok/Codex/OpenCode's final answer (streamed as
textwith noisReasoningand no tool events) from leaking into the thinking panel and looking "done" while tools still run. That concern does not apply to Claude: its answer partials are the intended live preview, and the renderer replaces them with the finalresult(useBatchedSessionUpdatesdrops non-sticky thinking/tool logs when assistant stdout arrives;cleanupExitedTabLogson exit).Fix
Drop
claude-codefromrequiresReasoningTagso it forwards all partials (like Factory Droid). Grok/Codex/OpenCode stay gated. Extended thinking still routes correctly (isReasoning: true) and stays out ofstreamedText.Tests
Adds a
Claude thinking-chunk routingregression suite driving the realClaudeOutputParserthroughStdoutHandler:thinking-chunkand accumulates intostreamedText;thinking-chunkand stays out ofstreamedText.Existing Grok/Copilot routing tests remain green (gate preserved for those providers).
Verification
StdoutHandler.test.ts: 76 passednpm run lint(tsconfig.lint / main / cli): exit 0Summary by CodeRabbit
Bug Fixes
Tests