Skip to content

fix(tui): coalesce terminal resize frames - #993

Draft
avs-io wants to merge 5 commits into
getagentseal:mainfrom
avs-io:codex/issue-977-resize-debounce
Draft

fix(tui): coalesce terminal resize frames#993
avs-io wants to merge 5 commits into
getagentseal:mainfrom
avs-io:codex/issue-977-resize-debounce

Conversation

@avs-io

@avs-io avs-io commented Aug 13, 2026

Copy link
Copy Markdown
Member

Problem

Terminal font zoom and window-resize bursts caused the interactive dashboard to repaint repeatedly. Even a simple debounce still allowed unrelated React updates during the quiet window to paint a stale-width frame before the final settled layout.

Root cause

Ink observed physical terminal dimensions immediately while CodeBurn separately rerendered after resize events. Width and height could therefore advance through different render paths, and state updates or refreshes could write an intermediate frame against dimensions the terminal had already left.

Change

  • Hold interactive terminal dimensions stable during resize bursts.
  • Suppress synchronized application frames while a resize is pending while preserving imperative terminal-control writes and write completion semantics.
  • Publish one coherent settled resize to Ink, useWindowSize, and the dashboard before requesting the final rerender.
  • Preserve mounted period, view, and logical viewport state.
  • Cancel pending delivery and remove all resize relays during teardown and render failures.
  • Normalize invalid terminal dimensions to safe defaults.

User impact

Zooming the terminal font or rapidly resizing the window now produces one final reflow after dimensions settle instead of repeated stale or partial dashboard redraws. The user remains at the same logical reading position and terminal modes are restored cleanly on exit.

Preservation and out of scope

  • Static and non-interactive output are unchanged.
  • Periodic refresh behavior is unchanged.
  • One final synchronized repaint after settlement remains expected.

Testing

  • Credible RED on the prior candidate: a state update during pending resize wrote an old 100×24 frame followed by a mixed 80×20 prop / 100×24 hook frame.
  • Focused real-Ink suites: 73/73.
  • Full root suite: 2,633 passed, 5 skipped.
  • Serial lock suite: 26/26.
  • Full desktop suite: 468/468.
  • Root, dashboard, and desktop TypeScript checks passed.
  • CLI, dashboard, and desktop production builds passed.
  • Exact-SHA independent spec and hostile standards reviews approved.
  • Real controlling-PTY storm across width/height breakpoints: zero pre-settle bytes, one BSU/ESU transaction, one complete final frame, zero later frames, and clean mouse/alternate-screen teardown.

Fixes #977.

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.

TUI: terminal zoom/resize causes repeated full-screen redraws

1 participant