Repository navigation
Hand back a replay a terminal can read, or the output it missed - #41
Merged
Merged
Conversation
The replay an attach handed back was the raw buffer, trimmed from the front: a terminal fed it began mid-sequence, lost every mode set before the cut, answered the old questions in it into the program's input, and drew a trimmed ZMODEM transfer as a screen of binary. ighostvtd-io now keeps the buffer as a SessionOutputLog, read once by a TerminalStreamTracker that follows Ghostty's parser. A client that names how much of the stream it holds gets the rest unchanged; any other gets the screen rebuilt: the state the trimmed output left, then the newest output from a sequence boundary, without questions, clipboard writes, notifications or transfers. Both fields are optional both ways. The app holds received output back while its terminal catches up rather than letting the library drop the oldest of it, and no longer writes a reconnecting line between two links. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What was wrong
Every attach handed back the daemon's raw output buffer, trimmed from the front. A terminal fed it:
sz.All four reproduced on a guest running 1.6.20.
What changed
ighostvtd-io):SessionOutputLogkeeps the buffer with its stream offsets and the terminal state at its start, read once byTerminalStreamTracker(Ghostty's parser at the pinned commit). A replay writes that state back, starts at a sequence boundary, and leaves out questions, OSC 52, notifications, ENQ, answered kitty graphics and ZMODEM conversations.outputOffset); the reply is then the rest, unchanged (outputResumed). The tab keeps its position across transports, so a dropped link resumes with no gap and nothing printed twice. No reconnecting line is written into the terminal any more (the pill says it).Both new fields are optional both ways, so every patch of the 1.6 line keeps talking to every other.
Tested
make test: all suites, including the newTests/ReplayStream(a fresh terminal and one that already showed the session both end in the whole stream's state, over random streams), and PTY harness checks on a real session and over the proxy wire.make deb,make ipa.🤖 Generated with Claude Code