fix(persistence): keep contended sessions usable - #46
Merged
Conversation
Keep non-owner sessions in a passive goal mode and retry ownership only at an explicit control boundary. Harden mixed-version lease acquisition with an atomic compatibility guard and immutable owner claims. Fixes #41
Check the exact private lease token instead of rejecting UUID-shaped hostnames, and retain a finite logger hang detector without imposing a 250ms filesystem deadline.
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
Keep a second OpenCode process usable when it opens a session whose goal-state
shard is already owned, without weakening the same-session single-writer
guarantee.
What changed
canonical tools use stable
session_owned_elsewhere, while slash commandsand legacy tools return actionable human-readable denials
durable active work paused until the user resumes it
immutable per-owner claims
layouts and document bounded manual recovery
retention beyond 1,000 sessions, exact v0.6.7 startup races, and portable
filesystem behavior
Why
The issue's proposed catch-and-continue fallback would create an unpersisted
second copy of the same goal workflow. It could report successful mutations that
are silently lost and allow two continuation controllers to act on one session.
Passive goal mode preserves normal OpenCode use while keeping goal state
single-writer and recoverable.
Validation
npm run release:check— passedpackage-content gates passed
(
node:22-bookworm)exactly one after resume
Compatibility and rollout
The local filesystem must support regular-file hard links and preserve the
long-lived guard timestamp; unsupported layouts fail closed and capability
errors require a supported local filesystem. Safe automatic same-session
takeover requires every participating process to use the new release. The PR
expands portable filesystem CI so Linux, macOS, and Windows must all pass before
merge.
Fixes #41