Repository navigation
Conversation
New `rat resurrect <source>` subcommand. Source is either a .log path or a session name/id; for names, look up the meta file (works for dead sessions too — metas outlive the process until clean shutdown or `rat kill` sweeps them). Plumbing: - Daemon gets a new `--seed-log <path>` flag. Between SessionStarted and the PTY spawn, it reads the seed log's PtyOutput events and re-appends them to the fresh log, then writes a yellow separator marker so the user can see where the new shell begins. Non-visible events (ClientInput, Resized, SessionStarted/Ended) are dropped. - Client gets `spawn_daemon_with_seed` as the plumbing core; `spawn_daemon` is now a thin `seed_log=None` shim over it, so the existing callers (`new`, `spawn_bare`, post-attach new-session) are unchanged. What resurrect rebuilds: visible scrollback. What it doesn't: the original process, env, cwd. This makes it genuinely useful after a daemon crash or host reboot without pretending to be a full session migration. Session migration is a separate roadmap item (durable state across hosts).
1 of 3 tasks
Owner
Author
|
Superseded by #11 — combined to avoid peer-merge conflict churn. Original commit preserved there. |
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
`rat resurrect` spawns a fresh daemon whose log is pre-seeded with an old session's `PtyOutput`, then attaches. You get the visible scrollback back; the new shell, env, and cwd are fresh (the original PTY is gone).
```sh
rat resurrect ~/.local/state/rat/.log
rat resurrect agent # resolves via meta file (dead sessions OK)
rat resurrect agent -n agent-ii # give the new session a different name
```
Daemon gets a new `--seed-log ` flag. Seed replay happens between `SessionStarted` and the PTY spawn, followed by a yellow `-- rat resurrect: previous session replayed above --` separator.
Test plan