feat: make lease and job-lock ownership generation-scoped - #7
Merged
Conversation
The write lease and the companion job lock now claim a generation token and publish metadata atomically inside that claim, so acquisition, heartbeat, poison staging, release, and --clear-lease all verify they are acting on the generation they own instead of on whatever currently sits in the lock directory. Every ambiguous outcome fails closed and retains the lock rather than releasing a lease that may still cover a live writer. Also in this change: - A failed lease release downgrades an otherwise successful loop or watchdog run to BLOCKED/11 instead of reporting completion over a retained lock. - STUCK now persists a bounded tail of the attempts log to the plan file in a delimited MAESTRO ATTEMPT HISTORY block, so the evidence survives the run. - A post-launch companion, process, or result-channel fault reports IMPLEMENTER_STATE: COMPANION_FAILURE and ends BLOCKED without billing an implementation attempt. - --verify runs from the lease repository root, so root-relative verification no longer depends on the caller's shell directory. - Contention progress is emitted on the first wait tick and then at most every 30 seconds, and distinguishes the owner's lease age from the contender's wait window. - Companion status JSON is parsed from the status file rather than piped through stdin.
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.
What
The write lease and the companion job lock now claim a generation token and publish metadata atomically inside that claim. Acquisition, heartbeat, poison staging, release, and
--clear-leaseeach verify they are acting on the generation they own, instead of on whatever currently sits in the lock directory. Every ambiguous outcome fails closed and retains the lock rather than releasing a lease that may still cover a live writer.Also
BLOCKED/11 instead of reporting completion over a retained lock.STUCKpersists a bounded tail of the attempts log to the plan file in a delimitedMAESTRO ATTEMPT HISTORYblock, so the evidence survives the run.IMPLEMENTER_STATE: COMPANION_FAILUREand endsBLOCKEDwithout billing an implementation attempt.--verifyruns from the lease repository root, so root-relative verification no longer depends on the caller's shell directory.held for) from the contender's wait window (wait_budget/wait_elapsed).README.mdandrules/orchestrator-implementer.mdare updated to match.Verification
Suites extended in this change:
tests/lease.sh,tests/job-lock.sh,tests/stop-report.sh,tests/liveness.sh,tests/bounded-calls.sh,tests/provenance-edge.sh,tests/detection.sh. CI runs the full suite on macOS.