f358cb7363
Extend the deterministic merge driver's auto/claimed-merge contract to a
three-way symmetric mutex covering all auto-agents fleet workers, so the
merge driver, reviewer pool, and implementer pool stop racing on the same
PRs and orphaned claims are bounded by a TTL-based sweep.
Patch A — wrapper opt-in (7 files):
Add excludeClaimed: true to every list_prs_*.ts wrapper used by
pr-review-supervisor and implementation-supervisor. Reviewer /
implementer pools now never see PRs carrying any auto/claimed-*
label, closing the "comments on a mid-train PR" race.
Worker claim/release wiring:
pr-review-worker.md (Startup step 3 / 1800 s TTL) and
implementation-worker.md (Startup step 5 / 7200 s TTL, pr_fix only)
invoke claim_pr.ts at start-of-work and through a new "Release and
Exit" subsection at every termination path. Adds one bash permission
(npx --yes tsx*claim_pr.ts*) and one skill allow each.
Driver sweep coverage:
merge_drive.py grows ALL_CLAIM_LABELS and sweep_all_expired_claims;
sweep_expired_claims gains an optional label parameter (default =
CLAIM_LABEL, backward compatible). run_one_cycle exposes
swept_by_label per cycle so operators see per-label orphan rates.
Foreign labels are swept with an empty session-exclusion set because
the driver never owns them.
Tests:
Four new tests in tests/auto_agents/test_merge_drive.py covering the
parameterised sweep, the all-labels iterator, per-label sweep results,
and the ALL_CLAIM_LABELS <-> registry contract. Full auto_agents
suite: 176 -> 180 tests, 100% pass.
Docs:
- AGENTS.md: new "Tier 1 mutual-respect claim contract" subsection;
auto-* label registry rows for claimed-implementer /
claimed-reviewer updated to reflect new owners and sweep coverage.
- CHANGELOG.md: detailed Added entry under [Unreleased].
- docs/development/auto-agents-tier-2-3-plan.md: new plan capturing
deferred Tier 2 (shared claim-runtime module + deterministic
dispatchers) and Tier 3 (full deterministic drivers analogous to
merge_drive.py) with concrete deliverables and decision gates.
What this Tier deliberately does NOT do: replace LLM supervisor
sessions, change worker dispatch, or touch the actual review /
implementation logic. The supervisors still poll wrappers and dispatch
workers; the workers still do the real LLM work. Only the orchestration
bookkeeping around them gained a deterministic claim contract.
Co-authored-by: Cursor <cursoragent@cursor.com>