Daemon restarts reattach live sessions - #103
Conversation
cd6eaa3 to
d44702d
Compare
|
Linux validation done, twice over: Real Ubuntu (x86_64, systemd user unit) — dedicated test unit Docker (arm64) — full One CI note: in a bare container (no init as PID 1) four kill-liveness tests fail on unreaped zombies — |
d44702d to
ebe9f7c
Compare
ebe9f7c to
2066633
Compare
2066633 to
edb0708
Compare
The boot sequence gains a first pass: every live holder under the holders root is dialed and its session rebuilt — same id, same ring, same running child. Dead holder dirs are swept, and the revive pass that follows only touches snapshots for sessions that are not already back. Holders answer SIGTERM (logout, reboot) by writing exactly the revival snapshot the daemon used to, so the reboot story is unchanged. Service units harden to match: systemd gains KillMode=process so a unit stop cannot reap the holders, launchd gains AbandonProcessGroup, and flue restart / flue update converge the installed unit file before bouncing so existing installs pick the settings up on their next update. An end-to-end test builds the real binary, spawns through a real daemon, SIGTERMs it, starts a successor, and finds the same session: same id, same child pid, scrollback intact. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
DialRemote's ErrHolderGone is the license to sweep; a holder that answered the dial and then failed the handshake is alive, with a plausibly running session behind it, and its directory is left for a daemon that can speak to it. A missing or corrupt identity record no longer costs a live session its reattach either — the hello carries the spawn-time facts, so a zero record lets the holder's account stand. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
edb0708 to
09da6ee
Compare
Fourth in the holder-sessions stack, on top of #102. This is the PR where the feature actually happens.
ReattachHoldersdials every live holder under the holders root and rebuilds its registry entry — same id, same ring, same running child. Dead dirs are swept; the revive pass then only handles snapshots for sessions that are not already back, and clears stale ones.KillMode=process(the default control-group kill would reap holders on every restart — without this the feature is dead under systemd), launchd gainsAbandonProcessGroup.flue restartandflue updateconverge the installed unit file before bouncing (newservice.UnitRefresher), which is the migration path for installs from before this change.TestSessionsSurviveDaemonRestartbuilds the real binary, spawns via the real ws wire, SIGTERMs the daemon, starts a successor, and asserts the same session id is running with the same child pid and intact scrollback. Passes in ~1.4s.Caveat worth stating: KillMode=process semantics verified by reading systemd docs, not on a live Linux box — holders left in the unit cgroup after a stop are expected to survive, but a Linux smoke before release would be good diligence.
🤖 Generated with Claude Code