test(session_manager): prove agent sessions survive daemon restart/upgrade (#2335)#2350
Open
harshitsinghbhandari wants to merge 2 commits into
Conversation
…dopt (AgentWrapper#2335) Add an end-to-end Reconcile() durability test covering the full mix of session states a daemon restart/upgrade leaves behind: an alive orchestrator and worker are adopted in place under their original ids (no id increment, runtime never torn down), a worker whose runtime died with the daemon is captured and relaunched under its original id, and a truly-dead unmarked session is not resurrected. Co-Authored-By: Claude Opus 4.8 <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.
Closes #2335 (the "do first" item).
Context
After tracing the runtime path end to end, #2335 was narrowed: the daemon is already disposable and agent sessions are already durable across restart/upgrade. The runtime lives out-of-process on both platforms (tmux server on Unix; detached conpty host +
ptyregistryon Windows), graceful shutdown deliberately does not tear sessions down (daemon/daemon.go), and bootReconcileadopts survivors. The one thing missing was an automated proof that this holds, which the issue flagged as "do first... if green, the bulk of this issue is closeable as already-done."What this PR adds
TestReconcile_AdoptAcrossDaemonRestartdrives the full boot-timeReconcile()pass over the exact mix of session states a daemon restart/upgrade leaves behind, and asserts sessions are decoupled from the daemon's lifetime:Graceful
ao stopand crash both converge on this same boot-timeReconcilepath (shutdown does not teardown), so the test covers both.Assessed and deferred (per the issue's own framing)
terminal/attachment.go). A 60s rolling-window breaker would guard a storm surface that does not structurally exist today. Reintroduce if an auto-respawn supervisor lands. Happy to add it in this PR if preferred.Verification
🤖 Generated with Claude Code