fix(engine): fresh engines resume existing sessions (restart-survival gate fix) - #96
Merged
Merged
Conversation
…essions The live gate caught it: after a daemon restart, a fresh InteractiveEngine spawned with --session-id for a session that already existed on disk; claude exits with 'Session ID already in use' and the turn fails (the engine-mode reincarnation of gotcha #24). The headless.prompt frame already carries the started hint — thread it through _interactive_turn into the engine so the first spawn uses --resume when the session pre-exists. host-agent: 260 passed (2 pre-existing drain failures).
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.
Goal
The PR #95 live gate failed its restart-survival step: after a daemon restart, a fresh engine spawned
--session-idfor an already-existing session → claude exits ('Session ID already in use') → turn failed. Engine-mode reincarnation of gotcha #24.Change
Thread the existing
startedhint from theheadless.promptframe through_interactive_turnintoInteractiveEngine(started=...)— first spawn uses--resumewhen the session pre-exists. One new test (started=True → first spawn has--resume, not--session-id).Test Summary
host-agent 260 passed (2 pre-existing drain failures, identical on main). Ruff clean.
After merge
I re-run the full live gate: 2 turns → daemon restart → turn 3 must recall the codeword.