Repository navigation
fix(terminal): preserve answered snapshots across fit deadlines - #33474
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
4 tasks done
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.
ELI5
Returning to a terminal could insert a false recovery warning into a running TUI, leaving duplicated “Working” rows. A snapshot that already arrived now resumes output quietly when pane sizing takes too long.
What Changed
terminal-output.scrollback-restoregate with six cases, exact headless-buffer comparisons, and request counts during continued output.Why
The old deadline recognized an answered snapshot only after the live queue overflowed. Small queues instead received the unavailable-recovery banner, shifting the cursor position underneath cursor-relative TUI redraws. The existing baseline/drain and quiet-abandon paths already supply the recovery behavior needed here.
Source history traces the awaited-fit path to #8674, committed July 16, 2026 UTC, first stable release v1.4.144 on July 17. The affected file is identical in v1.4.239 and v1.4.240. This dates the vulnerable code from source history; an old-release runtime bisect was not performed.
Linked Issue
Slack report
Visual Proof
Same finite cursor-redraw fixture and forced 1.8-second sizing delay, using a real PTY and main-owned snapshot in a hidden macOS Electron app. The old code leaves stale FRAME_08 beside final FRAME_23; the fix leaves one final row. The exact warning was captured in terminal writes and overwritten by subsequent redraws.
Continuous 20 Hz redraw with sizing unavailable for 12 seconds, observed for 19 seconds: one target snapshot request, advancing output, no warning or duplicated rows. A real shell command still worked after recovery and another hide/reveal.
Testing
ORCA_BACKGROUND_LAUNCH=1 pnpm tc:web,pnpm run check:code-quality:changed,pnpm run check:reliability-gates, andgit diff --check.Review
Self-review and independent Claude CLI review found no remaining blocking defects. Review feedback eliminated repeated repaints for intact queues while preserving repaint recovery for real gaps. Checked sequence ordering, stale generation/PTY guards, fit continuation, timer cleanup, true recovery failures, and remote behavior.
A fresh adversarial Claude CLI review of the exact published commit
39486521ccd14896747393cf06ce4743d8d27addindependently traced all three changed files and surrounding code. Verdict: no new must-fix defect; recommends merging. It challenged snapshot paint ordering, generation/PTY identity, fit cancellation and skipped alt frames, sequence/raw-length overlap, true fetch failures, mixed-version remote behavior, and bounded work. This review was read-only and did not run tests.Nonblocking inherited behaviors remain: the existing quiet-abandon gap reset can cancel a partial escape sequence or reset styling until the TUI redraws; the quiet path does not ACK the painted snapshot, so a later reveal may fetch again until a restore completes normally. These were not expanded into this fix.
Agent skill upstream boundary
Notes
terminal-output.scrollback-restore; an answered snapshot must not become an unavailable-recovery banner solely because pane fitting is delayed. Exact buffers and bounded request counts are the oracle.