Skip to content

feat: make lease and job-lock ownership generation-scoped - #7

Merged
elkaix merged 1 commit into
mainfrom
feat/lease-generations-and-attempt-history
Aug 13, 2026
Merged

feat: make lease and job-lock ownership generation-scoped#7
elkaix merged 1 commit into
mainfrom
feat/lease-generations-and-attempt-history

Conversation

@elkaix

@elkaix elkaix commented Aug 13, 2026

Copy link
Copy Markdown
Member

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-lease each 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

  • A failed lease release downgrades an otherwise successful loop or watchdog run to BLOCKED/11 instead of reporting completion over a retained lock.
  • STUCK 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 / 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 (held for) from the contender's wait window (wait_budget / wait_elapsed).
  • Companion status JSON is parsed from the status file rather than piped through stdin.

README.md and rules/orchestrator-implementer.md are 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.

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.
@elkaix
elkaix merged commit 4951409 into main Aug 13, 2026
1 check passed
@elkaix
elkaix deleted the feat/lease-generations-and-attempt-history branch August 13, 2026 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant