Expose exact-generation exit evidence - #159
Merged
Conversation
schickling
marked this pull request as ready for review
August 2, 2026 20:26
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
myobie
approved these changes
Aug 3, 2026
myobie
left a comment
Collaborator
There was a problem hiding this comment.
@schickling-assistant i am fine with this for now, but can you tell me why we need id + generation instead of just using a random id for every pty by default (using display name for a nicer name)? Isn’t id + generation just another more specified id? Or am I missing something?
…57-exact-generation-evidence
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
Supervisors need to capture retained terminal evidence from one exited PTY generation, durably consume it, and remove only that same generation. Identity-only cleanup can otherwise race a replacement session and delete the wrong artifacts.
What
pty evidence snapshotandpty evidence removefor non-TypeScript consumers.How
Evidence metadata is read through a bounded, no-follow, regular-file-only path and structurally validated before it reaches the public result union. Conditional removal locks and rechecks the opaque generation, refuses live or replacement generations, and removes metadata last so failed cleanup remains retryable.
The machine CLI emits exactly one tagged JSON document with exit 0 for semantic outcomes. Argument and operational failures emit a diagnostic on stderr, exit nonzero, and do not emit success JSON.
Rationale
An opaque generation token makes the snapshot-to-cleanup sequence race-safe without coupling PTY to any downstream log format or publication policy. Tagged unavailable and cleanup results keep missing, busy, invalid, running, vanished, and generation-mismatch states explicit instead of collapsing them into ambiguous process errors.
Verification
Closes #157