fix(tui): stop one bad event from dropping the rest of a flush batch - #13125
fix(tui): stop one bad event from dropping the rest of a flush batch#13125johnnyeric wants to merge 1 commit into
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The PR was rewritten to a single commit ( Files Reviewed (4 files)
Previous Review Summaries (3 snapshots, latest commit 5975641)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 5975641)Status: No Issues Found | Recommendation: Merge The new commit Files Reviewed (1 file)
Previous review (commit 71907a6)Status: No Issues Found | Recommendation: Merge The new commit Files Reviewed (4 files)
Previous review (commit 71de80b)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (4 files)
The root-cause fix is sound: per-handler isolation in Reviewed by grok-4.6 · Input: 65.3K · Output: 9.9K · Cached: 475.3K Review guidance: REVIEW.md from base branch |
5975641 to
d0b8152
Compare
What
Fixes the TUI stall where a turn visibly finishes (footer shows the completed duration) but the prompt keeps spinning and the transcript stops updating.
Why
The SSE client batches events and
flush()clears the queue before iterating, emitting each event unguarded inside a single Solidbatch(). The legacymessage.removed/message.part.removedhandlers insync.tsxcalledsearch(...)onstore.message[...]/store.part[...]without checking they exist — for a session this TUI never hydrated (background-session cleanup, revert, another window), that isundefinedandsearchthrows readingitems.length. One such event mid-batch permanently dropped every later event in that flush, including the idle status the spinner depends on.Changes:
sync.tsx: guard the legacymessage.removed/message.part.removedhandlers with the same missing-collection checks the.1handlers already have, and handlesession.idleby resettingsession_statusto idle.sdk.tsx: isolate event dispatch per handler and per event so one throwing handler logs (tui event handler failed) instead of dropping the rest of the batch or killing the SSE loop.