You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Batch thinking deltas like text deltas while streaming #155
Text and tool-input deltas are buffered for 50ms before they update the store, but thinking deltas are not. Each thinking event updates the store at once (desktop/src/stores/chatStore.ts:1309-1328). That creates a new messages array, which:
makes MessageList rebuild its whole render model (buildRenderModel, MessageList.tsx:1513);
re-renders every tool group through a new toolResultMap.
With fast thinking output this happens dozens of times per second.
What to do
Buffer thinking deltas the same way as text deltas: the 50ms buffer around pendingDeltaBySession (chatStore.ts:272-301, flushed at :1265), or one rAF.
Two ordering rules:
Flush pending thinking before the first text delta, a tool call, or turn end, so the order of thinking and text stays correct.
Flush on session switch and disconnect, the same way text is flushed today (chatStore.ts:768, :927).
Done when
A test shows that several thinking deltas inside one window produce one store update, and that thinking still appears before the text that follows it.
The PR includes a before/after React Profiler capture, or a render count, for a reply with a long thinking block.
Taking this one — #258 is open and covers the four points from the #160 review: flush at the top of content_start for every block type, the real ordering sequence with chatState / activeThinkingId assertions, the remote user_message flush, and no comments in the new code. The mirror idle path now folds text before thinking, matching flushPendingThinking.
Measured on Windows: 10 thinking deltas in one window produced 10 store updates on main, 1 with the branch. chatStore.test.ts 104 pass, lint clean, and the full desktop suite is at 3017 pass / 5 fail — those same 5 fail by name with the source reverted, so they are the pre-existing Windows set from #255, not this change.
Activity
GoDiao commentedon Nov 14, 2026
#160 was closed after it went quiet, so this is open again. The approach there was right; its review lists what a PR needs on top of it:
content_startfor every block type, not at the first text delta;user_messagecase too, so a message from another client doesn't land before the thinking;content_starttext → delta) and checkschatStateandactiveThinkingId;Comment here if you'd like to take it.
iruzen-dono commentedon Nov 16, 2026
Taking this one — #258 is open and covers the four points from the #160 review: flush at the top of
content_startfor every block type, the real ordering sequence withchatState/activeThinkingIdassertions, the remoteuser_messageflush, and no comments in the new code. The mirror idle path now folds text before thinking, matchingflushPendingThinking.Measured on Windows: 10 thinking deltas in one window produced 10 store updates on
main, 1 with the branch.chatStore.test.ts104 pass, lint clean, and the full desktop suite is at 3017 pass / 5 fail — those same 5 fail by name with the source reverted, so they are the pre-existing Windows set from #255, not this change.