docs/spec/implementation/requirements/co-ordinator-01.md
Requirements
Section titled “Requirements”The Co-Ordinator (selection only)
Section titled “The Co-Ordinator (selection only)”-
Works read-only:
ghreads (runs, PRs, file contents viagh api) — it does not clone, and writes nothing but its final message. For thesecurityandcode-qualitysources it does not re-query the Dependabot/code-scanning APIs itself; it reads the pre-fetchedfindingsarray the Script attached to each repo (requirement 3a). Theissuessource likewise: its candidates are the pre-fetchedissuesarray (requirement 3j), threads included, and an empty array is a repo with no issue candidates, never issue data withheld. Thefailed-runssource has no array and never did — it is queried live, and “not pre-fetched” means “go and look”, not “skip”. The remainingghbudget goes on the cheap claim/blocked checks below and on reading what an item references. 14a. An issue is its whole thread, not just the opening post. Whenever it evaluates or selects a GitHub issue, the Co-Ordinator reads the body and every comment. Forissues-source candidates both arrive in the array entry (body,comments— verbatim); for an issue outside the array (one another item references, or a blocked issue the array’s filter dropped), it fetches the thread —gh issue view <n> --comments(orgh api repos/<slug>/issues/<n>/comments); a baregh issue view <n>orgh api .../issues/<n>returns only the body and silently drops the comments, where the parts that decide the work routinely live: added acceptance criteria, clarifications or corrections to the original ask, scope cuts, a “blocked”/“won’t do” note, or a maintainer turning a discussion into an actionable task. A later comment that contradicts the body is the current instruction; the body alone is never taken as the whole ask. -
One Co-Ordinator engagement per configured repository, launched in the walk order requirement 3 computes — not one engagement across every repository together (issue #587; before this, a single engagement’s
reposarray held every configured repository, and this requirement read “walks the repos in the order given”). Each engagement’s own runtime input’sreposholds exactly one entry — that repository’s own — and the engagement walks that repository’s own work sources in the configured priority order; it never sees another repository’s own data, and nothing in its runtime input names one. For “failed Actions runs”, a candidate exists only where the most recent run of a workflow on the default branch is a failure (a later green run supersedes older failures). Thesecuritysource’s candidates are the pre-fetchedfindingswithsource: "security"(Dependabot alerts and security-severity code-scanning alerts); thecode-qualitysource’s candidates are thefindingswithsource: "code-quality". Theproject-reviewsource’s candidates are the recommendations (R-NN) in the most recent folder under that repository’s own resolvedreport_directory(requirement 3k;reviews/project-review-YYYY-MM-DD/where the repository configures neitherrepository_review.repos[]‘s norrepository_review.defaults’ ownreport_directory) on the default branch: read that folder’s03-recommendations.mdand04-improvement-prompts.mdviagh api .../contents/...(no pre-fetch — these are ordinary tracked files, likeTECH-DEBT.md). A recommendation’s stable ref isreview-<review-date>-R-NN; the paired improvement prompt is the brief. Theissuessource’s candidates are the pre-fetchedissuesarray (requirement 3j), and it appears at four ranks rather than one, banded by each entry’spriority— see requirement 15e. Theimplementation-plansource’s candidates are the next unblocked task(s) in the repo’s own plan document, read at the path in that repo’s runtime-inputimplementation_plan_path(requirement 3k) — no pre-fetch, and no path named in the prompt. 15z. The Script reconciles the six cross-repository tiers itself, once every repository’s own engagement this cycle has answered (issue #587). Before the split, one engagement saw every repository at once and could judge “is repository Z’s security finding more urgent than repository A’s plain issue” directly; a per-repository engagement has no other repository’s candidates in front of it to make that judgement with.coordinator_merge_candidates(lib/stage-attempt.sh) takes every repository’s own returnedcandidatesarray, tagged by the Script with that repository’s own walk-order position (requirement 3) and that candidate’s own rank within its repository’s list, and sorts the merged whole by: the candidate’s tier (security, urgent issues, review-feedback, merge-conflicts, dequeued, abandoned-drafts, then every other source as one residual tier — requirements 15a/15e/15b/15d/15f/15c respectively), then repository walk order, then the candidate’s own rank within its repository. The residual tier is where requirement 3’s plain repository order alone decides between two candidates — landing-refusals, human-visibility, tech-debt,issues:high/issues:medium/issues:low, code-quality, and the three sources with no pre-fetched array collapse into it exactly because none of them carries a cross-repository tier of its own (requirement 15g), which is what stops a residual-tier source in a less-overdue repository from ever outranking one in a more-overdue repository the way a true tier’s own candidate does. The merged, reordered list is then capped tocandidates_max(requirement 17a) — the one enforcement of that bound that happens mechanically rather than by instruction, since no single engagement can cap a merge across repositories it never saw. 15y. An engagement that produces no verdict costs its own repository’s opportunity, and nothing else (issue #587). Each engagement writes its own stage transcript to<cycle-dir>/coordinator-<slug>.out(plus the.out.stderrand.stream.jsonlrun_model_stagederives from it), where<slug>is that repository’s configured slug with its/flattened to-— one flat file per repository in the cycle directory, never a path with a directory component in it, which nothing in the cycle creates and which would fail both of those redirections beforeclaudewas ever launched. An engagement that fails to launch, is killed, or returns an unparseable final message is recorded (requirement 21’sattempt-failed, andhandle_stage_failure) and the cycle moves to the next repository rather than exiting, since one repository’s failure must not cost every other repository this cycle’s own chance. Three consequences follow for the stand-down. The first two exist because a repository that was never successfully asked has established nothing about its own backlog; the third because a repository that answered without contributing a candidate has not accounted for its own backlog either, and so must be treated the same way:-
Where every engagement failed, the cycle exits exactly where the pre-split single attempt exited — before requirement 3v’s corroboration and before any
none-selectedis written at all. No repository is in the “said no” set, so corroboration would have nothing to check and would fall straight through to a stand-down the model never actually reported. A launch failure is typically node-wide (an API refusal, a usage limit, an image fault), so this is the ordinary shape of the failure rather than an exotic one. -
Where some engagements failed and the cycle still stands down, the
none-selectedevent omitsfingerprintand carriesengagements_failed— the count of engagements that produced no verdict. The fingerprint is a fleet-wide claim that every configured repository was asked and none had anything, which is what arms requirement 3b’s no-op short-circuit against the next cycle; a cycle that could not ask every repository has not established it, and must leave the short-circuit unarmed for the same reason requirement 3t’s rejected verdict does. The reason text names the shortfall too. -
A
"selected": trueengagement that contributes zero candidates is treated as an answered-falserepository, not as a selection. This is a distinct case from the two above — the engagement launched, parsed, and answered — but atrueverdict whosecandidatesarray is present and empty is a contract violation the engagement itself should never produce (requirement 20’s single-selection grace, for the no-candidates-array shape, always contributes exactly one candidate, so this can only be an explicit empty array). Trusting the verdict at face value would leave this repository out ofcoord_false_repo_slugs_jsonwhile it contributed nothing to the merge: requirement 3v’s corroboration is scoped to that set, so this repository’s own eligible items would be checked by nothing, and — if every other repository was likewise empty or genuinely had nothing — a fleet-widenone-selectedcould arm the no-op fingerprint against a backlog this repository’s own answer never actually accounted for. The Script folds it intocoord_false_repo_slugs_jsoninstead, with a reason naming the contract violation, exactly as an honest"selected": falseis. 15b. Review feedback comes third, across repositories. Like security and urgent issues, this outranks the plain source walk: any selectablereview_feedbackcandidate in any repository is taken before any work below it in another — reconciled by the Script (requirement 15z) rather than judged by any one engagement, which sees only its own repository’sreview_feedbackarray. The human is this system’s only consumer and its scarcest resource; when they have spent their time and asked for something specific, answering beats starting something new — and the work is already 90% done. The Co-Ordinator must not apply requirement 16’s claim exclusion to this source: the open PR is the item, and excluding it makes every candidate permanently unselectable while looking entirely correct. 15d. Merge conflicts come fourth, across repositories. After security, urgent issues and review-feedback, and likewise outranking the plain source walk: any selectablemerge_conflictscandidate in any repository is taken before any fresh work in a more-overdue one — reconciled by the Script (requirement 15z), the same as review-feedback. The PR is otherwise ready to land, and until the conflict is resolved nothing else on it can proceed, so a rebase-and-resolve is finishing, not starting. As with review-feedback, the Co-Ordinator must not apply requirement 16’s claim exclusion to this source — the open PR is the item, and the pre-fetch (requirement 3g) has already established it is ours and conflicting. The Implementer’s job here is narrow: rebase onto the base and resolve the conflict, without completing or re-doing the underlying item (that is what merges the PR, and remains this repository’s own landing decision — see “The Landing Gate” — not the Implementer’s to make). A Dependabot takeover candidate (requirement 3s) ranks and is exempted from requirement 16’s claim exclusion here identically, even though it is, unlike every othermerge_conflictscandidate, genuinely new work — a fresh PR on a fresh branch, not a finish of an existing one, and it does raisemax_open_agent_prs’ count by one once claimed (Dependabot’s own PR never counted toward it; the replacement does, until it merges or is closed). This is a deliberate simplicity trade-off, not an oversight: a takeover is rare (it fires only after a nudge has already failed to clear the conflict) and routing it through a second source or a back-pressure carve-out of its own would be exactly the new ledger/escalation concept the feature was built without (issue #250’s acceptance criteria). 15f. Dequeued pull requests come fifth, across repositories. After security, urgent issues, review-feedback and merge-conflicts, and likewise outranking the plain source walk: any selectabledequeuedcandidate in any repository is taken before any fresh work in a more-overdue one — reconciled by the Script (requirement 15z), the same as review-feedback and merge-conflicts. The PR was otherwise ready and something had already committed it to landing, and until the merge-group’s own checks failure is fixed it cannot be re-queued, so a diagnose-and-fix is finishing, not starting, for the identical reason merge-conflicts ranks where it does. As with review-feedback, the Co-Ordinator must not apply requirement 16’s claim exclusion to this source — the open PR is the item, and the pre-fetch has already established it is ours, dequeued and actionable. 15c. Abandoned drafts come sixth, across repositories. After security, urgent issues, review-feedback, merge-conflicts and dequeued, and likewise outranking the plain source walk: any selectableabandoned_draftscandidate in any repository is taken before any fresh work in a more-overdue one — reconciled by the Script (requirement 15z), the same as the four tiers above. A previous cycle already implemented most of the work behind that draft, so finishing beats starting; and every cycle it sits stalled it holds a back-pressure slot that throttles new work fleet-wide. As with review-feedback, the Co-Ordinator must not apply requirement 16’s claim exclusion to this source — the open draft PR is the item, and the pre-fetch (requirement 3e) has already established it is stale and ours, so treating it as a claim would make every candidate permanently unselectable. 15g. landing-refusals and human-visibility carry no cross-repository tier of their own, unlike the six sources requirements 15a/15e/15b/15d/15f/15c name — each is selectable only when its own repository’s ordinary source walk reaches its configured rank there, and requirement 15z’s merge leaves both in the residual tier alongside tech-debt, the three lower issue bands and code-quality: two candidates from that tier, from two different repositories, are ordered by repository walk order alone, never by which of the two sources either one is. 15a. Security is always prioritised. Within a single repository, a candidate is security-related if it is asecurityfinding, a GitHub issue labelledsecurity/vulnerability, a tech-debt entry flagged as a security concern, or aproject-reviewrecommendation whose text flags a security concern — and the repository’s own engagement ranks any such candidate ahead of every non-security item it returns, most severe first where severity is known (the pre-fetchedfindingsarray arrives already sorted that way). Only the first of those four kinds carries that priority across repositories: the Script’s own reconciliation (requirement 15z) gives global tier 0 to a candidate only whensource == "security"(a Dependabot alert or a security-severity code-scanning alert) — a security-labelled issue, a security-flagged tech-debt entry, and a security-flagged project-review recommendation remain security-related within their own repository’s own ranking, but carry no cross-repository tier of their own: the merge places each at whatever tier its own source and band would have earned it with no security flagging at all — requirement 15g’s residual tier for a tech-debt entry, aproject-reviewrecommendation or aHigh/Medium/Lowissue, and requirement 15e’sUrgenttier for an issue the organisation marksUrgent. Within global tier 0, the merge breaks a tie between two different repositories’ ownsecuritycandidates by repository walk order (requirement 3) alone — an approximation of “most severe fleet-wide” the same way requirement 15e’sUrgentbullet documents for issues: a repository’s own findings are sorted most-severe-first before the Script ever sees them, but the merge does not itself compare severity across repositories once every engagement has answered. 15e. Issues rank by theirPriorityfield. An open issue’s band is its organisation-levelPriorityissue field —Urgent,High,MediumorLow— and the band is the issue’s rank in the walk, asissues:urgent/issues:high/issues:medium/issues:lowin the repo’s configuredsources: -
Urgentis a global tier, second only to security. Like review-feedback, merge-conflicts, dequeued and abandoned-drafts, it outranks the plain source walk: if any selectable urgent issue exists in any repository, it is taken before any non-security item anywhere — including ahead of the four finishing sources — reconciled by the Script (requirement 15z) exactly as those four tiers are: an engagement ranks its own repository’s urgent issues by age among themselves (oldest first), and the Script’s merge breaks ties between two different repositories’ own urgent issues by repository walk order, an approximation of “oldest first” fleet-wide that no per-repository engagement could otherwise make without seeing another repository’s own issue dates. Those tiers exist because finishing beats starting;Urgentis the one signal that outranks even that, because it is the human stating outright that this cannot wait, and a top band that still queued behind four other tiers would not mean what it says. It cannot starve the finishing sources either: back-pressure (requirement 2.2a) narrows the cycle to exactly those four oncemax_open_agent_prsis reached, and that gate is applied to the runtime input before the Co-Ordinator sees it. -
Highsits between failed-runs and tech-debt in the per-repo walk. Below a red default branch, which is repo-wide breakage that blocks every other item’s checks; above tech-debt, which is by construction work that was already judged deferrable. -
Mediumsits between tech-debt and the implementation plan — exactly where the unbandedissuessource ranked before this requirement existed. -
Lowsits between project-review and code-quality: still a human’s filed, deliberate request, so above the automated quality suggestions, but below the review recommendations a human approved without marking them least-pressing.
An issue with no
Priorityset isMedium. The default is not “unranked” and never “lowest”: an untriaged backlog must behave exactly as it did before banding existed, so that setting the field is what moves an issue and leaving it alone changes nothing.The band arrives on each pre-fetched entry as
priority, derived by the Script (requirement 3j) fromissue_prefetch_open_issues’s GraphQL walk (lib/issue-prefetch.sh, agent-ops#1085; a REST issues-endpoint read before it), whose payload carriesissue_field_values; the band is thesingle_select_option.nameof the entry whoseissue_field_nameisPriority.gh issue view --jsondoes not expose issue fields, which is why neither surface this can come from is that command. Anything that is not one of the four names — absent, empty, unreadable by this token, or a value the organisation added later — isMedium, which keeps an unrecognised or invisible field a no-op rather than a re-ranking.Banding changes rank and nothing else. Within a band, candidates are evaluated oldest issue first, and every other rule that applies to an issue applies unchanged: requirement 14a’s whole-thread read, requirement 16’s exclusions, requirement 15a (a
security-labelled issue is security work whatever its band, including aLowone), the bare issue number as the item ref, and"source": "issues"in the work order (requirement 21) — downstream consumers never see the band.An entry’s
prioritymay already be raised above what it was triaged to (priority inheritance, agent-ops#2422, requirement 34j): an open item that blocks another — named in a same-repoBlocked-by:reference on the blocked item’s own thread — ranks at least as high as the highest band among every item it blocks, whichever ofissues/tech_debteither one is in. This runs once, upstream of the Co-Ordinator’s own input (issue_priority_inherit,lib/dependency-gate.sh), so the walk above reads the raised band exactly as it would a band a human stated directly — a raised entry additionally carriespriority_raised_by, naming what it blocks, informational only. Tech-debt (requirement 3t) is not split into four walk ranks the wayissuesis here — it occupies one slot in the per-repo walk regardless of band — but its own candidates are ordered by this samePriority, then by freshness, the identical inheritance included. -
-
Excludes from candidacy any item that is:
-
recorded as blocked in the shared log (an
attempt-failedevent not followed by anunblockedevent for that item) — for a GitHub issue, only once requirement 18a’s mandatory re-check, where it applies, has found the recorded blocker still holds — or recorded as void (anitem-voidevent not followed byunvoided), which has no re-check to preserve for any source. Forfindings,review_feedback,abandoned_drafts,merge_conflicts,dequeued,human_visibilityandtech_debt, both halves are already applied deterministically by the Script (requirement 3u) before the runtime input is assembled — there is nothing left here for the Co-Ordinator to check for any of those seven sources.issuesgets the same treatment for its void half and for a stale blocked entry; only a blocked issue carrying evidence fresh enough to warrant requirement 18a’s live re-check ever reaches the Co-Ordinator; -
a tech-debt item that is assigned, labelled
blocked, names an unresolvedBlocked-by:dependency (requirement 34j), or is labelledpw::pager(agent-ops#2564) — the same four deterministic drops theissuesbullet below describes, applied byscripts/gather-tech-debt.shbefore the runtime input is assembled (requirement 3t); -
already referenced by any open PR or draft (a claim, per the repos’ claiming workflow), or its repo+item appears in the pre-fetched
claimedarray (requirement 3o) — a peer node’s claim, by either shape, even one that has not yet surfaced as a draft PR; the Script’s own atomic claim in requirement 17a is the hard gate, this exclusion merely avoids proposing work that will lose the race. Unlike the open-PR half, there is nothing to check live here:claimedis exhaustive over both a registry entry and a liveagent/<item-ref>branch, already age-filtered toclaim_ttl_hours, so an entry present excludes and an entry absent (or aged out) does not — for asecurity/code-qualityfinding, that means an open PR whose branch or body already references the same alert (ref, alert URL, or the affected package/rule); for aproject-reviewrecommendation, an open PR whose branch or body references its ref (review-<date>-R-NN); for the five sources that finish an existing pull request, whose own scoped item refs would otherwise dodge this bullet’s repo+item lookup, requirement 3p has already dropped any candidate whosepr_numbermatches a peer’s claim fromreview_feedback,merge_conflicts,dequeued,landing_refusalsandabandoned_draftsbefore this runtime input was assembled — there is nothing left in those arrays for this exclusion to apply to, deterministically, rather than a comparison added to this judgement call; -
a
project-reviewrecommendation that is already done — a merged PR references its ref (review-<date>-R-NN) — or that is already owned by a higher-priority source: the review files debt-shaped recommendations aspw::type:tech-debt-labelled issues cross-referencing theR-NN(docs/spec/review/requirements.md, R12/R12a), so a recommendation cross-referenced by such an issue — or by a current tech-debt entry a repository’s own register still carries — is left to that source and skipped here. (A singleghPR search per repo for the review date surfaces the open/merged/closed PRs referencing that review; match refs against it.) Note that a merged PR is a floor, not a proof: work that landed as a direct commit, or before the repo required PRs, leaves no PR to find and so reads as outstanding forever. The cross-reference is what covers that gap, which is why the review spec (docs/spec/review/requirements.md, R12a) is required to write it and not merely expected to; requirement 9a is the backstop for when it is missing anyway — the item is then investigated once, and the finding remembered. -
an issue that is assigned, labelled
blocked, names an unresolvedBlocked-by:dependency (requirement 34j), labelledpw::pager(agent-ops#2564 — a Pager tracking issue is pager-owned, never ordinary selectable work), or is a question or discussion rather than actionable work — the first four are deterministic and already applied by the Script (requirement 3j drops them from theissuesarray before the Co-Ordinator sees it, and reports each drop and its reason inissues_excluded, below); the judgement half is the Co-Ordinator’s, over the whole thread (requirement 14a), since a comment can block, close, re-scope, or answer an issue that its body alone would make look selectable.The dependency third is never the Co-Ordinator’s to re-derive, and the Script refuses it if offered anyway (agent-ops#566). An issue reaching the Co-Ordinator has, by requirement 3j’s own construction, no unresolved
Blocked-by:reference — but a stale sentence can still sit in its thread after the reference it named has closed, and a model reading that thread can reach for the sentence rather than the fact that the item is in front of it at all. Requirement 34e’s recorder refuses aneeds_refinemententry, from any reporting stage, whose ownreason/missing/evidencenames, by its issue number, the same dependency this cycle’s own dependency gate (requirement 34j) already proves resolved for that item’s thread: no block is recorded, no labels applied, and the refusal is logged — the item is left exactly as unaccounted-for as if nothing had been reported (requirement 3x), so it is not silently closed off by a report that never engaged with it. The judgement half above is untouched by this: a report declining an issue as a question or discussion, or for genuine under-specification, names no such reference, so it is recorded exactly as requirement 34e describes.The assignee exclusion is a permanent, deliberate rule, not an incidental side effect (agent-ops#447). It is load-bearing for the Enabler’s escalation protocol: requirement 36a assigns every escalation issue to
enabler_assigneeprecisely so that this exclusion keeps the pipeline from ever selecting its own request for human help as if it were work, and the config-time guard next toenabler_assignee(Configuration table) exists only because an unassigned escalation would defeat it. A human’s own, unrelated assignment to themselves is read exactly the same way: an issue somebody has claimed by hand is theirs to work, not the pipeline’s, and the rule does not distinguish the two — an assigned issue reaching this exclusion is always either one of those, never the pipeline’s own bookkeeping (agent-ops#639: the only bookkeeping assignment this pipeline ever made — requirement 38b’s, below — was retired in favour ofblocked/blocked:<reason>labels precisely so this exclusion would no longer need to tell the two apart). The rule therefore stays a hard exclusion, and stays permanent: it is not eligible for the Co-Ordinator’sneeds_refinementunder requirement 16a, which is scoped to items reached and evaluated in this cycle’s own priority walk — an assigned issue is dropped before that walk ever sees it, so there is nothing for the Co-Ordinator to report a judgement about.What was missing was never the rule — it was visibility into when a projection outlives its own reason. Requirement 38b’s label pair is meant to be temporary, self-removing the moment its block clears (
release_refinement_label), but a removal that fails (aghcall that does not take) can leaveblocked/blocked:needs-refinementon an issue whose block has already cleared — readable only by a human already suspicious enough to read the filter’s own source. Before agent-ops#639 the equivalent failure was on the assignment, and sat unnoticed for two days on agent-ops#338 before it was fixed by hand; moving the projection to labels does not remove the possibility of a failed removal, only the invisibility, since a strayblocked/blocked:<reason>label is exactly as visible on the issue as the one a human applies by hand.issues_excluded(requirement 3j) is the general fix for a stuck exclusion, whatever put it there, and a reporting one deliberately, not a relaxing one — narrowing the exclusion would only let the pipeline pick up exactly the escalation and refinement-tracking issues it exists to keep off the list. A liveissues_excludedentry on the Co-Ordinator’s own input whose most recentissues-excludedevent (requirement 33) is old is now the signal a human needs to notice a stuck removal and clear it by hand — a reading requirement 33’s own unknown-skips rule protects: a cycle whose gather failed or degraded leaves that event untouched rather than logging a fabricated change, so a transientghhiccup does not refresh the timestamp and hide a genuinely stuck exclusion behind it; -
a security finding whose only available fix is one a human must choose (e.g. a Dependabot alert with no non-breaking upgrade, needing a major version bump that changes the repo’s public behaviour) — flag it, don’t guess the upgrade;
-
dependent on a product or architecture decision that has not been made. (Example: poetic-fiddle’s milestone M2 is gated on the §6.1 packaging decision in its implementation plan — while that decision is open, M2 tasks do not meet the bar. Decisions belong to the human; never attempt to make one.)
The last two exclusions, and requirement 17’s “if in doubt, skip it”, are reported rather than acted on silently — see requirement 16a. 16a. Under-specified and decision-gated skips are reported, not silent. The Co-Ordinator’s final message carries an optional
needs_refinementarray, alongsideunblockedandvoided, whose entries are{repo, item, source, reason, missing, evidence}:reasonis one line on why the item fails the selection bar,missingis what a selectable version would need (acceptance criteria, a scope bound, a named decision, reproduction steps), andevidenceis what the Co-Ordinator actually read.An item qualifies only if it was reached and evaluated in this cycle’s own priority walk and failed selection solely because it is too under-specified to rank against requirement 17’s bar, because it is gated on an unmade human decision (the last two exclusions of requirement 16), or because it is an issue that is a question or a discussion rather than actionable work (requirement 16’s issue exclusion, judgement half). Items excluded for any other reason — claimed, already blocked, void, assigned — are not reported: they are already handled, and reporting one would re-block an item whose clock is already running.
The question-or-discussion case was itself on that not-reported list until requirement 3x, and being there was an error of exactly the kind the paragraph below describes. The other four are all cases where something else already recorded the item: a claim, a block, a void, an assignee. Nothing records a question. No clock runs on it. It is re-read and re-skipped every cycle, forever, and it is the one issue exclusion the Script cannot decide for itself (
scripts/gather-issues.shapplies the other three; this one “cannot be a jq filter”), so it is also the one whose silence requirement 3x’s corroboration would otherwise have to be blind to. Reporting it makes the judgement a record: the Enabler can adjudicate it (requirement 35a), a human sees the label, and the band becomes corroboratable like every other.Three limits keep it side-work. The Co-Ordinator must not sweep for under-specified items beyond the walk it was doing anyway (flags accumulate across cycles by themselves, and a sweep would spend a selection pass on something nobody asked for); it must not re-report an item already recorded as blocked — ordinarily requirement 16’s first exclusion means it is never re-evaluated at all, and where requirement 18a’s mandatory re-check does look at one again, that re-check is scoped to whether the recorded blocker still holds and is never grounds to re-report
needs_refinement; requirement 34e refuses the re-report regardless, if it happens anyway; and reporting never changes what the cycle selects. An empty array is the normal case.What this replaces is a silent skip, and the silence was the defect. An item nobody had specified was re-read and re-skipped by every cycle for as long as it existed: the pipeline paid to rediscover the same non-answer cycle after cycle, the item never became selectable by any route, and the one person who could have written the missing criteria was never told it existed. The pipeline looked healthy throughout, which is this system’s signature failure mode (requirement 3b, requirement 34d) in its purest form — an item that starves while every component behaves exactly as specified.
-
-
From the remaining candidates, ranks the qualifying items best-first and returns up to
candidates_maxof them, each a stand-alone unit of work, clearly scoped, and adequately refined; the ranking preserves the priority walk, and the alternates exist because a peer node may win the claim on the first choice — not to lower the bar. Do not guess: if in doubt about an item, skip it — and report it under requirement 16a rather than skipping it silently. If nothing in the current category qualifies, fall through to the next category, then the next repo. Only after exhausting all repos does it return{"selected": false}with a one-line reason. -
A refined item is selected on what the refinement says. Where requirement 3h’s
refinementsmap names an item the Co-Ordinator is putting in a work order, an entry carrying aspecis carried into the work order’scontextverbatim — it exists nowhere else, and the Implementer starts with nothing but the work order, so a summarised refinement is one that was written by an expensive model and read by nobody. Forproject-reviewandimplementation-plan— the two sources that still carry aspecand whosecontextthe Co-Ordinator still authors itself (requirement 17h) — the Co-Ordinator pastes it; fortech-debt, requirement 17h’s own compose step splices it in unconditionally instead, since the model no longer authors that source’scontextat all. An entry carrying acomment_urlneeds no special handling: the refinement is a comment on the item’s own issue, which requirement 17h’s live read (forissues/tech-debt) or requirement 20’s own paste instruction (for the sources that still have one) already carries in full, and requirement 14a already makes the latest contradicting comment the current instruction. 17f. The Script verifies traceability before claiming, rather than trusting the model’s own account (agent-ops#626). A work order composed alongside others in the same Co-Ordinator engagement can carry one candidate’scontext/acceptancewhile actually holding another item’s refinement content — the response is syntactically fine and each candidate individually plausible, so nothing catches the cross-item swap until an Implementer, handed nothing but the mismatched work order, finds it incoherent and burns the item’s one refinement-per-human-touch allowance re-flagging a fault the item never had.refinement_traceability_fault(lib/candidate-select.sh) closes this the only way that does not depend on the model getting it right a second time: for each ranked candidate of a model-composed work order, in claim order, before requirement 17a’s claim is attempted, it re-derives the item’s own recorded refinement fromrefinements— keyed on that candidate’s ownrepo/item, never on anything the candidate itself claims — and confirms it is genuinely present, after normalizing whitespace (TD-PPagop-26082307: collapse every run of whitespace to a single space and trim both ends, on both sides of the comparison), in that candidate’s owncontextoracceptance. A model’s paste of a multi-kilobyte spec or issue thread drifts in exactly this way — a reflowed line, a normalized list marker, a trimmed trailing space — without changing what it says, and normalizing tolerates all of that while still failing a passage that is genuinely missing or different;TRACEABILITY_DEBUG=1logs, to stderr, the normalized haystack/needle a comparison actually ran against, never required to diagnose a failure, only to see it directly.- A
specentry (requirement 64) costs no extra read: the text is already inrefinements, so its presence incontextis checked directly. - A
comment_urlentry (requirement 64) is checked in two stages. First, free: the issue number embedded in the URL itself must equal the candidate’s ownitem— a comment_url naming a different issue is a fault regardless of what the work order says, and catches a corruptedrefinementsentry as readily as a model that ignored a correct one. Second, onegh api repos/<repo>/issues/comments/<id>read of the actual comment (the pre-fetchedcommentsarray on a repo’sissuesentry carries no per-comment id to join against, so this is the only way to know the comment’s real text) — a fault if that text, normalized the same way, is present in neithercontextnoracceptance. The comment id itself is extracted byrefinement_comment_url_id(lib/refinement.sh, the same predicate requirement 39c (The Refiner)’s recording seam and requirement 35a’s reading seam both test a comment URL’s shape against), which recognises the HTML permalink anchor (#issuecomment-<n>) and the REST API form (.../issues/comments/<n>) alike (TD-PPagop-26082603) — acomment_urlmatching neither shape is now a fault too, reported the same way the structural (wrong-issue) check above is, rather than the pre-fix behaviour of a baresedextraction that recognised only the HTML form and silently returned “no fault” for anything else, having tested nothing at all. A model-typed prose citation is checked too, independent of what is on record (agent-ops#1027). The two checks above validate the recordedrefinements[repo][item]entry; neither reads theRefinement:-style citation requirement 64 has the Co-Ordinator paste into the work order’s owncontext/acceptanceprose. That citation is text the model wrote, not anything the Script maintains, so it can name the wrong issue’s comment even when the recorded refinement is correct, or when there is no recorded refinement for the item at all — agent-ops#876’s work order cited agent-ops#911’s own comment 5452331924 this way: a real, well-formed comment, just posted on a different issue.refinement_traceability_faultscanscontextandacceptancefor everyissues/<n>#issuecomment-<id>URL they contain — any repo-qualified or bare form, the same shape the structuralcomment_urlcheck above already extracts — and faults the candidate the moment one names an issue other than its ownitem. This needs noghcall, runs before either check above, and is not scoped to an entry existing inrefinementsat all. Like the structuralcomment_urlmismatch above, it is never repaired:refinement_traceability_repaironly ever appends text, so a wrong citation the model already wrote stays incontext/acceptanceverbatim after repair and this check faults it again — a hard skip, not a repair candidate. It is, however, scoped to anitemthat is itself an issue ref (a bare number): “this citation names a different issue than the item” is a comparison that means something only when the item is an issue. Every other item ref a candidate can carry is a source’s own composite key — aproject-reviewrecommendation’sreview-<date>-R-NN, afailed-runsworkflow’sfailed-run-<basename>, animplementation-plantask — so without that scope the check would report a mismatch for every citation those sources’ work orders carry, by construction rather than by fault: they are the three sources this function is reachable for at all (the 17h note below), the three whosecontextrequirement 64 has the Co-Ordinator make self-contained by pasting related text verbatim, and the only ones a recordedspecis ever written for — which the repair half below appends tocontextitself, so an unscoped check would fault the Script’s own append and leave a freshly refined item permanently unclaimable. A failed check is repaired, not discarded (agent-ops#767). The requirement is that the work order carry the item’s refinement — not that the model be the one who carried it — and the Script is holding the text at the moment it asks. Sorefinement_traceability_repairappends the recorded refinement verbatim tocontext, under a heading naming it as the Script’s own insertion, and the candidate proceeds to its claim; the repair is logged aswork-order-repairedcarrying the fault it answered. Traceability becomes true by construction, which is a stronger guarantee than any check of a model’s compliance and one no model can fail.
That this is the right half to enforce was settled in production. Between the check landing (2026-08-22T23:42Z) and the repair, it discarded 92 candidates across 20 issues on four nodes and admitted none — while
coordinator_modelwasclaude-haiku-4-5-20251001and the bands feeding it were being trimmed to fit that model’s window, so the text it was required to paste had in some cycles already been trimmed out of what it was given. The fleet selected no issue-sourced work for fifteen hours. A gate with no observed passes is not a gate.Two faults are never repaired: a
comment_urlwhose embedded issue number disagrees with the candidate’sitem, and a model-typed prose citation (agent-ops#1027, above) that names a different issue. Both are a corrupt record or a copying failure the model already committed to text, not something appending a correct refinement alongside can fix, and appending another issue’s refinement to this item’s order is precisely the cross-item swap this requirement exists to prevent. Both stay a hard skip, and neither spends aghread to reach that verdict.A candidate whose fault the repair cannot answer is skipped without a claim attempt — logged as
claim-skippedwithcause: "untraceable"and adetailnaming what disagreed — exactly as a pre-claimed candidate is skipped, so a peer’s later ranked candidate still gets a chance this cycle. Such a skip is counted in its own right: a cycle that loses every candidate this way stands down withcause: "untraceable"and a reason naming the check, neverraced. It reportedracedwithrace_losses: 0for the whole of the fifteen hours above, sending every reader after a claim contention that did not exist, which is why the cause is now counted separately from both the pre-claimed skips and the race losses. An item with norefinementsentry at all costs nothing: the check returns immediately with noghcall. Aghread that fails (network, rate limit) is itself a fault (TD-PPagop-26082307), reported the same way as a mismatched paste —cause: "untraceable", retried next cycle — and surfaced viaguard_warnrather than swallowed. This is the one place this requirement’s ownghread departs from every other degradedghread in this pipeline’s fail-open convention: those read a fact about GitHub’s availability, but this check exists to gate a claim on a refinement really being present, and assuming pass on a read it could not complete means a token going bad, a narrowed scope, or a sustained rate limit silently disarms the whole gate, indefinitely, while it keeps reading as green — exactly the failure mode this item’s own repair (agent-ops#767, below) exists to prevent for the opposite direction. A refinement that cannot be read cannot be repaired either, so a candidate faulted this way is a hard skip, same as a corruptcomment_url.A fallback selection (requirement 3v) is not checked.
contextthere is composed byfallback_select_candidatein jq, out of the very band entry the candidate names, so one item’s refinement cannot reach another item’s work order; and that composition draws on the item’s own record rather than onrefinements, so a spec-refined item picked mechanically carries no verbatim spec and would fault every time. The fallback’s candidate list is one candidate long, so that fault would leave the cycle with nothing to claim — disarming the path requirement 3v exists to provide precisely when the model will not select.Since requirement 17h (agent-ops#769), this check’s own reachable scope has narrowed to the three sources whose
context/acceptancethe Co-Ordinator still authors itself —project-review,failed-runs,implementation-plan— and this includes the model-typed prose-citation check above (agent-ops#1027): it is folded into the samerefinement_traceability_fault, called at the same guarded site, so it is exempted for the identical reason — a requirement 17h compose replacescontext/acceptancewith a live read before this function ever sees the candidate, discarding whatever prose citation the model wrote along with everything else it authored. Read with that check’s own issue-ref scope above, this leaves it a latent guard rather than one the ordinary cycle exercises: none of those three sources keys its items on an issue number, so the citation comparison is live only for a candidate that reaches the claim loop naming nosourceat all — the one shape a requirement 17h compose is not attempted for. Every other source’s candidate is composed by requirement 17h before it ever reaches this check (c_composedin the claim loop), which callsrefinement_traceability_repairunconditionally as part of composing — so the splice this requirement exists to verify has already happened, by construction, before this check would run. This is the same exemption a fallback pick already had, generalised: neither a fallback pick nor a requirement 17h compose can hold another item’s refinement, because neither ever readsrefinementsfor anything but the one item it is building. - A
-
No check verifies a trimmed candidate’s
acceptanceagainst the item’s own live text — requirement 17h’s compose step removed the condition such a check would exist to catch. Between agent-ops#821 (issue #815) and agent-ops#1156, this requirement specifieditem_text_fault/item_text_supply(lib/candidate-select.sh, backed by anitem_live_textfetch and a_span_is_quotableshape test): a trimmedissues/tech-debtcandidate’sacceptancewas checked, its backtick-quoted spans against a fresh live read, because a Co-Ordinator running on the fleet’s cheapest model against fit-ladder-trimmed input could invent a specific an Implementer would then trust as the item’s own (cycle 20260826T064910Z-poetic-1-186841, issue #815’s incident).Requirement 17h (agent-ops#769) removed the condition instead of leaving a check to keep catching its failure: every
issues/tech-debtcandidate’scontext/acceptance/titleis now composed by the Script itself, from a live read, immediately before the claim — never from the model, and never from a trimmed extract. Nothing reaching the claim loop from either source can any longer be a model’s paste of a possibly- trimmed extract, so there is nothing left for a check built to catch exactly that failure mode to intercept:coordinator_fit_trimmed_items’s own output — the scope both retired checks were gated on — could no longer contain a candidate that reached them un-composed (c_composedin the claim loop) from the moment requirement 17h landed (6a4eaa4, 2026-09-06T03:45:52Z). TD-PPagop-26090604 is the record of that gap opening; agent-ops#1156 is where it closed, once requirement 17h’s own compose step had run in production long enough to trust it was not itself regressing into the fabrication or incompleteness failure modes this requirement used to catch (an owner decision on agent-ops#1156, 2026-09-11, resolving escalation #1333: the soak was judged over).item_text_fault,item_text_supply,item_live_textand_span_is_quotableno longer exist inlib/candidate-select.sh; the claim loop no longer counts afab_faultsskip or stands down withcause: "fabricated". A cycle whose every candidate fails traceability now stands downuntraceableregardless of whether requirement 17f’s own check or requirement 17h’s compose step produced the fault, since there is no second, narrower cause left to distinguish one from the other. Requirement 17f’s fail-closed refusal on an unreachableghread, and requirement 17h’s own fail-closed refusal on a failed live fetch at composition (folded intocause: "untraceable"), are both unchanged by this retirement — neither depended on the checks that were removed. 17h. The Script composescontext/acceptance/titlefor a Co-Ordinator selection, from a live read or the pre-fetched band entry — never from the model, and never from a trimmed extract (agent-ops#769, resolving the escalation at agent-ops#844 with option (b)). Requirements 17f/17g exist because the Co-Ordinator runs on the fleet’s cheapest model (coordinator_model,claude-haiku-4-5-20251001) against input the fit ladder (requirement 4i) may already have trimmed, and are asked to reproduce kilobytes of that input verbatim — a task requirements 17f/17g could only ever catch failing after the fact. This requirement removes the task instead of catching its failure: for the ten sources the Script already gathers as structured data (security,code-quality,review-feedback,merge-conflicts,dequeued,landing-refusals,abandoned-drafts,human-visibility,tech-debt,issues), the Co-Ordinator selects{repo, source, item}and the Script itself buildscontext,acceptanceandtitleimmediately before the claim (compose_selected_candidate_text,lib/candidate-select.sh) — the model authors neither field for these sources. The three sources the Co-Ordinator still derives itself live —project-review,failed-runs,implementation-plan— are unaffected: they have no pre-fetched band for the Script to compose from, and were never subject to the fit ladder’s trimming in the first place, so this requirement does not reach them and the Co-Ordinator still authorscontext/acceptancefor them exactly as requirement 20 describes.-
A live read for the only two trimmed bands, the pre-fetched entry for the rest.
issuesandtech-debtare the only bands the fit ladder (requirement 4i) ever trims, so these two are rebuilt from a fresh live read (item_live_entry) every time they are selected, whether or not this particular cycle actually trimmed them — a work order’scontextmust never depend on the band entry’s freshness at all, not merely recover when it happened to be visibly short. That read is two calls, and the split is load-bearing:gh issue view --json title,bodyfor the title and body, and the paginated REST comments endpoint (gh api repos/<slug>/issues/<n>/comments --paginate) for the thread, nevergh issue view‘s own--json comments— that GraphQL field returns only the first ~100 comments and does not paginate, so composing from it would have capped this requirement’s “body and every comment” guarantee at a ceiling it never declares and a longer thread would lose its tail silently, exactly where a clarification or a scope cut tends to sit (agent-ops#1012). The composedcontexttherefore carries the whole thread at any length. Tech-debt has been a GitHub issue carryingpw::type:tech-debtsince the register’s D15 migration, so it is fetched identically to anissuesentry. The other eight sources’ band entries are never trimmed at all (the fit ladder’s own scope, requirement 65 above), so the Script composes directly from the entrycoordinator_eligible_itemsalready located for this candidate’s own{repo, source, item}— a lookup, not a second fetch. -
The per-source template mirrors
fallback_select_candidate’s own (requirement 3v) — the working precedent this requirement generalises from a last-resort mechanical pick to the ordinary selection path, keeping the same wording so a work order reads the same regardless of which path produced it. A Dependabot takeover (merge-conflictswithbot/rebase_requestedboth true) is templated on its own terms — naming the replacement pull request and the bot’s own closure — never the ordinary rebase instruction, since a takeover is fresh work on a new branch, not a finish of the existing one.tech-debtis the one source whose wording deliberately departs from the fallback’s: the fallback reduces a tech-debt entry to itsbodyalone, having only the band entry to compose from, where this requirement’s live read holds the whole issue thread — so it is composed through the same body-and-every- comment shape asissues, and itsacceptancenames the current state of that thread rather than the record as originally filed. A clarification or scope cut left in a tech-debt issue’s comments is exactly the text this requirement exists to stop losing. -
The recorded refinement is spliced unconditionally, generalising agent-ops#767.
refinement_traceability_repair— the repair half of requirement 17f — is called on every freshly composed candidate, always, rather than only after a fault check finds one missing: there is no model-authored text left to fault, so the one way a refinement ever reaches a Script-composed work order now is this unconditional splice. -
A failed live fetch is fail-closed, folded into
cause: "untraceable"(requirement 17f’s own cause), not a fallback to the trimmed or stale entry. So is a candidate naming an{repo, source, item}this cycle’s own gather (ordered_repos_json) no longer contains — a stale or malformed candidate the Co-Ordinator should never have named. Both skip the candidate exactly as an unrepaired requirement 17f fault does: the next-ranked candidate gets the slot, and a cycle that loses every candidate this way stands downuntraceable, neverraced. -
A fallback selection (requirement 3v) is composed the same way. The claim loop runs this requirement’s compose step for a fallback pick too (
c_composed, alongsideselected_by_fallback), so anissues/tech-debtitem the mechanical fallback picks is rebuilt from a live read the same as an ordinary selection would be —fallback_select_candidate’s own band-entry composition for these two sources was subject to exactly the trimming this requirement exists to close, and unifying the two paths costs nothing extra for the other eight sources, whose template output is identical either way. 17a. The claim. The Script — never the model — takes an atomic per-item claim before the Implementer starts, walking the ranked candidates in order and handing the first successful claim onward (lib/claim.sh). Inside the image, both kinds of claim below refuse outright — a warning, no GitHub call — when the/.dockerenvsentinel is present andAGENT_OPS_SCHEDULER_RUNis unset (CLAIM_CONTAINER_SENTINELoverrides the sentinel for tests). Exactly two things set that marker, both of them the scheduler itself:agent-cycle.sh,review-cycle.shandmonitor-cycle.sheach export it, unconditionally, before any code path that can reach a claim, and the crontab sets it in its own environment block for every job supercronic fires (requirement 2.5’s Push, for the scheduled jobs that reach a write through none of those three). No container’s declared environment ever sets it — neither Compose’s nor a test harness’sdocker run -e …— so its absence can only mean something was invoked directly inside the image with no scheduler of its own: a stray manual run, an unhermetic test, or adocker execinto a live node container, which inheritsNODE_NAMEfrom Compose but never a crontab’s environment (agent-ops#2421, agent-ops#2449). The primitive is create-only, so GitHub arbitrates every race: -
Branch claims (every source except the four finishing ones —
review-feedback,merge-conflicts,dequeuedandabandoned-drafts— plus one exception withinmerge-conflictsitself, below): a REST create-ref (POST /git/refs) on the target repository at the default branch’s head. The claim branch is the working branch, derived deterministically (claim_branch_for,lib/candidate-select.sh) so every node computes the same name for the same item:agent/<item-ref>, uniformly — tech-debt included, since D15 as revised (#869/#875/#879) moved its item to the same bare-issue-number shape anissuesitem already has, so it claims the same way. A 422 (ref exists, even at the same SHA — which a plaingit pushof an identical ref would no-op) means a peer holds the item: logclaim-lostand move to the next candidate.A
merge-conflictswork order carrying"takeover": true(requirement 3s) takes a branch claim, not the file claim every othermerge-conflictsitem takes below — it names Dependabot’s PR, and taking it over means a new PR on a new branch of ours, exactly like any other fresh item, not a finish of an existing one. The item ref (pr-<n>-conflict-<head-sha>) still exists and is still what gets claimed — only the kind of claim differs, decided by the work order’stakeoverfield, which the Co-Ordinator sets and the Script reads before derivingagent/<item-ref>as usual. -
File claims (
review-feedback,dequeued,landing-refusalsandabandoned-drafts, plus everymerge-conflictswork order except a takeover, which finish an existing PR and have no new branch to create): a create-only contents-API PUT (nosha) ofclaims/<repo>/<ref>.jsonin the state repository. Forabandoned-draftsthe ref is scoped to the draft’s head SHA (pr-<n>-abandoned-<head-sha>), formerge-conflictslikewise to the PR’s head SHA (pr-<n>-conflict-<head-sha>), fordequeuedlikewise again (pr-<n>-dequeued-<head-sha>), and forlanding-refusalsto the unreconciled comment ids instead (pr-<n>-landing-refusal-<ids>, requirement 53 — that source’s own candidacy turns on which comments are unanswered, not on the head), so two nodes racing to finish, rebase, or fix the same PR contend on the same file and one wins. This list is exactlyPREFLIGHT_EXISTING_BRANCH_SOURCES(requirement 34m) plus the takeover carve-out above, and the two are written down in two places (lib/coordinator-phase.sh’s claim dispatch andlib/preflight.sh) that must agree: a source preflight believes has a pre-existing branch, but the dispatch does not, gets a fresh branch minted for it off the default branch and the candidate’s ownbranchoverwritten with it, handing the Implementer a branch no pull request tracks. A takeover needs no separate file claim of its own:agent/<item-ref>is derived from the same head-SHA-scoped ref, so two nodes racing to take over the same Dependabot PR compute the identical branch name and contend on that singlePOST /git/refsinstead — one claim, not two. -
The PR-keyed claim (issue #238). A round- or head-SHA-scoped item claim excludes nothing about a peer working the same PR under a different round’s or head’s ref — the mechanism that let PR #205 be worked by three nodes at once. So immediately after winning a finishing-source item claim taken via the file-claim path above — every
review-feedback,dequeued,landing-refusalsandabandoned-draftswork order, and everymerge-conflictswork order except a takeover, which contends on its branch claim instead — the Script takes a second, separate file claim keyedpr-<number>(same repository, same create-only primitive) before handing the work order onward. The number is the candidate’s ownpr_numberwhere it carries a usable one, and otherwise the one its item ref embeds — all five sources mint refs shapedpr-<n>-review-<id>,pr-<n>-conflict-<sha>,pr-<n>-dequeued-<sha>,pr-<n>-landing-refusal-<ids>andpr-<n>-abandoned-<sha>(requirements 3c, 3e, 3g, 3z, 53), so the Script derives it deterministically rather than depending on the Co-Ordinator having copied a field: a gate that engages only when the model remembered would silently reopen the very failure this closes. Only a ref of none of those shapes yields no number, and then no PR-keyed claim is taken. Losing it means a peer already holds this PR — under whatever ref won there — so the item claim just won is released (nothing was pushed under it) and selection falls through to the next candidate exactly as a lost item claim would. Winning it holds both claims — but, unlike the item-keyed one, the PR-keyed claim is held until this cycle’s own end, not untilpr-raised: see Release below (issue #360). This is what makes the exclusion real fleet-wide and race-safe — requirement 3p’s candidate filter is a cost-saving visibility layer over the same fact, not a substitute for it, since a peer’s claim taken after 3p’s filter ran is still possible and only this second create-only write actually arbitrates it. -
Every won claim also writes a best-effort registry entry at
claims/<repo>/<key>.jsonin the state repository — the lock is the ref or file above; the registry (minus the PR-keyed exclusion entries Release below explains) is what back-pressure counts (2.2), and the whole registry, PR-keyed entries included, is what gc sweeps — recording the base SHA, node, cycle, item, source, timestamp and, for a finishing-source claim (either the item-keyed or the PR-keyed one), thepr_numberit targets (requirement 3o). -
Release: an open PR supersedes the item-keyed claim — that registry entry is dropped the moment
pr-raisedis logged, and the branch lives on as the PR’s head. The PR-keyed claim is not dropped at the same moment: it exists to keep a peer off this PR, and the Reviewer stage that runs next still writes to it, so it is held until this cycle’s own end — the Reviewer’s terminal handoff (pr-ready), a reviewer handback, a stage failure, or a signal — whichever this cycle actually reaches. An ending none of those handlers see — an unhandlederrexitabort afterpr-raised— is caught by the EXIT trap’s backstop:cleanupreleases the PR-keyed claim as its first act, idempotent (a handled ending has already cleared the key, and then it does nothing) and time-bounded like the signal handler’s release, so no exit path leavespr-<n>standing for the gc alone to retire. Dropping it atpr-raisedreopened the exact race issue #238 closed: a Reviewer stage still pushing to a PR forty-three minutes after its cycle’s own PR-keyed claim was released, while a peer claimed and force-pushed a rebase of the same PR under a fresh ref (agent-ops#360). Every path that ends the cycle without a PR at all (a void verdict, a blocked verdict with no PR, a failed workspace clone, a stage failure or timeout before any PR exists) releases both claims together, in the same call — a claim branch is deleted only when it still points at the SHA the claim recorded and no open PR uses it, so pushed work is never deleted. Entries older thanclaim_ttl_hoursare swept bylib/claim.sh gcunder the same only-if-untouched rule (a node that died mid-cycle must not hold its item forever); every cycle runs the sweep at start (2.1a), so a dead node’s claims — item-keyed or PR-keyed — outlive it by at most the TTL plus one cycle interval. -
A candidate this cycle’s own gather already saw claimed is skipped without an attempt: the Script checks each candidate’s repo+item (raw, and in its branch-sanitised form) against the claims gathered for requirement 3o before spending a claim call on it, logs
claim-skippedwithcause: "pre-claimed", and moves to the next candidate. The attempt would lose anyway — but a loss knowable from data already in hand is not contention, it is the Co-Ordinator proposing claimed work (requirement 3q closes the pre-fetched sources; this closes the derived ones), and counting it as a race would corrupt the contention signal 17d exists to keep honest. Skips count toward neitherclaim_attemptsnorrace_losses. -
Claims fail closed per candidate: any outcome other than a won claim (a lost race, or GitHub unreachable) moves to the next candidate. Each miss logs
claim-lostwith acause—heldforlib/claim.sh’s rc 3 (a peer genuinely holds the item: healthy contention, the work is being done, just not by this node) orunreachablefor its rc 1 (GitHub could not be reached at all, fail-closed: no work is being done by anyone), any other rc verbatim. A miss on the PR-keyed claim above rather than on the item claim readspr-heldinstead ofheld— the same healthy contention, named apart so a reader can tell which of the two claims a peer holds — and carries thepr_claim_keyit contended on. It renamesheldonly: a PR-keyed claim that came backunreachableis an outage like any other and is counted as one. A cycle whose every candidate is lost stands down with reason “every candidate is already claimed elsewhere” — unless every miss wasunreachable, in which case the reason instead names the outage (“GitHub could not be reached for any candidate — this is an outage, not contention”), so a GitHub or token outage does not read as a fleet politely yielding to itself. A node that cannot reach GitHub to claim could not have pushed the work either. A cycle that attempted nothing at all because every candidate was skipped as pre-claimed stands down with reason “every candidate was already claimed before this cycle’s Co-Ordinator ran — skipped without an attempt”. Thisstand-downevent also carries the same distinction structured, ascause—raced,unreachable,pre-claimedoruntraceable(requirement 17f, and requirement 17h’s own fail-closed refusal, name the last one, with its own reason and its own counter) — so a reader (the dashboard included) does not have to re-parse the reason text (issue #245), plusclaim_skipswhenever any candidate was skipped andtrace_faultswhenever the traceability check faulted one, whatever the cause. Aracedstand-down chains another selection cycle under requirement 39 (Finish-then-continue)’s ordinary bounds;unreachable,pre-claimedanduntraceablenever chain — re-running into the same outage or the same selection defect buys a second Co-Ordinator engagement and the same ending. A win that followed one or moreheldlosses is a recovered race, not an ordinary first-try selection: theselectionevent that names the winning candidate additionally carriesrace_losses, the count ofheldlosses that preceded it, present only when it is greater than zero. -
When
state_repois unset (a single-node operation), file claims are vacuously won and the registry is skipped; branch claims still work. -
--dry-runclaims nothing.--onceclaims exactly like an unattended cycle: a supervised run contends with the fleet on equal terms. -
The winning candidate’s
pr_label(agent-ops#956). The instant a claim is won, the Script stamps the configuredpr_label— the sameconfig.jsonvalue threaded into the Co-Ordinator’s runtime input — onto the claimed work order, alongsidebranch, unconditionally overriding whatever value the candidate already carried (including none). This is the guaranteed source of the field the Implementer labels its pull request with (requirement 23): the Co-Ordinator’s own copy (requirement 20) andfallback_select_candidate’s composition (requirement 3v) are belt-and-braces, never load-bearing, since a Co-Ordinator whose model output omits or mistypespr_labelwould otherwise raise a pull request no gatherer —gather-review- feedback.sh,gather-abandoned-drafts.sh,gather-merge- conflicts.sh,gather-dequeued.sh,gather-human-visibility-hygiene.sh,scripts/sweep-closed-issues.sh,lib/merge-budget.sh— or the back-pressure count (2.2), could ever find again. -
The Script re-applies
pr_labelto the raised pull request too (agent-ops#2074/#2403). Stamping the work order’s own field, immediately above, guarantees the value the Implementer’s labelling step reaches for; it does not guarantee the Implementer’s model actually callsgh pr edit --add-labelwith it. Immediately afterpr-raisedis logged (lib/coordinator-phase.sh), the Script callspr_label_ensure(lib/labels.sh) against the raised pull request itself, idempotently: present already, nothing changes and nothing is logged; absent, the Script adds it directly and logs awarningnaming the pull request, so a model that skipped its own labelling step stays visible instead of quietly dropping the pull request out of every gatherer the bullet above names. The measured case was #1577 — the one pull request, among 178 this repository’s own App identity raised since 2026-09-01, that the model never labelled. 17b. The orphan-branch sweep. The gc’s only-if-untouched rule (17a) leaves one state behind on purpose that is right for the work and wrong for the item: an Implementer that pushed commits and died before its draft PR existed leaves a moved ref with no PR — which nothing recovers (gather-abandoned-drafts.shlists PRs, not branches), every later claim 422s against, and the Co-Ordinator’s exclusion reads as “claimed, skip”. The work is unreachable and the item permanently unselectable, with no event ever saying so. Its sibling is the unmoved ref whose best-effort registry write never landed, wedging the item with nothing to recover. So after the gc (2.1a), every cycle runsscripts/sweep-orphan-branches.shover each configured repo’s<branch_prefix>*andtd-record/*refs.techdebt_file_debt(lib/tech-debt-file.sh) no longer mints one — agent-ops#874 moved its filing to a labelled issue — but this walk still needs to recognise, and eventually retire, any branch a filing from before that move left behind. A ref is a provable orphan only when all three hold: no open PR uses it, no registry entry stands for it (only a clean 404 proves absence — any other failure skips the ref, fail closed), and its tip commit is older thanabandoned_draft_after_hours— the same judgement that makes a draft abandoned.td-record/<ID>is swept differently again, and is the one prefix that is delete-only, never recovered: a filing pull request a human has closed without merging means they declined that record, and a recovery draft would hand it straight back to them (TD-PPagop-26082310). The sweep asksgh pr list --head <branch> --state closedand counts only the pull requests whose own state isCLOSED— that listing is[CLOSED, MERGED], exactly as GitHub’s own “Closed” tab is, so a merged filing must be filtered out here rather than assumed absent — leaving a non-zero count unambiguous: the filing was declined. It then deletestd-record/<ID>outright (released,reason: "filing-declined"), then goes one step further than any other ref here: it readstech-debt/<ID>.mdat the default branch’s own tip to ask whether<ID>’s record reachedmainsome other way. A clean 404 means it never did, so the id is spent with nothing to show for it and itstd/<ID>reservation is released alongside it (a secondreleased); a 200 means the record landed some other way, so the reservation is left alone as an inert, already-honoured lock; any other failure answers nothing, so — fail closed, like every guard here — it is left alone too. Because this delete and release together can cost two actions against the per-run cap below, the sweep reserves both up front rather than checking once per branch: a run with only one action of headroom left defers the whole pair instead of deletingtd-record/<ID>and stranding the reservation release for a later pass — neither ref is touched, and the branch is found again, unchanged, next run (TD-PPagop-26082310). This is a narrow exception to the reservation-lock exemption two sentences above, not a relaxation of it: atd/<ID>reservation is only ever released this way from inside the declined-filing arm, immediately after its owntd-record/<ID>sibling was confirmed declined, never for a bare reservation encountered with no such sibling. Atd-record/<ID>whose pull request merged needs no separate handling — the ordinary merged-PR check below already deletes a merged head’s leftover ref — and one with no pull request at all, a filing killed between its contents write andgh pr create, falls through to the ordinary recovery-draft path unchanged, since that is a genuine crash orphan, not a declined one. For each other orphan the sweep restores a state the pipeline already handles: commits ahead of the default branch become a draft PR (labelledpr_label, so the abandoned-drafts machinery recovers the work exactly as it recovers any stalled draft; retried without the label, loudly, where the label is missing) — unless a PR was ever merged from that head, which the sweep checks (gh pr list --head <branch> --state merged) before trustingahead_byat all: every repo here squash-merges, so a merged branch’s own commits never enter the default branch’s history andahead_bystays positive forever even though the work already landed — without this check that permanently-ahead, already-merged-but-undeleted ref would read as a fresh orphan on every sweep and mint an endless stream of redundant recovery drafts (issue #302) — or unless the branch’s own work, not its own head, already landed via a rival branch, which the sweep checks by reducing both branches to a stem — thebranch_prefixclaim prefix stripped from the front and a trailing, exactly twelve-hex-character random suffix stripped from the back, if present (a lower bound would misfire: a tech-debt id likeTD-PPagop-26081403’s own trailing-26081403is eight hex-legal digits, and treating that as the suffix would collapse every item under theTD-PPagopscope to one stem) — and searching the repository’s recently closed pull requests for a different branch sharing that stem whose merge postdates this branch’s own first commit: two cycles can claim the same item concurrently and race to a PR, and the loser’s dead branch carries commits a rival already superseded (sometimes with a fix the loser never saw), so resurrecting it as a recovery draft would reintroduce that superseded — sometimes regressed — code (issue #500, PR #370). Checked before the rival-branch search, since it answers a narrower question with a cheaper test: the branch’s own head never merged, but its most recent closed pull request was a deliberate pipeline retirement (agent-ops#2923) rather than an ordinary human decline — either it carries theobsoletelabel, or — never labelled, but retired all the same — adraft-obsolete-flaggedorvoid-object-closedevent, read from the union log an optional second argument now hands the sweep, already names this branch’s own item. The label is matched case-insensitively, the same waylib/void-guard.shandscripts/close-void-github-items.shread it. The item is matched two ways, because the engagement that logs a finishing-source retirement is never named after the claim branch at all: an ordinary item’s event is logged underbranch_prefixstripped from the front — the derivationgather_claimeduses — and that string is matched directly; a finishing source instead works on the target pull request’s own existing head branch and logs its event under its own engagement ref (pr-2913-abandoned-12c058202df8, say), a string no claim branch is ever named, so that case is matched instead on the pull request number the event carries (draft_obsolete_flags’s ownprfield, orvoid_object_closed_items’s ownnumberfor apr-<n>-…void — absent, and so never matched, for a bare-issue void) against the number of this branch’s own most recent closed pull request, the one the finishing engagement worked on. An omitted or unreadable union log reads as “no retirement events known yet”, and is read as a file or not at all: the sweep never consumes its own stdin, which fromlib/standdown.shis the repo-slug stream of the loop the call sits inside. Recovering such a ref as a draft would re-file exactly the work the pipeline already judged unwanted, so it is deleted instead (released,reason: "retired") — without ever reaching the rival-branch search below. An ordinary declined close, with neither signal present, is untouched by this check and falls through to that search unchanged — the case that must not regress, since this check must never start deleting a branch a human simply closed. A ref with nothing ahead, with a merged PR against its own head, superseded by a rival branch’s merge, or deliberately retired this way, is deleted — it was only ever the claim, and the claim is dead, already honoured, honoured elsewhere, or judged unwanted. A failure to determine the merge state fails the same way as the other guards: skip the ref, warn, touch nothing; so does a closed-pull-request read the deliberate-retirement check cannot get an answer from — it falls through to the rival-branch search exactly as an ordinary declined close does, since an unanswered question here is no different from “no signal found”. The rival-branch search is the one guard that does not fail closed: it cannot make the ref safer to delete, only safer to leave as unrecovered work, so on no match, or on any failure to get an answer, nothing about today’s behaviour changes and the ordinary recovery draft still gets filed — quietly on a clean “no rival found”, but with awarningnaming the branch when the lookup itself failed, so that gap stays visible without adding noise to every ordinary recovery. Actions are capped per run (three per repo per cycle, the overflow reported, never silent), logged asorphan-branch-recovered/orphan-branch-releasedevents, and every node may sweep concurrently: GitHub rejects a second open PR for the same head and a second ref delete is a no-op, so the worst race outcome is a warning. Skipped on--dry-run. One priced residual: a live claim whose registry write failed and whose ref is untouched looks identical to the empty orphan, so its ref can be deleted mid-run — the Implementer’s later push recreates it, and the cost is at worst a duplicate PR, priced against an item wedged forever. 17c. The post-merge closing-keyword sweep. Requirement 25a’s checks — its CI workflow and its script-side gate — stop a new pull request from merging without a real closing keyword; this is the backstop for what already got through — a PR merged before that check existed, or one that merged some other way — and for the ordinary lag between a fix landing and the issue it was meant to close actually closing. After the orphan-branch sweep (17b), every cycle runsscripts/sweep-closed-issues.shover each configured repo: for every merged,pr_label-labelled pull request naming an issueNGitHub still reports open, it closes that issue with a comment citing the merge as evidence (the PR number, its merge commit) instead of leaving the tombstone that keeps a finished item selectable forever (issue #240; PR #206’s “Implements #198” left #198 open for three days after its own fix merged, selected and voided twice in the meantime). A merged PR names its issue by the<!-- agent-ops:closes-issue item=N -->marker (requirement 23b), or — when the marker is missing — by a head branch of exactlyagent/<N>, the same Script-minted anchor requirement 25a’s CI check reads, so one forgotten prompt instruction cannot blind the CI check and this sweep on the same PR. An issue GitHub reportsstate_reason: "reopened"is exempt: somebody reopened it after a close, and “still open” alone cannot tell that apart from “never closed”. Without the exemption the sweep would re-close, on the hour and with a fresh comment each time, exactly the issue a human deliberately put back — the same answer requirement 34k’svoid-object-closedrecord gives on the other sweep, spelled here with no record of our own to keep, because the re-open is GitHub’s record of it. The skip is reported as a warning, never silent.
A pull request can name more than one issue this way — PR #2812 closed both #2801 and #2813 in the same body, but the marker/branch anchor above only ever identifies a single target, so #2813 sat open for five days after #2801 closed within the half hour (agent-ops#2851). Alongside that single target, this sweep also checks every other same-repository issue the pull request’s own GitHub-reported
closingIssuesReferencesnames — already present on the same listing, at no extra cost — and closes each one still open and not reopened the same way, counted under the samemax_actionsbudget as the single-target close.Bounded, by default, to the most recently updated merged pull requests per repo — but that ordering alone has a gap: a merged pull request nobody touches again ages out of it for good once enough newer pull requests merge, with nothing to reach back for it. PR #2425 merged 2026-10-20 and met every closing criterion above, but #2393 sat open for three weeks because it never again surfaced near the top of that ordering (agent-ops#2851). So alongside that window, this sweep also walks a second, persistent cursor —
<state_dir>/sweep-closed-issues- cursor.json, keyed per repo slug — across the same merged, labelled pull requests in ascending creation order, continuing each run from at or just past wherever the cursor last reached (created:>=, notcreated:>, so two pull requests sharing onecreatedAtsecond at that boundary cannot let one slip past unexamined) rather than from the beginning, and bounded by the samepr_search_limitper call. The two listings are merged and de-duplicated by pull request number before either is examined, so a pull request either call finds is processed exactly once.The cursor advances past a batch the cursor listing examined only once every cursor-sourced pull request in it actually finished — closed, already closed, or left alone as a deliberate
state_reason: "reopened"skip. A close the sharedmax_actionsbudget deferred, or one a transientghread or close failure left alone, holds the cursor exactly where it was instead: advancing past it regardless would make that pull request’s own issue permanently unreachable, since the next cursor search starts strictly past this point and an old pull request by definition no longer surfaces in the “most recently updated” window either (agent-ops#2869). An exhausted cursor (an empty batch) is likewise left exactly where it is: every pull request merging from that point on is fresh enough to appear in the “most recently updated” window on its own.That hold alone cannot tell a transient defer from a permanent one (agent-ops#2891): a cursor-sourced pull request naming an issue that 404s on every read, or whose close call fails every run, held the cursor forever, wedging the whole walk behind it. So the cursor file also tracks, per repo slug, a consecutive-stall counter keyed on whichever single cursor-sourced pull request blocked the gate this pass, and a skip-list of pull requests the walk has given up on. The counter increments only for a real read/close failure — never for a close the shared budget merely deferred, which already expects to resolve once more budget is available — resets to 1 the moment a different pull request blocks the gate, and clears entirely the moment no cursor-sourced row is incomplete and the cursor listing itself actually ran. A pass whose cursor-side listing call fails outright leaves no cursor-sourced row to find incomplete either, which would otherwise look exactly like the gate genuinely resolving and wipe out a persisted stall for a reason the blocking pull request was never actually clear of (agent-ops#2908) — so that pass, like a budget-deferred one, carries any persisted stall forward unchanged instead. Once the same pull request has blocked three consecutive passes this way, it is added to the skip-list and the counter clears: a skip-listed pull request’s row stops holding the cursor, so the walk resumes past it, with a louder warning naming which pull request it gave up on — while its issue, never actually closed, is left exactly as unclosed as before. There is no path back off the skip-list other than a human editing the cursor file directly.
Idempotent by construction — it only ever acts on an issue GitHub itself still reports open and not reopened, so re-running it costs nothing once the backlog is cleared. Actions are capped per run (three per repo per cycle, the overflow reported, never silent), logged as
issue-closed-post-mergeevents, and every node may sweep concurrently: GitHub’s own issue-close is idempotent, so the worst race outcome is two nodes both finding nothing left to do. Skipped on--dry-run.The same pass also retires the requirement 8c
cause: "merged"half of an Approver-adjudication escalation (agent-ops#1215): one extragh issue listcall per repo, never per pull request, for every open issue carryingenabler_escalation_labelwhose body names apr-<n>-approver- adjudicationreference, matched locally against the merged-pull-request listing this sweep already fetched. When that labelled listing finds no issues at all, or finds none whose body matches that regex for a pull request in this round’s own merged-pull-request listing, a second, label-lessgh issue listcall looks for the same reference in any open issue’s body — keyed on the escalation footer’s backtickedItem: `pr-<n>-approver-adjudication`form and excluding any<!-- agent-ops:decision-logbody — so an escalationcreate_escalation_issuefiled via the retry-without-label path (agent-ops#2657, agent-ops#2666) is still retired by a direct human merge, matching the labelled-first/label-less-fallback shape every other escalation reader already applies (agent-ops#2670), rather than left to survive its own disagreement indefinitely because the label never made it onto the issue (agent-ops#2685, agent-ops#2686). A match closes the issue with a comment naming who merged the pull request and when, and reports{"action":"approver-escalation-retired", …, "cause":"merged", …}for the caller to log asapprover-escalation-retired— this is the only fleet-wide site that ever notices a pull request merged some way other than this pipeline’s own arm (lib/landing.sh), so it is also the only place a human’s own merge click can retire one. Shares this pass’s$max_actions/deferred budget with the closing-keyword sweep above, rather than a separate cap of its own. An escalation somebody reopened (stateReason, read on the same listing rather than for a second call) is left alone, for the identical reason the closing-keyword sweep above refuses astate_reason: "reopened"issue: this pass re-lists the same merged pull request every stand-down for as long as it stays insidepr_search_limit, so without the check a re-open would be undone — with a fresh comment — on the hour, every hour. A listing that fails outright — either the labelled listing or its label-less fallback — reports awarning, the same as the merged-pull-request listing above: a successful call with nothing matching answers[], so an empty result means the call itself did not answer, and skipping that silently would be indistinguishable from the common “nothing is escalated” case while retiring nothing for as long as the failure lasted. The rest of the pass runs regardless — the closing-keyword sweep does not depend on either call. -