Repository navigation
fix(chat): keep row callbacks stable across streamed frames - #23266
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design problems found. The PR uses the page's existing latest-value ref, which is the standard fix for callbacks that rebuild every frame, and it takes nothing away. [DESIGN-REVIEWED] 84d3d65 Description read[DESCRIPTION-READ] 886e957aecf6d3a5a2913ac2cece6f81f4139e6c825e965795b05fbad0617f9c That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The diff only changes callback identity in chat hooks and adds a test. It adds or changes no user-visible control, string or state, so the missing blind read leaves no evidence gap. [UX-REVIEWED] 84d3d65 Description read[DESCRIPTION-READ] 9179feab069ffb2267e30525ff8472cbfa54974835ce5d7e1e98fdc096e938a9 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix removes the cause by reusing the page's existing What this change shipsInventory (5 items) — 5 justifiedIntent: keep a long chat responsive during an agent turn, so the dashboard no longer freezes and goes blank. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 84d3d65 Description read[DESCRIPTION-READ] c4036942aa1fe29fbf8b3c00cd7f0920f10a1d9f12ddbf2bc00f009929f28914 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
81fc5f7 to
84acd1d
Compare
|
self-added: yes
|
84acd1d to
84d3d65
Compare
|
Rebased once onto main for the #23264 Windows fix. |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (5 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: chat transcript callbacks read messagesRef instead of messages, so streamed frames no longer re-render every mounted row; a new test pins the stable identities.
Problem / Motivation
Goal: A long chat stays responsive during an agent turn, instead of freezing the dashboard until it goes blank.
On sessions with long histories (conductors, crewmates), the dashboard stops responding during a turn and goes blank. Every streamed frame (
chat_chunk,tool_call,tool_result) re-renders every message already on screen, so the cost grows with the session's length.Why it matters
Heavy users hit this. Conductors and crewmates with thousands of messages lose the dashboard mid-turn, and only a restart brings it back. It is a P0 oncall report on 0.9.0.4.
Not a goal
What changed (motivation → approach → change)
Symptom → cause → change:
AssistantMessageandTurnBlock. Measured: about 33,500 bubble renders per 100-tool turn by turn 4.handleRegenerate,handleEditResendandhandleJumpToQuoteclose overmessages. That array is new on every frame. All three are deps of the transcript renderers memo, so every frame rebuilds it and no settled row can skip its render.messagesRefinstead ofmessages, so its identity no longer follows the array. ChatPage now hands that ref touseRegenerateanduseMessageActions;jumpToLoadedPinnedMessagereads it too. Behaviour is unchanged: each still acts on the newest rows when pressed, and the pending pin-jump effect listsmessagesitself so it still re-resolves when older rows page in.Measured on a local gateway with the fake ACP backend (100 tool calls with 20 KB results per turn, headless Chromium):
Backwards compatibility
Compatible: same callbacks, same arguments, same effects. Only their identity across renders changes.
Removes nothing: no path, key, record or capability is taken away.
Tests
website/src/test/transcriptRowCallbacksStable.test.tsx: for each of the three hooks, the callback keeps its identity whenmessageschanges and still acts on a row only the newer array holds. It fails 3/3 on main and passes with the fix. Determinism: five runs with--sequence.shuffle, all 3/3 green.Manual verification
Reproduced and measured end to end on a 127.0.0.1-only local gateway with the fake ACP backend, as in the table above. A per-prop memo-compare counter showed no extra
AssistantMessage/TurnBlockrenders per frame after the fix. The probe was temporary and is not in the diff.Screenshots / video
Why no screenshot: Only callback identity changes; every rendered pixel is the same.
Related Issues
Closes #23249
Sibling sweep
Swept:
git grep -nE "\}, \[[^]]*\bmessages\b[^]]*\]\)" -- website/src/pages/chat/page/, plus a runtime probe that counted which transcript-renderers memo deps change per streamed frame.Sibling: website/src/pages/chat/page/transcriptPins.ts -- changed here
Sibling: website/src/pages/ChatPage.tsx -- changed here
Sibling: website/src/pages/chat/page/transcriptRendering.tsx -- not affected --
redactionCoachTsmemo yields a primitive ts that is stable per frameSibling: website/src/pages/chat/page/transcriptJumps.ts -- not affected -- effect deps, not a renderers memo input
Pattern harvest
Rule candidate: lint
Pattern: "a callback passed into a memo that gates many memo() rows lists a per-frame array (e.g.
messages) in its deps"Checklist