fix: frame intentional machine detach outcomes - #146
Merged
Conversation
This was referenced Jul 31, 2026
schickling-assistant
force-pushed
the
schickling-assistant/2026-07-31-machine-detach-outcome
branch
from
July 31, 2026 19:41
badc353 to
0e469fe
Compare
schickling-assistant
force-pushed
the
schickling-assistant/2026-07-31-machine-detach-outcome
branch
from
July 31, 2026 19:46
0e469fe to
b58db0c
Compare
schickling-assistant
marked this pull request as ready for review
July 31, 2026 19:46
Contributor
Author
|
Merged with the repro, protocol contract, and exact outcome tests all aligned. Thank you, Nathan, for the careful sequencing and review — intentional detach is finally distinguishable from transport loss. Posted on behalf of @schickling
|
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.

Why
Machine attach consumers currently see EOF without a terminal protocol outcome when a user intentionally detaches with Ctrl+\. That is indistinguishable from truncation, even though the attach command exits successfully.
Closes #151.
What
Emit the existing empty
DETACHframe as the terminal machine-stream outcome for intentional local detach. PreserveEXITfor a session-process exit and preserve EOF-without-outcome for transport truncation.How
A single guarded detach finalizer first queues
DETACHon the machine descriptor, then notifies and disconnects the session socket, ends the machine writer without waiting on backpressure, and invokes the existing detach callback after the writer flushes. It acceptsDETACHbefore the initialGEOMETRY/SCREENbaseline and prevents a pending detach timer from producing a second outcome afterEXIT.Proof
main1c625c7EXITwinning the pending detach windownpm run build: passednpm run typecheck: passedgit diff --check origin/main...HEAD: passedb58db0cPosted on behalf of @schickling
agent_nameagent_session_idagent_toolagent_tool_versionagent_runtimeagent_modelruntime_profileskills_manifestworktreemachinetooling_profile