The fleet-wide pull-request sweeps act on a pull request without ever consulting the fleet-wide pr-<n> claim that exists to exclude a peer working it
Id: TD-PPagop-26082509 · Status: resolved · Filed: 2026-08-25 · Resolved: 2026-09-15 · Ref: #1547
lib/claim.sh’s PR-keyed file claim (pr-<n>, issue #238) is this system’s
one fleet-wide statement that a node is currently working a specific pull
request. The four finishing sources take it alongside their item claim in
agent-cycle.sh’s claim loop, precisely because an item claim excludes
nothing about a peer working the same pull request under a different item ref
— the failure that had three nodes on PR #205 at once.
The end-of-cycle sweeps never read it. Both of them act on other nodes’ live pull requests:
- 2.1e landing-retry (
_landing_retry_sweep_repo, TD-PPagop-26081701) re-enters_landing_stage_attempt’s seven gates for any open, non-draft,complexity:low|mediumpull request carrying a standing ApproverAPPROVED. None of the seven is a claim read, so it can arm an auto-merge on a pull request a peer node is at that moment pushing commits to. - The requirement-46 restale sweep (
_approver_restale_sweep_repo, agent-ops#682) launches a fullrun_approver_stageengagement — a real model call, and a real GitHub review — for any pull request whose standing ApproverCHANGES_REQUESTEDhas acommit_idolder than the head with a commit authored since. That state is not rare: it is exactly the window between an Implementer’s push and its own cycle’s Approver continuation, which is minutes-to-tens-of-minutes wide on everyreview-feedbackround the Approver itself triggered. Any peer whose cycle ends inside that window re-reviews a pull request already being reviewed.
The compounding case runs both sweeps in the one cycle, in the order the code
deliberately chose: the restale sweep re-reviews and approves, the
landing-retry sweep immediately after it finds exactly the standing-APPROVED
candidate it looks for, and the pull request is armed for merge while the
node that actually claimed it is still working — mid-fix, one commit of two
pushed. The human-veto gate does not help here, because in this path the
review being cleared is the Approver’s own, not a human’s.
The neighbouring sweeps justify their claim-free, fleet-wide duplication with
“two nodes sweeping at once cost nothing but a redundant read”
(agent-cycle.sh, 2.1d). That is true of the read-only sweeps it was written
about, and does not carry over to a sweep that spends model budget, posts a
review, or arms a merge.
Suggested fix: give the sweeps a claim read. lib/claim.sh claims <repo>
already lists a repository’s claims, and candidate_preclaimed already
answers “is this ref claimed” against such a listing — one lazily-fetched
listing per repository per sweep pass, consulted for pr-<n> before acting,
skipping (never failing) any candidate a peer holds. Skipping costs nothing:
both sweeps are idempotent and run again next cycle. Worth deciding at the
same time whether the restale sweep should also cap itself to one re-review
per cycle — it currently runs one full model stage per stale candidate,
serially, before the cycle reaches its own Co-Ordinator.
Noticed while reviewing PR #786 (agent-ops#682), which introduced the restale sweep; the landing-retry half of the gap predates it.
Migrated to https://github.com/Poetic-Poems/agent-ops/issues/987.