fix: make shared-state transitions unwind-safe - #114
Merged
Conversation
danielkov
commented
Sep 5, 2026
danielkov
commented
Sep 5, 2026
danielkov
commented
Sep 5, 2026
danielkov
enabled auto-merge (squash)
September 5, 2026 22:17
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.
Summary
Require invariant-driven handling of lock-protected shared state and repair existing publication, cancellation, and poison-handling failures. Failed transitions now preserve ownership or isolate uncertain state instead of publishing partial success or pretending work has completed.
Impact
Interrupted filesystem and credential-refresh operations return explicit unavailability rather than silently recovering uncertain external effects. Filesystem handle reads now share service-state exclusion, and cancelled or timed-out child forks retain serialization until the outstanding remote request settles.
Normal protocol and durable artifact formats are unchanged; global panic enforcement remains outside this change.
Technical details
Session publication and teardown
ACP v1 and v2 publication use ownership-aware unwind rollback, reject invalid admissions and duplicate identities, and isolate poisoned connection maps. Registry teardown requires positive actor completion before credential reset or reopening admission. Fork responses use privately prepared creation ownership, preserving cleanup on failed submission without a fallible commit after success.
Cancellation and callbacks
Background-job bookkeeping retains real activity and terminal debt across poison, moves notifications and cancellation effects outside guards, and rejects stale relay ownership. Activity projection claims fence abandoned execution. Child request workers retain serialization, and MCP authorization publishes its worker and pending status without an intervening suspension; live operation gates survive server deletion and re-addition.
Recovery boundaries
The mandatory shared-state skill requires all-writer invariant arguments, safe drop ordering, and failure-path coverage. Recovery is limited to audited in-memory owners; filesystem/backend and transcript uncertainty instead fence the affected owner, including subsequent writes and creation publication.