Skip to content

fix(terminal): drain deferred output without a wake event - #190

Draft
Lint111 wants to merge 1 commit into
Ark0N:masterfrom
Lint111:agent/split-deferred-terminal-flush
Draft

fix(terminal): drain deferred output without a wake event#190
Lint111 wants to merge 1 commit into
Ark0N:masterfrom
Lint111:agent/split-deferred-terminal-flush

Conversation

@Lint111

@Lint111 Lint111 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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

  • centralizes terminal flush scheduling in _scheduleTerminalWriteFlush()
  • clears writeFrameScheduled immediately before a flush runs
  • lets a large flush enqueue its own successor until pendingWrites is empty
  • reuses the same scheduler after flicker-buffer release
  • updates the anti-flicker documentation to match xterm.js 6 and the current mode-aware frame budgets

Validation

  • test/terminal-flush-budget.test.ts: 7 tests passed
  • new regression drains a 96 KB final Codex batch as three 32 KB writes without another terminal event
  • npm run check:frontend-syntax
  • npm run typecheck
  • npm run build
  • Prettier and staged diff checks

Scope

This PR does not change terminal streaming protocols, input handling, session lifecycle, viewport ownership, or mobile controls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant