Repository navigation
Terminal: don't type replies to replayed queries into the shell - #2022
Merged
currentbits merged 1 commit intoNov 13, 2026
Merged
Conversation
Restored and re-attached terminals replay their saved raw output into a fresh xterm. Old output can contain terminal queries (Device Attributes ESC[c, cursor position ESC[6n, OSC 11;?, DCS XTGETTCAP, ...); xterm answered them through onData and the replies were typed into the live shell as junk like ^[[?1;2c. The pane now drops onData while a replay parses. An empty write's callback switches forwarding off just before the replay chunk parses, and the replay's own callback switches it back on. xterm runs each chunk's callback before parsing the next, so live output queued behind the replay is still answered and keystrokes typed before it go through. Why not strip queries from the saved log: replay isn't only the restart path. Remounting the pane on a running terminal (switching threads, splits) replays the whole in-memory buffer too, so stripping the log alone would leave that path broken. With replies muted, queries left in the log are harmless and nothing builds up across restores, so an escape-sequence stripper (DCS/OSC/C1/split-chunk parsing) would add risk for no gain. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
currentbits
deleted the
coder/terminal-restore-must-not-answer-replaye-ba36eb
branch
November 13, 2026 19:20
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.
When a terminal is restored, Solenta replays the saved output from the previous session. That output can contain terminal queries: Device Attributes
ESC[c, cursor positionESC[6n, OSC color queries11;?, and DCS XTGETTCAP. xterm answers them throughonData, so those answers went into the live shell as typed junk like^[[?1;2c.The fix ignores
onDatawhile the replay is being parsed:term.write("", cb)turns the flag on just before the replay is parsed.xterm processes writes in order, so keystrokes queued before the replay still go through.
Tradeoffs:
Tests: a
terminalPane.test.tsxcase where a replayed DA query produces no PTY write, while live typing still does. 35 of 35 pass.🤖 Generated with Claude Code