Repository navigation
perf(client): streamed text no longer republishes thread queue and checkpoints - #27425
juliusmarminge wants to merge 4 commits into
Conversation
…checkpoint state These tests reproduce #27325. A streamed assistant message.updated that only grows the message text makes queueWorkflowAtom and checkpointSummariesAtom publish a new value. Neither derived value changed, but the composer and queue subscribers wake on every tick. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eckpoints Providers that stream assistant text through message.updated replace the messages array on every tick. The queue workflow and checkpoint summary selectors re-derived a fresh value each time, waking the composer and queue control. Both now keep their previous value when what they derive is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sage Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This change avoids redundant queue and checkpoint subscriber updates while assistant text streams. Its effects are confined to client-side derived-state publication, with no changes to product defaults or persisted data. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Retain unchanged derived state packages/client-runtime/src/state/threadDetail.ts, packages/client-runtime/src/state/threadDetail.test.ts |
The queue workflow atom compares active runs, workflow flags, and queued run and message identities before replacing its cached value. The checkpoint summary atom retains its array when checkpoint references and assistant message IDs remain unchanged. Tests cover identity retention and state updates. |
Priority:
Estimated code review effort: 3 (Moderate) | ~15 minutes
Change: Refactor · Severity of issue fixed: Medium
Suggested reviewers: t3dotgg, macroscopeapp
Merge Risk: 
Minimal · up to 09381
-
No merge-blocking risk was found.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title "perf(client): streamed text no longer republishes thread queue and checkpoints" matches the main change. The PR makes the queue workflow and checkpoint summary selectors keep their last published value when derived contents are unchanged, so streamed text updates no longer republish them. The title is specific and follows the conventional commit format.
Full details: Description check
-
Explanation
The description follows the template. It has Problem, Change, Scope and approval, and Verification sections. The problem and change are clearly explained and match the code summary. Scope links the triaged issue
#27325and states what is left for follow-up. Verification lists focused tests with before and after results, notes that no visible surface changed, and states what could not be verified (iPad power measurement). The template asks for an approval comment or discussion link. The description says the issue came from the automated issue flow but does not link a maintainer approval comment. It also does not explicitly name the approval comment as the template requires. The template also asks for the model and harness, and the description includes them.
Full details: Linked Issues check
-
Explanation
Direct issue [
#27325] identifies per-update state publication as a streaming cost and supports focused, non-visible fixes. This PR changes the queue workflow selector and checkpoint-summary selector to retain their prior values when derived contents are unchanged. The queue comparison covers the active run, four flags, and queued run/message identities. The checkpoint comparison covers checkpoint identity and each summary'sassistantMessageId. Tests cover streamed updates and required changes for queued edits, new assistant messages, and new checkpoints. The issue does not require this PR to fix every listed contributor or provide physical-device power telemetry.
Full details: Out of Scope Changes check
-
Explanation
The changed source is limited to the two selectors in
packages/client-runtime/src/state/threadDetail.ts. The added tests inpackages/client-runtime/src/state/threadDetail.test.tsverify those selector changes. No unrelated product behavior, shimmer, markdown parsing, Liquid Glass, route subscription, or display-link changes are present in the reviewed diff.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- 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.
|
Note 🤖 Claude Opus 5.5 responding on behalf of Daniel Briskin This covers one slice of #27325 (the queue and checkpoint selectors), so could the body say |
|
Note 🤖 Claude Opus 5.5 responding on behalf of Daniel Briskin Bench result: no measurable power change while a turn streams, which is what I expected for two selectors.
That doesn't argue against merging. It just means the streaming cost lives in the other items. I'm measuring candidates for the markdown re-parse and the route and composer subscriptions next. |
Problem
While a turn streams, providers that send
message.updatedon every tick (ACP agents including the dev Replay provider, Cursor, OpenCode) give the client's thread projection a newmessagesarray each tick. Two selectors inpackages/client-runtime/src/state/threadDetail.ts, the thread queue workflow and the checkpoint summaries, re-derived and published a new value with identical contents on every tick. Every subscriber that reads only these selectors (the queue sheet on mobile, the diff panel and chat view on web) re-rendered on every streamed update for nothing. The issue measured streaming on iPad with the Replay provider and names this per-update thread publication as one of the causes.Change
Both selectors now keep the value they last published when the new value is equal, and publish a new one only when something they derive actually changes.
activeRun, the four flags, and each queued entry'srunandmessageby identity. A queued entry's text, attachments and context all come from those two.assistantMessageIddoes.Scope and approval
Fixes #27325
Triaged via the automated issue flow. This PR covers the per-update republication of these two selectors. The issue's other items are left for follow-up: the work-row shimmer, full markdown re-parse on each update, Liquid Glass compositing, the route-level thread state subscription, and idle display links.
Verification
packages/client-runtime/src/state/threadDetail.test.ts,derived thread state through a streamed message: the tests apply streamedmessage.updatedtext ticks and check that the queue workflow and checkpoint summaries keep their identity. They also check that a queued message edit, a new assistant message for a checkpointed run, and a new checkpoint each still publish a new value. Removing theassistantMessageIdcomparison makes the checkpoint test fail.fa4e4677c0, fix not applied):threadDetail.test.tsandthreadWorkflows.test.ts):Tests 38 passed (38).vp run check:changedpasses.Claude Opus 5.5 (Claude Code) and GPT-6.1 Sol (Codex), via the T3 Code issue flow.
🤖 Generated with Claude Code