Repository navigation
fix: coordinate native thread lock probes - #79
Merged
Merged
Conversation
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.
Problem and behavior
Closes #55.
A free-lock probe briefly holds the thread lock exclusively. Without native coordination, a concurrent Codex writer can receive
WouldBlockand report an active writer. Each probe now takes Codex's existing.coordination.lockfirst, so coordinated writers wait for the probe to finish.Implementation
unknown.native_coordination_busy_before_signal;lock_changed_before_signalis retained when the snapshot actually differs.lock.probe.guardevidence, with matching schema and type-only declarations. The packaged artifact includes the internal runtime module.Compatibility and limits
An existing thread lock with a missing, unsafe, changed, or unavailable coordinator is
unknown, and unlock refuses. Verified thread-lock absence retains its existing meaning. Native files are never created, deleted, rewritten, chmodded, or repaired; there is no unguarded fallback.Normal readable coordinator modes, including 0644/0664, are accepted. Contents, inode identity, ownership, permissions, and mtime remain unchanged; access times may change. Diagnostics can briefly delay coordinated writers. SIGSTOP or a debugger pause while holding the coordinator can extend that delay until the process resumes or exits. Writers bypassing Codex's coordination protocol are outside this interference guarantee.
Validation
WOULD_BLOCKand the guarded writer'sGUARDEDresult without a thread attempt. Bounded coordinated acquire/drop stress observes zero probe-inducedWouldBlock.df95d30496917dd3e7658a7d1006cba18d91b647passes all 23 hosted checks, including all 12 macOS/Linux x64/arm64 Node 22.13/current-22/current-24 combinations, packaging, security audit, and CodeQL. CI run.Validation uses scratch homes and synthetic owners only. This PR does not publish a release.