fix(tui): coalesce resize bursts without dropping updates - #1038
Merged
Conversation
Hold Ink stdout columns/rows frozen during a SIGWINCH burst and emit one settled resize, then rerender. Do not intercept writes, so a mid-burst state update still paints even when net size is unchanged. Fixes getagentseal#977.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Terminal font zoom and window-resize bursts made the interactive dashboard repaint at intermediate widths. Draft #993 fixed the root cause (Ink has its own resize handler) but its
write()interceptor could drop a mid-burst state update forever when net size was unchanged.Root cause
CodeBurn listened on
process.stdoutresizeand rerendered immediately with livecolumns/rows. A local debounce of that listener alone cannot stop Ink painting. #993 then swallowed BSU/ESU frames inwrite(); Ink still advancedlastOutput, so a settle that produced the same string wrote zero bytes.Change
columns/rows) and a private resize emitter during a burst.app.rerender(dashboard())then let Ink see one resize.write()interceptor, no BSU/ESU parser, no EventEmitter-facade matrix.windowColumns(noterminalSizerename) so optimize: re-measure applied fixes and report worked / partial / no effect #1020 connector tests stay valid.This replaces the closed #993 shape. It does not reopen that PR.
User impact
Zooming the font or dragging the window produces one settled reflow. Mid-burst content is not dropped. One transient old-width frame during a burst is accepted.
Preservation and out of scope
Testing
I have tested this locally against real data (not just unit tests)
Focused dashboard suites pass
Full
npm testnot re-run (TUI-only)npx vitest run tests/dashboard-resize.test.ts tests/dashboard.test.ts: 67/67, including mid-burst no-net-size-change and identical-dim SIGWINCH + state update.Local TUI launched from this worktree (
npx tsx src/cli.ts report --refresh 0).Fixes #977.