Add cooperative session takeover to CLI - #351
Merged
Merged
Conversation
Brian Krabach (bkrabach)
marked this pull request as ready for review
September 19, 2026 23:10
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.
CLI sessions can now yield to Unified or another compatible local host without asking the user to manually close the terminal. A release request wakes idle input or gracefully stops active work, saves native history, finishes cleanup while holding the lock, then exits with a notice naming the requesting app.
When resuming a busy session, interactive CLI startup identifies the owner and offers takeover. Scripts opt in with
--takeover;--handoff-timeoutbounds the wait. Startup acquires ownership and reloads saved state before execution. Failed saves retain ownership, timeouts never force unlock, and a competing successor is not silently targeted.Depends on microsoft/amplifier-foundation#398, pinned in package metadata and the lockfile. Companion Unified integration: https://github.com/bkrabach/amplifier-unified/pull/46.
Validation: full suite passed against the installed pinned Foundation package: 2,364 passed, 45 skipped, 13 deselected by the existing test configuration, and 1 expected failure. The run enabled terminal colors for existing ANSI-rendering assertions. Coverage includes idle wakeup, real-lock acquisition, save-before-cleanup, failed-save retention, interactive accept/decline, noninteractive opt-in, shell completion, JSON persistence, and TTY teardown. Static checks and whitespace checks passed. All six macOS/Linux/Windows CI unit jobs and both macOS/Linux integration jobs passed.
This preserves the current native transcript/metadata format and existing POSIX shared-ownership boundary. It does not introduce event-only recovery or migrate execution between machines. See docs/SESSION_HANDOFF.md.