Repository navigation
Bring terminals back after a server restart, with OSC 7577 program resume - #1482
Merged
Merged
Conversation
…sume After a server restart (an update, a crash, a reboot) every open terminal now comes back under the same terminal ID: its earlier output, then a live shell in the folder it was last in. Programs that speak the Program Resume Protocol (OSC 7577) come back running too, in the same pane. - Server: each terminal's launch and last folder (OSC 7, read from libghostty) are saved with its buffer, and restore restarts every open terminal instead of showing it as exited. Input typed while the shell starts is queued, and a pane closed while it starts stops the new shell. The restart only leaves the alternate screen when a full-screen program had it, so plain shells keep their output. - OSC 7577: zsh and bash 4+ get a per-terminal OSC7577_TOKEN. Reports are verified (SHA-256 mac, 60 s window, per-pid ordering, strict parsing) and accepted only from processes in that terminal's tree; records end when the program clears them or exits (2 s grace). The resumed command runs from a Codevisor startup hook layered on Ghostty's shell integration, after the user's startup files, as a job of the shell with each argument passed intact. Records are saved within a second of a report. - processes: the tree tracker can look up a member on demand and say whether a process was alive recently; processCwd reads a process's directory. - terminal: OSC 7501 now shares an OSC scanner and base64 reader with OSC 7577. - Docs: the terminal protocol page describes restarts and OSC 7577. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
After a server restart (an update, a crash, a reboot) every open terminal now
comes back under the same terminal ID: its earlier output, then a live shell in
the folder it was last in. Programs that speak the Program Resume Protocol
(OSC 7577) come back running too, in the same pane.
are saved with its buffer, and restore restarts every open terminal instead of
showing it as exited. Input typed while the shell starts is queued, and a pane
closed while it starts stops the new shell. The restart only leaves the
alternate screen when a full-screen program had it, so plain shells keep their
output.
verified (SHA-256 mac, 60 s window, per-pid ordering, strict parsing) and
accepted only from processes in that terminal's tree; records end when the
program clears them or exits (2 s grace). The resumed command runs from a
Codevisor startup hook layered on Ghostty's shell integration, after the
user's startup files, as a job of the shell with each argument passed intact.
Records are saved within a second of a report.
process was alive recently; processCwd reads a process's directory.
Co-Authored-By: Claude Opus 5.5 [email protected]