docs/spec/implementation/acceptance-checks/acceptance-checks-05.md
Acceptance checks
Section titled “Acceptance checks”Acceptance checks — continued (part 5 of 10; items 8t–50)
Section titled “Acceptance checks — continued (part 5 of 10; items 8t–50)”8t. The arming step lands only what the classifier clears, re-reads every
gate fresh, and disarms cleanly (requirement 8d, D18 WI-7).
test/landing.test.sh passes against a stubbed gh:
landing_protected_paths_hit reports every one of the nine protected
prefixes agent-ops’s own merge_autonomy_protected_paths default names
(.github/*, deploy/*, prompts/*, lib/*, config.schema.json,
config.json, agent-cycle.sh, review-cycle.sh, CODEOWNERS) and
exits 0 when any is touched, 1 when none is, 2 — never trusted as a
pass — on an unreadable or page-capped changed-file listing, and 3 —
also never trusted as a pass, but distinct from 2 — on a
merge_autonomy_protected_paths entry _landing_is_protected’s own jq
program cannot compare against a path at all (a non-string entry, which
makes jq -e raise — its own exit 5 — rather than merely return false;
TD-PPagop-26082320, not reachable through a schema-validated
config.json, whose items are constrained to non-empty strings, but
still a contract the helper itself must hold); landing_eligible names
which of the two fired in its own unknown: reason text rather than
blaming the changed-file list regardless of cause
(TD-PPagop-26082325); a repo-level merge_autonomy_protected_paths override (the
same precedence merge_autonomy_routine_sources uses) wins over the
top-level list, pinned against scripts/detect-classifier-escapes.sh’s
own independent reimplementation (test/detect-classifier-escapes.test.sh,
D18 Stage 3, agent-ops#724) so the two can never silently diverge on what
counts as protected, including on that same non-string-entry verdict;
landing_eligible reads ineligible for a level below agent-merges-routine,
for a complexity outside the repository’s own
merge_autonomy_routine_complexity — complexity:high under the
default ["low", "medium"] list, regardless of source or path — and for
an empty complexity, for a source outside the repository’s own
merge_autonomy_routine_sources (a repo-level override taking
precedence over the top-level list, the same precedence
merge_autonomy itself uses) and for an empty source, unknown on an
unreadable protected-path read (naming the changed-file list), an
unevaluable protected-paths list (naming merge_autonomy_protected_paths
instead, TD-PPagop-26082325), or an exit code from
landing_protected_paths_hit outside its documented 0/1/2/3 contract
(agent-ops#1232, pinned by temporarily replacing the helper with one
that exits an out-of-contract code, since the real helper’s own case
statement never produces one), and eligible only once every condition
clears — with a repo-level merge_autonomy_routine_complexity override
admitting complexity:high for that repository alone while a repository
without one still refuses it, and a top-level override admitting it
fleet-wide (D18 Stage 3, agent-ops#725) — with pinned cases confirming the source comparison is exact
string equality, never expanded against the four issues:<band> ranks:
a plain issues routine-list entry matches a real issues work order’s
own "issues" source, and an issues:low entry (a schema error, since
the key takes landingSourceToken and not sourceToken) does not, the
comparison folding no bands. The membership test is additionally guarded
against an empty routine list, because jq -e on empty input exits 0 on
jq 1.6 and 4 on jq 1.7, which would otherwise invert this gate on a 1.6
host; landing_approver_standing_review
reads a login’s own most recent standing APPROVED/CHANGES_REQUESTED
review — ignoring COMMENTED/DISMISSED — reading empty for a login
that never reviewed, and non-zero on an unreadable list, confirming this
is a fresh GitHub read independent of whatever agent-cycle.sh’s own
in-process verdict says; landing_arm enqueues via
enqueuePullRequest when merge_queue_for_branch reports an active
queue on the pull request’s base branch, falls back to gh pr merge --auto --squash when it reports none, issues either write with
GH_TOKEN set for that one invocation only, and returns non-zero
printing nothing when the pull request’s own details, the queue probe,
the mutation or the merge itself cannot be confirmed — each of those
four (plus bad arguments and the mutation’s own partial-write case) its
own distinguishable exit status (agent-ops#532), pinned directly in
test/landing.test.sh together with _landing_arm_failure_reason’s
mapping from each one to the text run_landing_stage folds into its
landing-refused reason.
test/merge-queue.test.sh covers merge_queue_for_branch the same way
merge_queue_probe is already covered: the literal null for no
queue, the queue object verbatim when one exists, and non-zero on an
unreadable or malformed response. Wired into the Approver stage
(lib/approver.sh; test/approver-wiring.test.sh continuing to pass
confirms
run_approver_stage still reports approver_stage_verdict/
approver_stage_adjudicating correctly for run_landing_stage’s own
precondition), with test/landing-wiring.test.sh lifting
run_landing_stage, _landing_stage_attempt and _landing_refuse
verbatim out of lib/landing.sh and exercising every gate under set -euo pipefail,
the options that file itself runs under rather than the set -uo pipefail a library test uses — a refusal a gate helper reports in its
exit status (review_gate_verdict exits 1 for dirty, 2 for an
unreadable required-check list) must log landing-refused and return,
never abort the cycle mid-stage, and only the production options can
tell the two apart: a protected-path pull request is never armed at
agent-merges-routine, whatever the Approver’s verdict, complexity or
source; at agent-merges-all it is armed only once D18 WI-12’s own gate
4.5 clears (below) — an Approver refusal, an adjudication (its
own land included), an unparseable verdict, or a stage that did not
run each leave run_landing_stage returning immediately with nothing
armed; at merge_autonomy: human and agent-approves no arming path
executes at all and every existing pr-ready/Approver behaviour is
unchanged; a local approve verdict whose review GitHub itself refused
to post is caught by the fresh standing-review re-read and refuses
arming rather than trusting the in-process verdict; a standing human
CHANGES_REQUESTED prevents arming regardless of the App’s own
approval; a merge_budget_decide result of
hold or refuse reaches merge_budget_apply_decision and arms
nothing; a successful arm logs landing-armed exactly once and never
withholds pr-ready, the claim release or the Approver’s own review;
every refusal path logs landing-refused naming a reason, never a
blocked pull request or a withheld claim.
The four-level ladder crossed with both landing paths is swept in oneconformance test, `test/landing-human-veto-conformance.test.sh`(agent-ops#577, part of D18 #402): with a standing human`CHANGES_REQUESTED` in place throughout, nothing arms in any of eightcases — `human`, `agent-approves`, `agent-merges-routine` and`agent-merges-all`, each crossed with the landing path `landing_arm`would otherwise take (`enqueued` for a base branch with an active mergequeue, `auto-merge` for the no-queue fallback). The eight cases are notone shape repeated: `_landing_stage_attempt`'s gate 1 refuses on theeffective level *before* gate 4 is ever consulted, so at `human` and`agent-approves` the refusal names the level and`_handoff_blocking_reviewers` is never called at all (pinned directly,by call count); only at `agent-merges-routine` and `agent-merges-all`does the refusal come from the human-veto gate itself, naming theblocking reviewer, in a reason textually distinct from every otherrefusal class in the same function (gate 4's own App-approval halfincluded). Since the veto refuses upstream of gates 5 and 6 and of`landing_arm` itself at every level it binds, `landing_arm` is neverinvoked in any of the eight cases regardless of which landing path isconfigured — proof that neither path offers a way around the veto, notmerely two differently-labelled identical runs.
`test/handoff.test.sh` covers the freshness half directly against`_handoff_blocking_reviewers` itself, against a real (stubbed `gh`)review history rather than a stubbed gate: a reviewer's `DISMISSED`position is excluded from `_handoff_latest_reviews`'s own filter before`group_by`/`last` ever runs, so it never stands in for a clearing`APPROVED` — a `CHANGES_REQUESTED` dismissed and then reasserted stillblocks, and a `CHANGES_REQUESTED` merely dismissed (with nothingfollowing) still blocks too, since the dismissal is invisible to thecomputation rather than read as the reviewer's own last word; only agenuine later `APPROVED` from that reviewer clears it.
These two files pin the formal-review half of "a human change requestblocks landing" — `_handoff_blocking_reviewers` reads only formalreviews, and a human cannot leave a formal `REQUEST_CHANGES` review onthis system's own pull requests at all: GitHub refuses that review typefrom a pull request's own author, and every pipeline write and everyhuman comment on these pull requests land under the same account, sotheir only instrument is an ordinary comment. `lib/reconciliation-gate.sh`(agent-ops#533, closed via PR #539) closes that case at the Reviewer'sown ready-flip: a pull request carrying an unreconciled non-pipelinecomment since it last left draft cannot be flipped Ready in the firstplace. That gate runs once, at hand-off, and on its own does not reach acomment posted after a pull request is already Ready, in the windowbefore a later cycle's arming step lands it — gate 4's freshformal-review read alone still sees nothing standing against a plaincomment. Gate 4 (`_landing_stage_attempt`, `lib/landing.sh`) closes thatresidual window itself (agent-ops#672) by calling `reconciliation_gate`a second time, unbounded, immediately after `_handoff_blocking_reviewers`— unbounded because, unlike the Reviewer's own call, this stage neverflips the pull request out of draft, so the raw "most recent`ready_for_review` event, not since undone" already is the anchor thisread needs. A `dirty` verdict refuses arming, naming the unreconciledcomment(s); an `unknown` verdict (the timeline or comment list could notbe read), and the empty word a call that never executed at all leavesbehind, both refuse too (#753's ruling on agent-ops#746) — neither isunfolded as a case distinct from the other, and the refusal isunconditional, never dependent on `merge_autonomy_effective_level`.`test/landing-wiring.test.sh` pins this directly: a case with a `dirty``reconciliation_gate` stub refuses arming with the unreconciled commentnamed in `landing-refused` and never calls `landing_arm`, a case with`unknown` and a case with the empty word both refuse arming too — a`landing-refused` naming what could not be confirmed, `landing_arm`never called, `_landing_stage_attempt_armed` staying `0` — and the happypath confirms `reconciliation_gate` is called exactly once per attempt,unbounded.
D18 WI-12 (Stage 4, agent-ops#415) is pinned separately, in both files.`test/landing.test.sh`: `landing_eligible` reads `eligible`, not`ineligible`, for a protected path at `agent-merges-all` (deferred,never refused, since this classifier alone cannot see the compensatingcontrols); `landing_approver_standing_review_at` returns the standingreview's own state, `submitted_at` and `commit_id` together, at the sameone reviews read `landing_approver_standing_review` already makes;`landing_cool_off_effective_hours`resolves the repo-override-else-top-level-else-24 precedence, `0`included, exactly as `merge_budget_effective_cap` does;`landing_cool_off_remaining_hours` computes the correct remaining time(clamped to `0`, never negative) against a pinned `NOW_ISO`, and isempty — never `0` — on an unparseable timestamp or duration;`landing_protected_path_controls_ok` is `ok` immediately for a pullrequest touching no protected path, refuses naming the tier foranything but `critical`, refuses naming the missing timestamp with no`submitted_at`, refuses naming both commits (even past a full dayelapsed) when the standing review's `commit_id` does not match a freshread of the pull request's current head — the push-after-approval case,agent-ops#658 — refuses naming the remaining time while the cool-off isopen once the commits do match, is `ok` once it has elapsed or`landing_cool_off_hours` is `0`, and is `unknown` on a re-check thatcannot read either the changed-file list or the pull request's currenthead;`landing_retry_tier` reads the most recent matching `approver-verdict`event's own `tier` from the fleet log, the same "several events, keepthe latest, skip malformed lines, stdin works like a named file" shape`landing_retry_source_map` already has pinned, excluding an event whoseown `posted` field is explicitly `false` — its review never reachedGitHub — *before* that "keep the latest" pick is made, so a laterunposted event can never outrank an earlier posted one for the samepull request (issue #2534); an event with no `posted` field at allstill reads as posted, the same default `verdict_fate_latest_per_pr`(`lib/verdict-fate.sh`) already applies for history logged beforeagent-ops#573 introduced the field. `test/landing-wiring.test.sh`lifts the new gate 4.5 in place, stubbed as its own function: neverconsulted at all below `agent-merges-all` (confirmed by an empty calllog) with the pull request still arming normally; at `agent-merges-all`a refusal from the gate — a live cool-off, a non-critical tier, a missingapproval timestamp, a head pushed past the standing review, anunreadable re-check — arms nothing and is named in `landing-refused`,each under its own class rather than the generic `ineligible` everyother gate shares (`protected-path-cooloff`, `protected-path-tier` forboth of the two approving-engagement shapes, `protected-path-stale-head`,and gate 2's own `unknown` for the unreadable re-check — issue #1992);the gate is consulted with this round's own in-process `approver_stage_tier`on the ordinary path, and with `landing_retry_tier`'s own fleet-log readinstead on a direct `_landing_stage_attempt` call with `RETRY` set,confirming a re-arm never trusts a tier fact that belongs to a differentprocess. `test/approver-wiring.test.sh` covers the tier-forcing half:a protected-path pull request launches a real critical-tier engagementat every complexity grade, `complexity:low` included (which alone wouldhave skipped the model entirely), logging `critical_reason: "protected-path"`;the classifier's own exit 2 (an unreadable changed-file list), itsexit 3 (a `merge_autonomy_protected_paths` list it cannot evaluateagainst a path, TD-PPagop-26082325), and any exit code outside itsdocumented 0/1/2/3 contract (agent-ops#1232) each force the samecritical tier rather than falling back to a cheaper one, pinnedseparately so the exit-code split cannot silently drop one of them —the guarding condition names only the legitimate exit 1 as anexemption from the forced tier, rather than enumerating the fail-closedcodes, so an unrecognised code cannot silently join it; a refusestreak of two still logs `critical_reason: "refuse-streak"`, so the twocauses are pinned as distinguishable in the log; and a pull requesttouching no protected path is unaffected, keeping every tier exactly asacceptance check 8s already pins it. `scripts/doctor.sh` warns when arepository's own configured `merge_autonomy` is `agent-merges-all` andits effective `landing_cool_off_hours` resolves to `0` — the cool-offcontrol disabled entirely, the residual risk §7 risk 1 accepts only withboth controls in force (`test/doctor.test.sh`).
`scripts/doctor.sh` also warns, separately, when a repository's ownconfigured `merge_autonomy` is `agent-merges-routine` or above and itsresolved `merge_autonomy_protected_paths` (its own `repos[]` overridewhen present, else the top-level key) is `[]` — schema-valid, sinceneither carries a `minItems` — naming the repository and its level, onthe model of the `landing_cool_off_hours 0` warning above(TD-PPagop-26082403, `test/doctor.test.sh`): the shipped nine-pathdefault draws no warning, a top-level or `repos[]`-level `[]` each drawit at `agent-merges-routine` or above, and the same `[]` below that tierdraws none, since the gate does not bind there either.
`scripts/doctor.sh` warns whena repository's effective `merge_autonomy_routine_sources` names a sourcethat repository's own `sources` never gathers, and separately warns whenthat effective list carries any `issues:<band>` entry (agent-ops#519) —an entry that can validate clean against the first check (therepository's own `sources` list typically does gather that bandedtoken) while still never matching a work order once its `source`collapses to the plain word `issues` — naming the banded entry and`lib/landing.sh`'s own header as the cause, and never firing for anunbanded entry (`test/doctor.test.sh`).`scripts/doctor.sh` also fails, for every repository at`agent-merges-routine` or above (its own *configured* level), a defaultbranch with no active merge queue while either `allow_auto_merge` or`allow_squash_merge` is off (agent-ops#532) — `landing_arm`'s no-queuefallback is `gh pr merge --auto --squash`, a call GitHub refusesoutright unless both are enabled — reading `repos/$slug` and`merge_queue_for_branch` once each per repository and naming in thefailure which of the two is off together with both fixes (enable it oradopt a merge queue); an active queue is `ok` regardless of eithersetting, an unreadable repository and a `repos/$slug` that reportsneither key or only one of them (GitHub returns both only to a tokenwith admin visibility of the repository's merge settings) are each a`skip` naming whichever went unreported, and a repository below theroutine tier is left silent. An **unreadable merge-queue state is a`fail`**, alone among this check's bail-out paths and expressly notcovered by the "never fail for what this run could not check" rule theconsolidated verdict below still follows: `merge_queue_for_branch` isthe identical read `landing_arm` performs as its own gate 7, at a levelthis check only reaches because landing is armed, and the `repos/$slug`read above has already established that the token can see therepository — so a failure here is neither a visibility gap nor anunchecked precondition but the landing path itself demonstrated down,and the failure names that, both candidate causes (the query in`lib/merge-queue.sh` against GitHub's current schema, and the token'sreach) and the repository it is down for. The consolidatedautonomy-readiness verdict still reports that repository'smerge-settings/merge-queue pairing as **unconfirmed** rather thanmissing, since this run established nothing either way about thesettings themselves. A setting read as adefinite `false` decides the verdict before the unreported case isconsidered, so an unreadable sibling never masks one doctor did read asoff. The `ok` states only the settings actually read, since they are anecessary condition for that call rather than a sufficient one(`test/doctor.test.sh`).`./scripts/render-config-table.sh --check` and `./scripts/lint-shell.sh`are clean.8u. A pull request the arming step already approved once, but could not
land for a reason that can change without the pull request changing, is
re-armed without a human’s click (TD-PPagop-26081701).
Once per cycle, fleet-wide regardless of --repo and skipped on
--dry-run (it can land a pull request), for every repository whose
merge_autonomy_effective_level (a fresh read, issue #513) is
agent-merges-routine or agent-merges-all: every open, non-draft pull
request carrying pr_label whose own complexity:* label is a member of
that repository’s own _landing_routine_complexity list — the same list
landing_eligible’s own preflight consults (default low/medium;
agent-ops#2310) — and whose Approver review is genuinely standing
APPROVED on GitHub right now is offered to _landing_stage_attempt
(requirement 8d) with RETRY set — the identical seven gates the round
that first approved it ran, never a second copy of them, so a source
outside the repository’s own merge_autonomy_routine_sources, or a
protected-path hit below agent-merges-all, is refused exactly as it
always was: by landing_eligible, on the same terms, every time it is
asked. At agent-merges-all, landing_eligible instead reports a
protected-path hit eligible and defers to gate 4.5 (requirement 8d), just
as it did the round that first approved the pull request — the sweep
re-enters gate 4.5 too, and a control it finds unmet there refuses the
pull request identically. A pull request whose complexity:* label is
outside that repository’s own configured routine-complexity list, or
that carries no standing Approver APPROVED review (ordinary in-flight
work, not a stranded approval), is never offered at all — cheap,
fresh-read exclusions that keep this sweep from re-attempting, and
re-logging, work the gates below would refuse identically every cycle.
The one gate this sweep answers differently from the original round is
the pull request’s own source: not re-derivable from GitHub (there is
no field for it, and it is fixed at claim time regardless), so
landing_retry_source_map (lib/union-log-scan.sh) reads it back from
the fleet’s own union log’s selection events for that repository, one
pass building a {branch: {source, item}} map — built once for this
sweep’s whole pass, never once per candidate (#1050) — keeping only the
most recent event when a branch was reused; a pull request whose source
cannot be resolved this cycle is skipped, never guessed at. Every arm or
refusal this sweep produces is landing-armed/landing-refused, the
same events requirement 8d’s own gates always log, additionally carrying
retry: true so the fleet log (and any reader of it) can tell a
sweep-driven landing apart from the round that first approved it.
**Neither this sweep nor this round's own arming step ever arms more ofa repository's stranded pull requests, between them, than thatrepository's remaining merge budget** — `merge_budget_per_day` less whatit has already landed in the rolling window (PR #557 review, widened inreview round 2 from a bound private to this sweep's own pass): both callinto `_landing_stage_attempt` — this sweep, and `run_landing_stage`'s owngate 0, run later the same cycle process for whatever repository thisround's own Implementer worked in — read and grow one cycle-scoped`landing_armed_by_repo[SLUG]` map (`agent-cycle.sh`, declared ahead ofboth), rather than a tally private to either. Each, immediately after acandidate arms (read off `_landing_stage_attempt`'s own`_landing_stage_attempt_armed` global, the one signal that function'salways-0 exit status cannot carry), grows that repository's own entry andpasses the running total as `_landing_stage_attempt`'s ALREADY_ARMEDargument on every subsequent call for the same repository, whichevercall site makes it. `merge_budget_decide` (requirement 2.3c) discountsALREADY_ARMED from the live merged-PR count before deciding `arm` vs`hold`, because GitHub's own record only shows a pull request as mergedonce the merge has actually landed, never the moment either call sitearms its enqueue or auto-merge — without this shared tally, a repositorythe sweep already armed several pull requests for could still have thisround's own gate 0 read the same stale not-yet-merged count and arm onemore past the cap, and the next cycle's own budget read would then seemore merged pull requests than the cap ever permitted and wrongly tripthe counting-anomaly freeze (`merge_budget_apply_decision`) against anoperator who did nothing wrong — the gap a bound scoped to the sweep'sown pass alone could not close, since it never knew what the other callsite had armed. ALREADY_ARMED only ever tightens the `arm`/`hold`boundary; the `count` and `anomaly` `merge_budget_decide` reports stayexactly what GitHub's own merged-PR record read, so a call that holds acandidate back on the shared running tally never reports a false anomalyfor doing so.
**Neither this sweep nor this round's own arming step ever re-arms apull request GitHub's merge queue has already removed once and nobodyhas re-queued since** (PR #557 review round 2) — gate 6(`merge_queue_probe`, requirement 8d) treats a non-null `dequeue_reason`as a refusal regardless of which call site asks, distinguishing only therefusal's wording via `merge_queue_dequeue_actionable`(`lib/merge-queue.sh`): a `manual` removal is the maintainer's owndeliberate act (re-arming it would silently reverse their click everycycle for as long as the pull request stays open), and any other reason(chiefly `failed_checks`) is exactly what `scripts/gather-dequeued.sh`'sown `dequeued` source (requirement 3z) exists to diagnose and fix beforea human re-queues — arming it blindly here instead would re-run the samefailing merge group once per cycle indefinitely, an unbounded CI cost forno forward progress. Neither reading is this stage's own to retry: it isa different mechanism's pull request from the moment GitHub dequeues it,not a gate this stage may reasonably ask again later the way a budgethold or an unreadable check list can be.
`test/landing-wiring.test.sh` pins `_landing_stage_attempt`, calleddirectly with a non-empty `RETRY` (bypassing `run_landing_stage`'s owngate 0, which a retry attempt has none of), still arms an eligible,fully-cleared pull request and marks its `landing-armed` event `retry:true`; a `complexity:high` verdict from the classifier still armsnothing and marks the resulting `landing-refused` event `retry: true`the same way; and the ordinary path through `run_landing_stage` continuesto log no `retry` field at all. It also pins gate 6's dequeue check forboth call sites: a `manual` or a `failed_checks` `dequeue_reason` refusesarming (worded differently, per `merge_queue_dequeue_actionable`) whetherreached through `run_landing_stage` or directly with `RETRY` set, anempty `dequeue_reason` still arms normally, and gate 0 both reads`landing_armed_by_repo[selected_repo]` as ALREADY_ARMED and grows it byone after an arm — pinned directly by seeding the map before the call andreading it back after. `lib/union-log-scan.sh`'s own`landing_retry_source_map` is pinned directly: the most recent matching`selection` event's `source`/`item` wins, per branch, when a branch wasclaimed more than once (its two events carrying a different value foreach field, so the assertion measures which one won rather than passingeither way), both fields coming off that one winning event rather thana per-field reach-back into a superseded one, a different branchresolves independently from the same one-pass map, a malformed log lineis skipped rather than aborting the read, another repository's eventsnever leak into this one's map, and an unmatched branch or anunreadable/repo-less log both print `{}`.`test/landing-retry-sweep.test.sh` lifts `_landing_retry_sweep_repo`(`lib/landing.sh`) verbatim — the candidate rule that decides which pullrequests reach `_landing_stage_attempt` at all, with that function itselfstubbed to record what it is offered — and pins: below`agent-merges-routine` nothing is even listed; a draft, a`complexity:high` pull request and one carrying no `complexity:*` labelat all are excluded before any per-candidate read; a pull request with nostanding Approver `APPROVED` review is skipped silently, logging nothing(ordinary in-flight work, never a stall to report); a source`landing_retry_source_map` cannot resolve drops the candidate the sameway; a pull request a peer node's fleet-wide `pr-<n>` claim currentlyholds (issue #987) never reaches `_landing_stage_attempt` either, logginga `landing-retry-sweep-skipped-claimed` event that names the pullrequest, while a candidate the claim listing does not name is stilloffered, and the stubbed `_approver_sweep_claimed_pr_numbers` isconfirmed called at most once across a pass regardless of how manycandidates it holds; so is the stubbed `landing_retry_source_map` itself(#1050) — built once for the whole pass, never once per candidate;a truncated pull-request listing (`github_pr_list_truncated`) logs one`warning` naming the repository; and an unreadable default branch fallsback to `main` while a readable one is passed through unchanged. It alsopins the bound: across several eligible candidates in one pass, theALREADY_ARMED argument each successive `_landing_stage_attempt` callreceives is the stub's own running count of how many earlier candidatesin that same pass it reported as armed — `0` for the first, `1` for thesecond once the first armed, and so on — never reset mid-pass and neverfed back from a candidate the stub reported as refused; and that thisrunning count both starts from and writes back to`landing_armed_by_repo[SLUG]`, so a repository this sweep already armedcandidates for earlier the same cycle (a fixture pre-seeding the map)starts its own pass's tally there rather than at a fresh `0`, and themap holds the pass's own final count once it returns.`test/merge-budget.test.sh` pins `merge_budget_decide`'s own half of thebound directly: an ALREADY_ARMED count that pushes `count + ALREADY_ARMED`to or past the cap holds rather than arms, while the `count` and`anomaly` it reports stay exactly what the (unmodified) merged-PR countread — an ALREADY_ARMED-driven hold never reports `anomaly: true` on itsown.-
A pull request cannot rely on the cycle that owed it an Approver round to also deliver one (requirement 46, agent-ops#682, #890).
test/approver.test.shpasses against a stubbedgh:approver_review_ stalereadsCHANGES_REQUESTEDwith a mismatched commit as stale and everything else — anAPPROVEDstate, an empty state, an empty commit, an empty head — as not, with noghcall at all (a pure predicate);approver_newest_commit_authored_atreads the newest of severalauthoredDates regardless of list order, a single commit as its own newest, and returns non-zero printing nothing on an empty commit list, an unreadable one, or an empty pull request URL;approver_dismiss_reviewissues onePUT .../reviews/{id}/dismissalscarryingGH_TOKENfor that one invocation only (never leaking into the caller’s own environment, the same disciplineapprover_post_reviewalready holds) and the message given, never touching the ordinary review-post log, and attempts no write at all given no token, a non-numeric review id, or an empty pull request URL — reporting GitHub’s own refusal as a failure, never a dismissal.test/approver-restale-sweep.test.shlifts_approver_restale_sweep_repo(lib/approver.sh) verbatim — the candidate rule and routing logic, with_approver_restale_review,_approver_restale_dismissand_approver_restale_escalatestubbed to record what they are offered, the same splittest/landing-retry-sweep.test.shalready draws around_landing_stage_attempt— and pins: a stale review with a commit authored after it reaches_approver_restale_reviewexactly once, carrying the pull request’s own slug, url, branch, complexity and title, and never falls back to dismissal or escalation once it reportsposted; the same candidate falls back to_approver_restale_dismiss, naming the review id resolved from the reviews list, only when_approver_restale_reviewreportsunavailable, and never escalates on that pass; the identical candidate, when_approver_restale_reviewreportsunpostedinstead (agent-ops#988: a verdict was reached — most often an adjudicationescalate— but nothing was written to GitHub), falls back to neither dismissal nor a fresh engagement on the very next pass — a stubbedapprover_restale_unposted_prior_engagementfixture with no prior event still lets the first engagement through and logsapprover-restale-unposted-engagednaming the review id, while a second pass with that event now on the union log, still insideapprover_ restale_escalate_after_hoursof it, reaches neither_approver_restale_reviewnor_approver_restale_dismissagain; once that firstunpostedengagement is older than the threshold, the same pass reaches_approver_restale_escalateinstead — naming the identical review-scoped item ref the no-progress branch below uses, and its ownunpostedcause, so the issue a human opens does not claim every push since the review was a rebase — and never a fresh_approver_restale_reviewcall; a stale review with nothing authored since it (a rebase-only push) reaches neither_approver_restale_reviewnor_approver_restale_dismiss— underapprover_restale_escalate_after_hoursnothing at all is logged, and once the standing review’s ownsubmitted_atis older than the threshold_approver_restale_escalateis called instead, naming a review-round-scoped item ref (pr-<n>-approver-restale-<review-id>), the review’s ownsubmitted_at, neverupdatedAt, and the rebase-only cause rather than theunpostedone; a schema-illegalapprover_restale_escalate_after_hours(reaching jq’stonumberand erroring) computes an empty cutoff instead, which fails the same way — no escalation — but first logs awarningnaming the config key, the raw value and_approver_restale_sweep_repo, pinned at both the no-progress site and theunposted-bound site; a longer configured threshold holds the identical review back from escalation; a review whose commit still matches the pull request’s current head, a draft pull request, a currently-APPROVEDpull request and one with no readable head SHA are all excluded before any staleness read at all; an unreadable standing- review read is skipped silently (ordinary in-flight work, never a stall to report); a reviews-list entry for a different login or a differentsubmitted_atthan the one just read never resolves a review id, so nothing runs; nothing runs atmerge_autonomy: human(the Approver itself never engages there); and a truncated pull-request listing logs onewarningnaming the repository and saying a stale review beyond it is not swept this cycle; a pull request a peer node’s fleet-widepr-<n>claim currently holds (issue #987) reaches none of_approver_restale_review,_approver_restale_dismissor_approver_restale_escalate, logging anapprover-restale-sweep-skipped-claimedevent that names it, while a candidate the claim listing does not name is still offered normally; and a repository with a candidate in both the stale and the unreviewed trigger in the same pass still calls the stubbed_approver_sweep_claimed_pr_numbersexactly once, confirming the two triggers share the one fetch rather than each asking the registry for itself.The same harness lifts
approver_unreviewed_prior_engagementverbatim alongside the sweep and pins the unreviewed trigger (agent-ops#890) against the constructed case its acceptance criterion 6 asks for — ready, non-draft,pr_label, zero Approver reviews, pastapprover_unreviewed_engage_after_hours— never a live backlog item (criterion 7): that candidate reaches_approver_restale_reviewexactly once, inunreviewedmode, and its engagement is logged asapprover-unreviewed-engagedkeyed on the exact head and carrying the outcome; a draft, a candidate inside the engage bound, one under a live fleetpr-<n>claim, one with a standingAPPROVEDreview, one whose standing-review read is unreadable, and aCHANGES_REQUESTEDone are all left alone (the claim-held and unreadable cases logging nothing); a head whose prior engagement reportedpostedis never re-engaged, nor is one that reportedunposted(agent-ops#988), while anunavailableone is retried; a first engagement at the current head older thanapprover_restale_escalate_after_hourswith still no standing review reaches_approver_unreviewed_escalate— naming the head-scoped item ref and that first engagement’s own timestamp, never a fresh engagement — and an engagement recorded at a different head neither blocks nor escalates the current one. A schema-illegalapprover_restale_escalate_after_hoursat this second check logs the identicalwarningand never escalates, falling through to the samelast_resultcheck as before; and a schema-illegalapprover_unreviewed_engage_after_hourslogs its ownwarningnaming the key and value and returns before the trigger’s own candidate loop ever runs, rather than being indistinguishable from an empty backlog.A second harness in the same file lifts
_approver_restale_reviewitself verbatim, run underset -euo pipefailwith none of the five globals it borrows defined — the sweep’s own context, since it runs before the cycle has selected any work — and pins that it reaches a verdict rather than dying on the unset read, engagesrun_approver_stageunder the pull request’s own slug, its own fresh clone and the synthetic work order/Implementer summary/Reviewer summary, reportspostedin_approver_restale_review_resultwhen the stubbed stage reaches a verdict withapprover_stage_postedtrue — even when the stage writes its whole transcript to stdout (--once) — reportsunposted(agent-ops#988) when the stubbed stage reaches a verdict butapprover_stage_postedis false, reportsunavailablefor a stage that reached no verdict at all and for a clone that failed (engaging nothing in that case), restores every borrowed global, and tears its recovery clone down; called again inunreviewedmode it engages the stage under a synthetic work order namingpr-<n>-approver-unreviewedinstead, reporting its outcome through the same global.
46a. A newer authored commit whose diff is unchanged is not genuine
progress (requirement 46a, agent-ops#1806). test/rebase-only.test.sh
exercises lib/rebase-only.sh’s diff_patch_id/rebase_only_push
against a real, local, throwaway git fixture repository — no stubs, since
this is pure git plumbing: a clean rebase (the same change replayed onto
a base that moved somewhere the change never touches) reports
rebase-only; a manually-authored commit that reproduces the pre-conflict
diff byte-for-byte on the moved base — a different commit entirely, no
rebase ancestry — also reports rebase-only, pinning that the check is
about diff content, never commit ancestry; a resolution that changes the
diff reports not-rebase-only; and an unresolvable ref (a bogus SHA)
reports not-rebase-only too, with diff_patch_id printing nothing for
it, never guessed at as “unchanged”.
`test/approver-restale-sweep.test.sh` extends its own`_approver_restale_sweep_repo` harness (above) with a stubbed`_approver_restale_diff_unchanged`, steerable per candidate, and pins: acandidate with a commit authored after the standing review but adiff the stub reports unchanged reaches neither `_approver_restale_review`nor `_approver_restale_dismiss`, and, past `approver_restale_escalate_after_hours`, escalates under the same `rebase-only` cause andreview-scoped item ref the no-progress branch already uses — theidentical treatment a bare rebase gets, confirming the new gate foldsinto that branch rather than growing a third one; the control case,identical except the stub reports the diff changed, still reaches a realre-review exactly as every pre-#1806 case in the file does, confirmingthe new gate narrows nothing it should not.8v. A D18 rollout stage’s own exit criteria are measured, not recalled
(component 22). test/autonomy-stage-report.test.sh passes: a
repository at human (Stage 0) verdicts met once a baseline file
exists and merge_autonomy is configured; a repository at
agent-approves (Stage 1) short of its 15-agent-approved-pull-request
bar verdicts not-met (criterion: agent_approved_prs) even though its
other criterion (App-verdict/human-action divergence, component 22a) is
simultaneously unavailable, both its pull requests being unreadable
from GitHub in that fixture — a real failure outranks a merely-missing
measurement; a pr_url counted toward one repository’s agent-approved
count is never credited to a same-prefixed sibling repository (an exact
owner/repo/pull/ match, not a substring one). A repository at
agent-merges-routine (Stage 2/3) whose autonomous-landing count and
revert rate both clear their bars still verdicts insufficient-evidence,
never met, because classifier_escapes has no detector yet
(agent-ops#572) — no criterion is ever reported satisfied from missing
data. The revert-rate criterion reads the earliest dated
docs/reviews/*-merge-autonomy-baseline.md as the Stage 0 baseline, not
a later, worse one placed beside it in the fixture. A fifth repository,
at agent-approves with six agent-approved pull requests — five reading
clean and one 404ing from the stub — verdicts divergence: unavailable,
never met, even though the five it could read alone clear the minimum
sample and carry no divergence between them: a partial read never
certifies a zero (agent-ops#661), and its measured string still names
both the settled sample and the pull request left unread.
scripts/autonomy-stage-report.sh passes shellcheck.
72. The Approver’s verdict is paired with the pull request’s eventual fate,
and a divergence is never silently dropped (component 22a).
test/verdict-fate.test.sh passes: verdict_fate_posted_review maps the
Approver’s own verdict vocabulary onto the two GitHub review events the
Script posts and prints empty for a verdict that reaches neither;
verdict_fate_latest_per_pr collapses a pull request carrying several
approver-verdict events to its single latest by ts, excludes a
verdict whose review never reached GitHub (posted: false, or no mapped
review at all) while reading an event predating that field as true,
matches a repository by exact prefix so a same-prefix decoy is never
counted, derives repo from pr_url even for an event carrying no repo
field at all, and carries a pull request with two APPROVE verdicts’
first_approve_ts as the earlier one, not the later verdict’s own ts;
verdict_fate_classify returns each fate and comparison the record’s own
vocabulary names, with a human CHANGES_REQUESTED submitted after
FIRST_APPROVE_TS scoring changes-requested-after-approval/divergence
even once the pull request later lands anyway, a bot’s own
CHANGES_REQUESTED never counting as a human’s, and one submitted before
FIRST_APPROVE_TS not counting as “after” it; verdict_fate_summarize
excludes pending from both the sample and the rate, and reports
insufficient-sample rather than state a rate below the stated minimum.
The two are also exercised together, on the sequence that defeats
either read alone: fed verdict_fate_latest_per_pr’s own entry for a
pull request approved, sent a human CHANGES_REQUESTED, and re-approved,
verdict_fate_classify still scores
changes-requested-after-approval/divergence, and the same call handed
that entry’s latest ts instead of its first_approve_ts is asserted to
lose it — the composition, not either half, is where agent-ops#661’s
defect lived.
test/verdict-fate-report.test.sh passes: against a stubbed gh,
scripts/verdict-fate-report.sh exits 0 with a silent stderr, prints one
entry per pull request the Approver ruled on across every fate, counts a
superseded verdict once and as its later one, excludes a same-prefix
decoy repository, and honours --min-sample and --since; one of those
pull requests carries a human CHANGES_REQUESTED between two APPROVE
verdicts, so it records as a divergence only while the wrapper threads
first_approve_ts through to verdict_fate_classify — the end-to-end
guard that a caller cannot quietly drop the window (agent-ops#661).
test/autonomy-stage-report.test.sh’s fourth repository proves component
22 consumes that join rather than the unavailable placeholder it used
to report: five approved-and-landed pull requests carrying no human
CHANGES_REQUESTED verdict its divergence criterion met, naming the
sample the zero is backed by. lib/verdict-fate.sh and
scripts/verdict-fate-report.sh pass shellcheck.
71. The classifier-escape audit recomputes independently, never trusts
what it is auditing, and never confuses “cannot tell” with “clean”
(requirement 8e, agent-ops#572). test/detect-classifier-escapes.test.sh
pins the reimplemented protected-path matching, protected-path resolution,
routine-sources resolution and routine-complexity resolution in
scripts/detect-classifier-escapes.sh
byte-for-byte identical to lib/landing.sh’s own
_landing_is_protected/_landing_protected_paths/_landing_routine_sources/_landing_routine_complexity
(D18 Stage 3, agent-ops#724 and agent-ops#725, each pair resolving its own
key — merge_autonomy_protected_paths, merge_autonomy_routine_complexity —
the same repo-override-else-top-level-else-default way), over the same
battery of inputs, so none of them can drift apart
unnoticed despite none being sourced; it pins both protected-path
fallbacks against config.schema.json’s own declared
merge_autonomy_protected_paths default as well, since that is the pair
production rests on — the gate is called with the defaulted config and
resolves the schema’s copy, the detector with the raw --config file and
resolves its own literal; against a stubbed gh, a merged
pull request armed below agent-merges-all whose merge commit touches a
protected path (an injected
known escape) is reported classifier-escape even though it carries a
landing-armed event recording complexity: low — the detector’s own
recomputation, not the recorded value, is what disagreed — as are the
other three ways the recomputation can disagree: a complexity outside the
repository’s own merge_autonomy_routine_complexity standing at merge, a
source outside the repository’s routine
list, and a landing whose own landing-armed event records an effective
merge_autonomy level below agent-merges-routine even though every
other input agrees; the same protected-path hit recorded at
agent-merges-all, with every other input agreeing, is instead
outcome: "unverifiable" and never classifier-escape, naming the WI-12
compensating controls it defers to — while a complexity outside that same
routine-complexity list standing alongside that same unrecomputable hit
still reports
classifier-escape, naming the complexity rather than the protected
path, so an independently reconstructable disagreement is never masked by
one that is not; a
merged pull request whose recomputed level, complexity, source and
protected-path check all agree with its having landed is outcome: "clean"; a merge commit GitHub reports with no files array (too large
to enumerate), a merge commit whose files array reaches the 300-entry
cap (may be hiding more, exactly like the too-large case), a merge with
zero or more than one complexity:* label standing at merged_at, a
pr_url with no landing-armed event to read a source from, and a
landing-armed event recording no effective level at all are each
outcome: "unverifiable", never "clean" and — for the unrecorded
level — never classifier-escape either, asserted against a
config.json whose own merge_autonomy reads human, so a detector
that fell back to current configuration would fail the whole battery
rather than only this case; a pull request merged minutes ago (ESCAPE_AUDIT_NOW_EPOCH,
a test seam matching lib/token-expiry.sh’s own NOW_EPOCH convention)
with no landing-armed event in the log at all is deferred instead —
reported neither "unverifiable" nor anything else, and left able to be
read again on a later invocation of the same log, rather than
permanently recorded against a snapshot that may simply not have caught
up yet (agent-ops#2725) — while the identical pull request, merged an
hour ago by the same clock, is outcome: "unverifiable" once that
window passes, exactly as the immediate case above; a landing-armed
event genuinely present in the log, for a pull request merged long
enough ago that the deferral above cannot be the reason it was found, is
read back by its own pr_url round-trip, naming the source it recorded.
A pull request merged by an
account other than the passed-in Approver login is outcome: "not-approver", not an audit finding; and a pr_url already carrying a
classifier-escape/landing-audit/landing-audit-skip event in the
fleet log — whether a prior audit finding or a prior not-approver
record — is skipped before any gh call is spent on it at all, verified
by the stub logging every call it receives and the test asserting the
skipped pull request’s own number never appears in that log, not merely
absent from the detector’s output. The same stub refuses any call
carrying -f/-F fields without --method GET, since the real gh api
turns one into a POST — which these endpoints answer 404/422, so a
detector that read them that way would silently find nothing at all for
ever. test/landing-wiring.test.sh pins the other end of that
read-back: a successful arm’s own landing-armed event carries the
effective merge_autonomy level gate 1 judged it against (requirement
34). test/escape-audit-wiring.test.sh pins agent-cycle.sh’s own
translation of an outcome: "not-approver" line into its own
landing-audit-skip event, kept apart from landing-audit in the
logged fields. test/publish-dashboard.test.sh pins
counts.escape_audits’s aggregation over classifier-escape/
landing-audit events only — never landing-audit-skip — (all-time,
not windowed) and the per-row audit/audit_reason join into the WI-8
digest’s armed rows. ./scripts/lint-shell.sh is clean.
8w. A repository’s autonomy readiness is one verdict, and it never fails for
what it could not read (component 14, agent-ops#575).
test/doctor.test.sh passes, over the same single-target-repo fixture and
gh/rulesets stubs acceptance check 38g uses. The three new
preconditions first: at agent-merges-routine, a default-branch ruleset
whose pull_request rule reports dismiss_stale_reviews_on_push: false is
a fail and true an ok, both naming the repository and level; a
ruleset carrying any bypass_actors entry is a fail naming the count,
an empty one an ok; and both stay silent below the routine tier. The
Approver App installation’s live granted permissions are an ok at
exactly contents: write, metadata: read and pull_requests: write, a
fail naming the gap where one is narrower (contents is read, needs write) or where a fourth is granted (issues granted but not required),
a skip where the installation endpoint does not answer, and silent both
with no credential in this environment and with nothing configured above
human — exercised through lib/approver-token.sh’s real JWT signing
against a throwaway RSA key and a stubbed APPROVER_TOKEN_CURL, so the
check itself runs for real while no real network is reachable. The
consolidated verdict then prints once per repository at agent-approves
and above, and not at all at human — but which facts it consults
depends on the printed level. At agent-approves, over ma_approves_config
paired with stub_perm 200 '{"permissions":{"contents":"write","metadata":"read"}}'
(a live installation narrowed off pull_requests: write), the verdict is a
fail naming the Approver App installation's live permissions do not match exactly what this fleet needs (owner act), never an ok claiming
“is fully supported by its forge configuration” while the App cannot post
a review at all — the ruleset and merge-path facts play no part at this
level, since landing_arm is unreachable below agent-merges-routine
regardless of the ruleset or merge settings. From agent-merges-routine
upward those two join approver_app_id/approver_model_default and the
App installation’s permissions in the one verdict: ok where every
applicable precondition is satisfied; fail, never warn, where any is
not, naming each as an owner act (no active default-branch ruleset requires approving reviews (owner act), no merge queue and allow_auto_merge/allow_squash_merge are not both enabled (owner act)) or
a configuration error (approver_model_default is not set (configuration error)); and skip where the only gaps are ones this run could not
read — an unreachable rulesets endpoint, and an unreadable merge-queue
state, each named as unread rather than as never looked at. This
verdict’s own skip never raises doctor.sh’s exit status by itself:
for the rulesets case the run still exits 0, while an unreadable
merge-queue state exits 1 on the strength of the pairing check’s own
fail (acceptance check 8t) — a separate verdict answering the separate
question of whether landing works at all, not this one changing its
mind about what it could confirm.
70. file_debt/file_issue file what a stage found, and only the Script
ever writes (requirements 36c, 42a, agent-ops#631, revised agent-ops#874).
test/tech-debt-file.test.sh passes: techdebt_file_debt dedups first
against the target repository’s own open pw::type:tech-debt issues by
normalised title — an exact match, a normalised (case/punctuation-folded)
match, and a containment match (either direction, both titles at least
eight normalized characters) all get the new body and provenance as a
comment on the matched issue rather than a second filing, returning that
issue’s own number/url; a short needle never matches an unrelated long
title by containment, only by exact equality; failing a title match, a
provenance line naming the same pull request as an open issue’s own body
dedups the same way even when the two titles are unrelated
(agent-ops#2576), a provenance naming no pull request at all (the
Enabler’s own wording) never matches by that path, a pull-request number
that is merely a digit prefix of one the candidate body names (#25
against a body naming only #2567) never matches by that path either
while the pull request the body does name still matches with a trailing
path appended, and a title match is
still found ahead of a same-PR check naming a different pull request; an
unusable dedup search (not a JSON array) is skipped rather than failing
the filing; and the
search itself carries --limit TECHDEBT_DEDUP_LIST_LIMIT rather than
inheriting gh’s own default of 30, so a repository with more open debt
than that page still dedups against all of it. No dedup hit
creates a fresh issue labelled pw::type:tech-debt; a labelled create
that fails is retried once unlabelled and still succeeds, while an
unlabelled create that fails returns 1 with no output. A TOKEN argument
reaches every gh call; its absence explicitly unsets GH_TOKEN
— in a subshell (( unset GH_TOKEN; gh "$@" )), never env -u GH_TOKEN
— rather than merely omitting an override, so a value
this process happened to inherit cannot leak into a call meant to run
under the ordinary login. With lib/github-limit.sh sourced ahead of
lib/tech-debt-file.sh — the real shadow, which the suite’s own PATH
stub cannot stand in for — a gh that refuses once with a
secondary-rate-limit-shaped diagnostic and then succeeds is waited out
and retried, on the tokenless path exactly as on the token one
(agent-ops#2732): the subshell keeps the bare gh word a function call,
where env would have exec’d the binary and lost the wait.
No call ever touches git/refs or pr create —
there is no id reservation, no branch, and no pull request left in this
path, so there is nothing to clean up on any failure. techdebt_file_issue
(unchanged) returns an existing issue whose body already quotes the item
reference rather than filing a duplicate, and fails cleanly when creation
fails.
`test/approver-tech-debt-file-wiring.test.sh`,`test/enabler-tech-debt-file-wiring.test.sh` and`test/merge-observed.test.sh` pass, each lifting its own stage's block outof `agent-cycle.sh`/`lib/merge-observed.sh` verbatim (the same techniqueacceptance checks 8s–8w already rely on for the rest of the Approver'swiring, and `test/enabler-verdicts.test.sh` for the Enabler's) with`techdebt_file_debt`/`techdebt_file_issue` stubbed as recorders: awell-formed `file_debt`/`file_issue` on either stage's final JSON callsthe matching function with the repo, title, body, provenance, and(Approver only) the same App token `approver_post_review` already poststhe review under, then `default_fix`/`owner_decision` in that order, logs`tech-debt-filed`/`issue-filed` naming `by: "approver"`/`by: "enabler"`/`by: "reviewer"` and the returned `issue_number`/`issue_url` on success,and logs a `warning` — never a changed `verdict` — when the field ismissing a title or body, or when the filing call itself fails. Neitherfield is gated by which verdict accompanies it: an Enabler `unblocked` andan Approver `refuse` each still file alongside their own ordinaryhandling, proving the two are independent rather than one silentlysuppressing the other.8y. A stage files inline, on its own branch, and a stale pre-#874
reservation drains itself rather than sitting forever (agent-ops#631).
test/release-pending-reservations.test.sh passes (requirement 17g,
component 23f, TD-PPagop-26082427): with no state_repo configured, or
an empty reservation-releases/ tree, the script is a silent no-op that
calls gh not at all; a marker whose branch delete now succeeds is
reported "released" and its own marker file is cleared; a marker whose
branch delete fails but a follow-up read confirms the branch already
gone is reported "absent" and its marker is cleared the same way; a
marker whose delete fails again, while still younger than
reservation_release_stuck_after_days, is reported as a warning and
left in place, unlike the two outcomes above, neither of which leaves a
marker behind; a marker at least that many days past its own ts is
reported as reservation-release-stuck instead, exactly once, with
escalated_at written back onto the marker itself, and a marker already
carrying escalated_at reports nothing at all on a further failed
delete while the delete is still retried — the escalation fires past the
threshold and not before, and never twice; with 0 the escalation is
disabled and however old a marker gets it still reports the ordinary
warning, as does one whose own escalated_at write fails, so a
failed write never claims an escalation that did not persist; a
malformed marker (missing repo or branch) is reported as a
warning and left untouched rather than acted on; and two markers
naming different target repositories, in one invocation, are each
handled independently.
Requirements 24b and 30d are covered by`prompts/implementer.md`/`prompts/reviewer.md` naming the dedup-searchstep explicitly — `gh issue list -R <repo> --label pw::type:tech-debt--search "<working title>"` — before filing a fresh`pw::type:tech-debt` issue (read, not executed — an Implementer orReviewer engagement is a live model session this suite does not drive).8x. One durable audit record justifies every autonomous landing, and a
landing with none is an anomaly, not a null (D18, agent-ops#578).
_landing_stage_attempt (lib/landing.sh) logs landing-audit-record
once, in the same call that logs landing-armed, on every successful
arm — assembled at the moment of arming, never reconstructed later by
joining separate events at report time. It carries the pull request’s
own number and review_commit_sha (the Approver’s standing review’s own
commit_id, already read at gate 4 — never a fresh read for a fact this
cheap to reuse; the commit the Approver approved, not necessarily the
commit that actually merged — landing_protected_path_controls_ok is
the only gate that compares the two against a fresh head read, and it
runs only at agent-merges-all on a protected-path hit, so this field
alone can never be read as the commit that landed), the effective
merge_autonomy level and whether SLUG’s own repos[] entry or the
top-level key produced it
(merge_autonomy_resolution_source, lib/merge-autonomy.sh), the work
source and complexity label, the protected-path verdict
(clear/hit/unknown) and, on a hit, the protected paths it hit —
every changed file the classifier judged protected, never the full
changed-file list, and an empty array on a clear or unknown verdict
(a fresh landing_protected_paths_hit read, the same “never more than one
function call old” discipline gate 4.5’s own
landing_protected_path_controls_ok already applies to the same
primitive, rather than trust gate 2’s now-discarded read), the
Approver’s tier/model/verdict/adjudication and this pull request’s full
adjudication history (landing_approver_adjudication_history,
lib/landing.sh — every approver-verdict event this pull request ever
received, not only the one that authorised this landing, read from the
union of $union_log and ${log_file:-}, deduplicated — on both the
round that first approves a pull request and a 2.1e landing-retry
re-arm, so that a peer node’s refusal recorded only in $union_log
still appears in the history a first-approval round writes), every
deterministic gate this function itself just passed with its own
evidence — including the human-veto gate’s own blocking_reviewers list
(_handoff_blocking_reviewers’s return at gate 4, always empty here: a
non-empty list already refused before this line), carried beside that
gate’s verdict the same way the top-level protected_path object
already names the paths it examined, rather than the verdict alone — the
merge_budget_decide object gate 5 already computed
(cap/count/anomaly/waiting_backlog) and would otherwise discard
the moment decision == "arm" was confirmed, and the landing mechanism
(enqueued/auto-merge) landing_arm actually used. Written to
log.jsonl via the ordinary log_event, so it inherits that file’s own
analytics retention (requirement 2.6 — log.jsonl is one of the two
logs scripts/rotate-logs.sh never rotates) rather than the transcript
rotation state_dir/cycles/<id>/*.out is subject to.
`scripts/publish-dashboard.sh`'s WI-8 autonomous-landing digest joinseach armed row to this record by `pr_url` **and the arming cycle**,taking the earliest `landing-audit-record` at or after the arm — neverthe newest at or before, since `_landing_stage_attempt` always writes`landing-armed` first and `landing-audit-record` second, moments apartfrom the same call. The cycle carries the whole weight of pairing a*second* arm of the same pull request with the right record: ontimestamps alone, an arm whose record write never completed wouldadopt the next cycle's record for the same `pr_url` and render`anomaly: false`, hiding exactly the unexplained landing this panelexists to surface. `anomaly: true` marks a `landing-armed` with nomatching record — reported, never rendered with the silent nulls thedigest used to fall back to. The older `approver-verdict`-by-timestampjoin is retained as the fallback for a `landing-armed` from beforeacceptance check 8x shipped, which can never have a matching audit record:it explains that row's tier and verdict where one is locatable, andnever clears its `anomaly: true`, which the missing record alonedecides. `dashboard/index.html`'s landings panel adds a Record column(`ok`/`missing`) — its own column, beside requirement 8e's `Audit` onerather than folded into it — and a summary line naming how manylandings in the window carry no audit record.
`test/landing-wiring.test.sh`'s happy path asserts the audit record islogged alongside `landing-armed`, naming the pull request number,`review_commit_sha`, autonomy level/source, protected-path verdict, emptyadjudication history (nothing seeded), a passing gate's own evidence, thebudget object, and the mechanism. `test/landing-audit-record.test.sh` pinsthe record's full shape — every field, a protected-path hit, thehuman-veto gate's own empty `blocking_reviewers` list beside its `clear`verdict, and a non-empty adjudication history across a refuse streak —and proves`publish-dashboard.sh`'s own digest-assembly `jq` reads it correctlyfrom a raw synthetic `log.jsonl`: a landing with a matching recordrenders its tier/verdict, and one without is `anomaly: true`.`test/dashboard-render.test.sh` asserts the rendered panel shows"missing" for an anomalous landing rather than a bare "unknown".8z. The untrusted-content framing is present and identical in every
prompt (requirement 45). test/prompt-untrusted-framing.test.sh
passes: every shipped stage prompt — prompts/project-reviewer.md
included (docs/spec/review/requirements.md R18) — carries the marker-delimited
block exactly once, and every copy is byte-identical with requirement
45a’s canonical one, which the test lifts from this document at run
time rather than restating.
45e. A stage runs as its own Unix user (requirement 45e).
test/stage-boundary.test.sh passes. Anywhere, it proves that a
breadcrumb gives back only a github.com pull-request URL and never
through a link; that removal hands what it cannot finish to the stage
user; that sharing changes nothing without the stage group; and that
deploy/docker/stage-exec.sh strips every forge credential, App
identity and the notification secret, sets the token broker, the stage
git configuration and the node’s identity, passes stdin and the exit
status through, removes its own scratch directory, stops its whole
process group on a TERM and when its parent is killed, exits 143 at once
when a stopped stage has gone, stops a process the stage detached when
the stage ends, and stops without running the command when its parent is
not the one it was started by; that a bounded read is capped and is not
held by a FIFO; and that no cycle puts a directory under ~/.claude on
its PATH. In the node image
it also proves, across the two real users, that the stage user cannot
read a file only agent can, agent’s environment, or write /app or
an unshared directory of agent’s; that a forge credential agent
exports never reaches it; that it can run nothing as agent but the
token helper; that it can write a shared workspace, which agent then
removes even after the stage locked part of it, and a chain of locked
directories in one removal; that a TERM or a KILL to a stage’s process
group leaves none of its processes running; that a stray left by a stage
that killed its own wrapper is killed by the next launch while a stage
running at the same time is not; that requirement 4k’s vetting in a
workspace a stage has had never runs the stage’s core.fsmonitor as
agent, refuses a FIFO without waiting on it, and refuses a link to a
file only agent can read without reading it; and that a cache file the
stage user planted leaves no temporary file behind, and neither
/dev/shm nor a directory the stage user made is used as the cache.
test/forge-token-broker.test.sh proves the helper mints only for the
authoring App, from the environ file it is given and not the caller’s
environment, never gives the degrade token when a mint fails, refuses a
malformed owner, and accepts every owner the gh shim accepts;
test/gh-shim-auth.test.sh proves the shim
in a stage presents the broker’s token and identity, asks for the
call’s own owner, mints nothing and falls back to nothing.
-
The rework record matches
docs/reference/flow-schema.mdand is emitted at every one of the nine classes’ own detector sites (requirement 47).test/rework-record.test.shdriveslib/rework.sh’srework_fieldsdirectly — a well-formed evidence object, an unparseable one (degrades toevidence: nullrather than failing), a suppliedattributed_stageand an omitted one (null), andrepo/item/pr_urlpresent versus omitted — and separately exercises each detector’s own reduction against a canned event stream:review-gate-checks-read {ok: false}yields acheck-failurerecord andreview-gate-checks-degradedyields none; aclaim-lostwithcause: held/pr-heldyields aclaim-race-duplicaterecord and aclaim-lostwith nocauseat all, orcause: unreachable, yields none; a malformed event line in the stream is skipped rather than fatal to the reduction.scripts/lint-shell.shis clean on every file this requirement touches. -
Expensive per-repository gather runs for one repository per cycle, offset per node (requirement 48, agent-ops#1106).
test/expensive-gather-cache.test.shpasses:expensive_gather_pick_repopicks a never-cached repository over any already-cached one, breaks a tie among never-cached repositories on the calling node’s own offset (_expensive_gather_node_offset, a stablecksumhash ofnode_namereduced modulo the repository count) rather than slug ascending — two node names that hash to different offsets pick different slugs against the identical never-cached pair, and the same node name picks the same slug again on a re-run — and picks the oldest cache file once every configured repository has one;expensive_gather_cache_loadround-trips a saved object exactly, a band pastMAX_ARG_STRLEN(131072 bytes) included, and reads a zero-byte or corrupt cache file as absent — not{}— logging awarningthat names the slug;expensive_gather_pick_repotreats that same zero-byte or corrupt file as never-cached (epoch 0), so it is picked again the very next cycle rather than waiting out a full rotation;expensive_gather_cache_saveis atomic (no stray.tmpfile survives it), refuses (non-zero, no write) an empty or non-object third argument, and a single-repository set (--repo) always picks that repository; and a configured set whose sorted candidate lines outgrow one pipe buffer still picks cleanly under the caller’s own$(…)-under-set -eshape rather than dying 141 on thesort’s SIGPIPE (agent-ops#806’s shape — the assertion runs its caller as a separate process, because a subshell in a||context has its ownset -esuppressed and would pass either way).test/repo-entry-build.test.shstill passes unchanged for the per-repo entry-build block’s own eight-band shape, and additionally pinslib/candidate-gather.sh’s expensive-gather cache-save build itself, lifted the same way: per requirement 4g, its nine values (the eight bands plusissues_excluded) reachjqon stdin, never in argv, so a band pastMAX_ARG_STRLEN— agent-ops’s own rawtech_debtband has reached 421,622 bytes — round-trips through the real save+load intact rather than the build dying silently atexecveand leaving a 0-byte cache (agent-ops#1107).test/issue-state-reapply.test.shpasses:issue_state_reapply(lib/candidate-select.sh) drops a candidate the sampled source-state digest reports assigned orblocked-labelled, reporting"assigned"or"blocked-label"and giving"assigned"precedence when both apply; leaves an unsampled candidate untouched; folds a fresh drop into a priorissues_excludedset — a fresh drop’s own reason winning a clash with a stale cached one for the same number, and anullprior with no fresh drop stayingnullrather than a false[]— without ever dropping a prior entry whose own issue is no longer a candidate, and without that number-keyed clash rule flattening a prior number that carries both a deterministic reason and a co-occurring"blocked-by: <ref>"one (requirement 3j’s own two-entries-per-number shape, issue #2607) down to the first of the two: the fresh reason still overrides the stale deterministic one, while theblocked-by:entry — the only one requirement 35f’scompute_enabler_eligible_setsubtraction matches on — is carried through alongside it; and the cached-branch wiring ingather_ordered_repos(lib/candidate-gather.sh) calls it only when this cycle’s owngather_source_statesample reportsok == true, otherwise leaving a replayed band unfiltered by this reapplication.scripts/lint-shell.shis clean on every file this requirement touches. -
The item lifecycle record matches
docs/reference/flow-schema.md, the join key reaches every site requirement 49 names, and the fold balances (requirement 49).test/item-lifecycle.test.shdriveslib/item-lifecycle.sh’sitem_lifecycle_folddirectly against one fixture per terminal fate (landedviamerge-observed,voidedvia an unresolveditem-void,supersededviaorphan-branch-released {reason: "superseded"}with its item derived from anagent/<N>branch,abandonedviadraft-obsolete-flagged,blockedvia an unresolvedattempt-failed,openvia a barefirst-seen), the flow invariant balancing (totals.balanced) on a fixture carrying every fate at once, a voided-after-landed contradiction landing inunaccounted[]with its reason — and its mirror image, voided-before-landed, resolving tolandedoutright, not treated as a contradiction — an item carrying both a standing block and a draft-obsolete-flagged event resolving toblocked, neverabandoned,--sincebounding the population but never the fate an included item resolves to (an item entering the population on one within-window event still reportslanded/abandonedfrom merge/draft-obsolete-flagged evidence that sits before the bound), a landed item carrying a later item-scoped event (a secondpr-raised) resolvingfate: "landed"withreworked_after_landedpresent and naming that event and its own timestamp, an ordinary landed item with no later activity carrying noreworked_after_landedfield at all, and the degradation cases a malformed line, a missing field, an event naming no item, and an event whoserepois valid JSON but not a string all yielding a conforming report rather than aborting. The same test file drivesitem_lifecycle_pickup_pairsdirectly against a fixture carrying a bare, valid-JSON scalar line ahead of its object lines, asserting pairing is computed from the object lines rather than collapsing to the all-zero fallback the way an unguarded.ts/.eventindex on the scalar would.test/pickup-metrics.test.shpasses unchanged, exercisingitem_lifecycle_pickup_pairsindirectly throughscripts/pickup- metrics.sh‘s own unchanged CLI and output shape. The same test file also proves the de-duplication property requirement 2.6d states: two nodes’ own logs carrying overlapping events for the same item are each unioned with the other’s viafleet_logs(requirement 2.5,lib/fleet.sh), and the fold over each node’s own resulting union is asserted byte-identical to the other’s — the general “two nodes folding the same union produce identical record sets” property — and concatenating both folds’records[]and reducing by{repo, item}leaves exactly one record per item, never two. The join key itself —{repo, item}, present whenever the emitting site knows both and omitted, nevernull, otherwise — is pinned at each producing site by lifting the real code:test/stage-budget-apply-join- key.test.sh(stage-start, including the fleet-wide-REPO omission case),test/stage-end-join-key.test.sh(agent-cycle.sh’s own two item-scopedstage-endsites, the Implementer’s and the Reviewer’s, whichstage_budget_applydoes not write and the test above therefore does not reach),test/pr-raised-join-key.test.sh,test/checks-green-join- key.test.sh(checks-greenandreview-gate-checks-read, both call sites of each),test/standdown-sweep-join-key.test.sh(issue-closed-post-mergeandmerge-observedas wired fromscripts/sweep-closed-issues.sh’s own actions), and dedicated assertions intest/landing-wiring.test.sh(landing-armed/landing-refused, and the newmerge-observedatlib/landing.sh’s own arm site — fires only oncepr_merge_stateconfirms a synchronous merge, never on an enqueued arm),test/landing-retry-sweep.test.sh(landing_retry_source_map’s ownitemfield),test/approver-wiring.test.sh(approver-verdict),test/human-reviewer-handoff-wiring.test.sh(pr-ready, both call sites) andtest/sweep-closed-issues.test.sh(the sweep’s ownmerge-observedaction, bounded bypr_search_limitand de-duplicated per node across repeated runs of the same window, and a seen-file write the sweep cannot perform reporting awarningaction rather than losing the memo silently).scripts/lint-shell.shis clean on every file this requirement touches. -
The node time-state record matches
docs/reference/flow-schema.md, anode-statetransition reaches every site requirement 50 names, and the invariant balances (requirement 50).test/node-time-state.test.shdriveslib/node-time-state.shdirectly:node_time_state_for_causeagainst every one of the seventeen closed-vocabulary tokens, including the three translated rather than renamed (raced/pre-claimedtopeer-claimed,untraceabletocoordinator-declined) and an unrecognised cause (maps to nothing, never a guess);node_time_state_idle_splitagainst a positive eligible count, a zero count and an unreadable one;node_state_for_stageagainst the Implementer and Reviewer (producing) and every other actor (overhead); andnode_time_state_folddirectly against a fixture exercising all six states across two nodes at once, asserting: the flow invariant (balanced,expected_total_seconds, node-count x window) holds; a node absent for part of the window, and one absent for the whole of it, both scoredownfor exactly the ungoverned stretch, never more or less; widening the window with--untilextends the last transition’s own interval rather than truncating it; two overlapping event streams for one node — anagent-cycle.shrun and areview-cycle.shrun, unioned exactly asscripts/node-time-state.shunionslog.jsonlandreview-log.jsonl— still sum to exactly one window’s worth of seconds for that node, never double-counted, however the two streams interleave; and the degradations this requirement’s own acceptance names: an unrecognisedstatevalue lands inunaccounted_secondsrather than being dropped or misclassified, anidle-with-demandevent with no recognisedcausecounts underunspecifiedrather than a guessed one, a malformed raw line does not abort the fold (dropped before it ever becomes a candidate event, uncounted), and an event naming no node, or whosetsis present but failsfromdateiso8601, is excluded and counted underskipped_eventsrather than silently vanishing or aborting the whole fold to the fallback all-empty shape. Each of the three translated-not-renamed causes’ own assertions (raced/pre-claimedtopeer-claimed,untraceabletocoordinator-declined) pins the translation’s output distinctly from its input, which is what proves the originalstand-down/claim-lostevent’s own field stays untouched — the translation happens only on thenode-stateevent beside it, never in place.The same test also pins the silence rule at the sites most able to break it quietly, both structurally and end to end. Structurally, it scans
review-cycle.shfor everyset_node_state_terminalcall appearing ahead of the implementation-cycle check and asserts each is followed immediately bysuppress_node_state_if_peer_owns_node, plus that exactly six such sites exist — so the scan cannot pass vacuously, and a seventh ending added later cannot slip through unguarded. Behaviourally, it runs the realreview-cycle.shagainst a shim node (symlinks back into the tree with aconfig.jsonof its own, the harnesstest/review-not-before.test.shestablished) held off byrepository_review.defaults.not_before, and asserts all three readings: with a live process named inlock.jsonthe stand-down logs its own event and nonode-statetransition at all; with nolock.jsonit logsidle-without-demand/no-demandas before; and with alock.jsonnaming a pid that is gone it logs it too — which is what proves the guard is suppressing on the peer rather than swallowing the transition wholesale. The live and gone readings are then repeated againstreview-lock.json, for the peer review run the second probe answers about, and a fourth case pins the one guarded site that runs after the lock is won: with a usage-limit cooldown in force and this run’s own pid inreview-lock.json, the cooldown stand-down still logsexternally-blocked/usage-limit, which is what proves that probe excludes this process itself rather than reading its own lock as a peer.scripts/lint-shell.shis clean on every file this requirement touches.