Skip to content

fix: restore live thinking streaming on 2.1.225/226; add answer streaming + verbose Read content - #9

Open
asgeirtj wants to merge 5 commits into
a-connoisseur:mainfrom
asgeirtj:fix/live-thinking-and-answer-streaming
Open

fix: restore live thinking streaming on 2.1.225/226; add answer streaming + verbose Read content#9
asgeirtj wants to merge 5 commits into
a-connoisseur:mainfrom
asgeirtj:fix/live-thinking-and-answer-streaming

Conversation

@asgeirtj

@asgeirtj asgeirtj commented Aug 9, 2026

Copy link
Copy Markdown

TL;DR

Live thinking streaming is broken in the current 2.1.225/2.1.226 releases — the thinking-streaming reducer/event sub-fix silently stopped applying, so thinking blocks only render when they land instead of streaming as deltas arrive. This PR fixes that, adds a new answer-streaming patch, hardens the thinking request, and restores full verbose Read output.

The regression (fafd40f)

2.1.225 changed the inner stream handler's options destructure by one character:

// before
function X(e,t,r){let{onSetStreamMode:n,...}=t;
// 2.1.225/226
function X(e,t,r){let{onSetStreamMode:n,...}=t,d=t.authoringProgressSurface===!0;

The comma tail made missingStreamingThinkingHandlerPattern skip the entire reducer branch, while every render-side sub-fix still hit — so thinking-streaming reported 5 patched and looked healthy. The playbook's own warning ("patch count still looks nonzero but live thinking is broken") was the exact failure mode. message_stop also gained a comma-if wrapper (if(dt?.finalize(),...,d)bnt?.resetAuthoringProgress();return) that needed a third needle.

Fix: the destructure matcher accepts either tail, the injection needle drops the trailing separator, and the new message_stop shape has its own needle. On 2.1.226 the module now reports 13 patched and the __cc_prevStreamingThinking markers land inside the stream handler itself. Verified at runtime (tmux + timestamped pane captures): thinking text on screen 11s into a 31s turn, growing continuously.

Debugging rule now in the playbook: verify the __cc_ markers inside the handler — module counts alone prove nothing.

New: answer-streaming (fa24cc7 + fd2d135)

Upstream ships a complete live answer-text pipeline (text_delta → throttled store → bottom-of-transcript preview), but gates all of it on sk = !prefersReducedMotion && !isWindowsTerminal(). With prefersReducedMotion: true, answers only appear after the message lands.

The patch enables just the two consumers answer streaming needs — the delta-apply callback and the preview-visible flag — leaving sk itself (and the deferMessages render-coalescing it controls) untouched. An earlier iteration flipped the whole sk definition; don't do that — it disables the deferred-messages path and degrades live transcript rendering under load. The Windows Terminal guard is preserved.

Hardening: thinking display request (fd2d135)

2.1.226 also split the request builder's env-flag read and put display behind B1()&&Xkn(model) gates:

ii=flag(env.CLAUDE_CODE_DISABLE_THINKING),di=cfg.type!=="disabled"&&!ii,vr=di&&B1()&&Xkn(u)?cfg.display:void 0,Gr=void 0;

The old display-defaulting sub-fix no longer matched. A new matcher rewrites this shape to vr=di?cfg.display??"summarized":void 0. Without the display field the API streams no thinking text at all, so this is request-side insurance against those gates flipping.

New: read-verbose-content (7005bf5)

Completes the tool-call-verbose intent on current builds: upstream's verbose Read result renderer collapsed to "Read N lines" even with verbose:!0 forced. The patch replaces the Read tool's renderToolResultMessage getter with a wrapper that renders the full line-numbered content (via the upstream {content,startLine} formatter, discovered by shape) when verbose, falling back to the original renderer otherwise. All helpers are discovered by shape per the matcher design rules.

Validation

  • node patch-claude-display.ts --file content.js --dry-run on pristine 2.1.226: all modules at expected counts (thinking-streaming 13/13, answer-streaming 2/2, read-verbose-content 1/1)
  • patched a real darwin-arm64 native binary, re-signed, --version shows (patched)
  • runtime-verified in tmux with timestamped pane captures: live thinking mid-phase, live answer text, verbose Read content
  • playbook updated for every new shape, plus the marker-verification rule

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