fix(terminal): supersede stale synchronized TUI frames - #2442
Draft
zopenb wants to merge 1 commit into
Draft
Conversation
Contributor
Author
|
Longer-soak update: the freeze reproduced again. The new live capture differs from the original 53.5 KB full snapshots: two OpenCode 1.18.4 sessions were each emitting small, closed DEC 2026 incremental animation blocks at roughly 10-20 FPS (spinner intervals in current OpenCode source are 40/80 ms). The remote processes averaged about 109% and 132% CPU, PTY queues remained empty, and the Netcatty renderer saturated a core. These blocks do not contain cursor-home full-frame markers, so this PR correctly leaves them untouched and therefore does not solve that recurrence. I have updated the PR description and am keeping it in Draft. |
2 tasks
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.
Summary
Prevent the renderer from spending seconds replaying obsolete full-screen TUI snapshots when xterm parsing falls behind the remote stream.
OpenCode emits complete DEC 2026 synchronized snapshots. On a 266x68 terminal, one observed frame was 53,529 bytes and updated roughly 18,000 cells. Netcatty previously queued every snapshot serially, so a newer input response could remain behind frames that no longer had visible value.
Type of Change
Related Issue (optional)
Related to #2272
Changes Made
1;1(or implicit home);CSI 14 t, may precede the block;replacePendingKeyto the terminal write queue.Screenshots / Demo
Manual reproduction environment:
CSI ? 2026 lBefore the patch, the UI repeatedly appeared frozen while the remote PTY and SSH socket queues were empty. A forced PTY resize made OpenCode immediately emit complete frames, confirming that the remote TUI was responsive. A longer soak subsequently reproduced the freeze. The new capture shows a separate path: multiple OpenCode sessions emit small, closed DEC 2026 incremental animation blocks every 40-80 ms without cursor-home full-frame markers. This patch intentionally does not replace those incremental blocks, so it is not a complete fix for the reported freeze. The PR remains a draft while that path is investigated.
Testing
npm run build)npm test)npx tsc --noEmitcurrently reports numerous pre-existing errors onupstream/main, primarily in SFTP, AI bridge, and test-fixture types. The changed files pass their scoped ESLint and runtime tests.Checklist