fix(terminal): drain deferred output without a wake event - #190
Conversation
Ark0N
commented
Aug 5, 2026
Hi Lior, closing this one as part of a cleanup of the seventeen PRs currently open from you. The full explanation is in #173, and I would rather you read that one than this note, because it is the honest version and it is not a dismissal of your work. The short form: sixteen PRs opened in a single day, roughly 42,000 added lines in total, landing mostly on the same few files (nine touch Going forward, please keep no more than three open PRs at a time, each one a single behavior change that stands on its own, with a test that fails on master and passes with the fix. #214 and #215, merged today, are good models. If this particular change fixes something that genuinely annoys you in daily use, it is a good candidate to be the first one you reopen on its own, rebased on current master. I will review it properly. Thanks for the effort you put in, and sorry to close it this way. |
Summary
Fixes terminal output that could remain queued indefinitely after a large final response.
flushPendingWrites()writes one mode-specific frame budget and requeues the remainder. Previously the scheduled flag stayed set while that function ran, so its attempt to schedule the next yield was ignored. The remainder appeared only when unrelated output arrived later, which looked like truncated agent responses or passive shell commands waking only after user activity.Change
_scheduleTerminalWriteFlush()writeFrameScheduledimmediately before a flush runspendingWritesis emptyValidation
test/terminal-flush-budget.test.ts: 7 tests passednpm run check:frontend-syntaxnpm run typechecknpm run buildScope
This PR does not change terminal streaming protocols, input handling, session lifecycle, viewport ownership, or mobile controls.