docs/spec/implementation/acceptance-checks/acceptance-checks-04.md
Acceptance checks
Section titled “Acceptance checks”Acceptance checks — continued (part 4 of 10; items 39a–8s)
Section titled “Acceptance checks — continued (part 4 of 10; items 39a–8s)”39a. The Refiner’s candidate set is correctly bounded (requirements 39a,
39b). test/refiner-eligibility.test.sh passes: refiner_candidate_items
includes a pre-fetched item only when its source is not
refinement_policy-exempt, excludes one refinements_map already names,
one that is blocked, one that is void, and one that is claimed; a source
absent from refinement_policy is treated as exempt; a tech_debt entry
is a candidate under the same rule as every other pre-fetched source, so a
refinement_policy["tech-debt"] of "required" or "preferred" reaches
an engagement rather than shaping only the Co-Ordinator’s ranking; a
project_review and an implementation_plan entry each do the same under
that same rule, and a policy set for either finds nothing to gather when
the repos array does not carry the array (the ordinary shape of
ordered_repos_json, which never gains one — requirement 3y);
refiner_engagement_set caps the result deterministically by
(repo, source, item) and treats an unreadable MAX as 0.
test/enabler-verdicts.test.sh covers requirement 39a (The Refiner)’s third clause’s
other bypass of the already-refined exclusion, the one triage_only is
not: driving maybe_run_enabler to a decide verdict on a register
record that already carried a refinement, the resulting decision-taken
and item-refined events are replayed as a log in the order and with the
gap lib/enabler.sh writes them in, decisions_map still names the
decision after that re-record, and refiner_candidate_items still offers
the item — carrying decision, and carrying no triage_only, since this
candidate owes a whole specification rather than one field
(agent-ops#1049). The same file covers that decision’s other half
(requirement 36d, agent-ops#1057) against the real call sequence rather
than the two functions in isolation: with refiner_model set and a
tech-debt policy of "required" (not exempt), driving
compute_band_eligibility and then prefetch_refiner_sources, sourced
whole and run back to back in the order lib/gather-phase.sh calls them,
over one shared ordered_repos_json, the decided item leaves that
aggregate’s own tech_debt band — so no Co-Ordinator engagement can rank
it — while refiner_candidate_items, fed the resulting
refiner_repos_json, still offers it carrying the same pending decision.
Both halves are asserted together over the one aggregate because either
alone is the bug: asserting them against separately-constructed inputs
leaves a refiner_repos_json derived from the post-withholding aggregate
undetected, withholding the item from the Refiner too and so from the
only actor whose item-refined could ever free it (requirement 3y). A
second real-sequence case, over the identical pair of calls, proves the
reachability gate at the other end: a decision-pending candidate from a
band whose source refinement_policy leaves exempt (the installation’s
default for every source but issues and tech-debt) is not withheld
from ordered_repos_json — since refiner_candidate_items would never
have offered it to the Refiner either way, withholding it from the
Co-Ordinator too would leave it permanently unreachable, the second defect
the Reviewer and the Enabler confirmed on PR #2047. A third drives the
same pair with refiner_model empty and the same tech-debt: required
policy: the pass does not run at all, so the decided item is not
withheld — with no Refiner configured, nothing could ever supersede the
decision regardless of policy, so no cycle limit on the withholding could
ever be realised.
3y. The two Refiner-only gatherers read what requirement 3y says
(requirement 3y). test/gather-project-review.test.sh and
test/gather-implementation-plan.test.sh pass, each driving its script
against a stubbed gh: the review gatherer reads only the latest dated
folder, mints review-<date>-R-NN refs, carries each recommendation’s own
section and its matching improvement prompt — whole, including a nested
code block of the prompt’s own and the fence lines around it — and prints
[] for a repo with no reviews/ tree; --current-date reports the
latest folder’s own date, distinguishes a listing that offers no folder
(and a clean 404) as {"ok": true, "date": ""} from an API failure as
{"ok": false}, counts a failed second listing — the library walk’s own
call, which degrades to the same silence an unmatched listing produces —
among the failures rather than the definite emptiness that would retire
every review ref in the repository, and leaves the default mode’s []
unchanged for both; the plan gatherer returns open
tasks in document order, skips checked ones and lines whose leading token
is not a WORK_GONE_PLAN_RE id, and prints [] for a missing document.
Neither ever exits non-zero.
39c. The Refiner’s verdicts are recorded as stated, driving the real switch
(requirements 39c, 39d, 39e). test/refiner-verdicts.test.sh passes:
driving maybe_run_refiner itself — lifted verbatim from
lib/refinement.sh, the file that now carries it — a refined verdict on an
issues-source item carrying comments_posted produces exactly one
item-refined with by: "refiner" and the comment_url, plus the
refined_label add logged as an own-label-action; a non-issue item’s
refined verdict carrying refined_spec records the spec itself, with
no comment_url and no label write. The degradation is asserted from
both of its directions: an issues verdict with no comment — including a
comments_posted[0] that is a bare issue URL naming no comment at all,
or an array rather than a string, both treated identically to an empty
one by refinement_record_fields’s own shared shape check
(TD-PPagop-26082819, TD-PPagop-26082603; pinned directly in
test/needs-refinement.test.sh, since the shape check is the shared
function’s own, not maybe_run_refiner’s) — and a
non-issue verdict whose payload names spec instead of refined_spec —
the exact field-name mismatch between prompts/refiner.md and
refinement_record_fields that PR #283’s review caught by hand — earn a
warning and a refiner-examined with outcome refined-uncorroborated
and no item-refined, and the shipped prompt is asserted to name
refined_spec (never a bare spec field), so the prompt and the
consumer cannot silently drift apart again. A needs-refinement decline
is recorded through record_needs_refinement_block as an
attempt-failed attributed stage: "refiner" carrying the label and
assignee projections, while a decline with missing empty and one for
an item already blocked are refused (recorded: 0) with a warning and
no second block; an unrecognised verdict earns a warning and outcome
unknown-verdict, acted on in no way. Re-affirmation (39c) is pinned from
the same corroboration path: a refined verdict citing a comment URL
that is not this cycle’s own write — nothing distinguishes one in the
payload the Script reads — is recorded exactly like a fresh comment’s
URL, item-refined and the refined_label add both included, proving
the Script never demands the comment be freshly posted (agent-ops#670
Part 2). Requirement 39e’s containment:
a verdict for an item the cycle never claimed is discarded with a
warning and no refiner-examined at all, a claimed item the envelope
never mentions is warned about by name and left claimed, and an
engagement that exits non-zero or returns an unparseable final message
(its salvage resume also failing) records no verdict events at all,
expires every claim, and still returns 0.
39f. Own-label-action memory stops a failed removal reopening a block, and
tolerates clock skew and log propagation lag (requirement 39f;
agent-ops#526). test/label-marker.test.sh passes:
label_own_actions_map reduces to the latest action per repo+item+label
plus adds, every recorded add’s own timestamp; label_is_own_application
reads true only when own_class classifies the candidate ours —
some recorded add within LABEL_OWN_SKEW_TOLERANCE_SECONDS of
labelled_at, in either direction, even when a later remove was also
recorded — and false for both not-ours (a human’s later application,
an empty own record, or an empty labelled_at) and deferred
(labelled_at newer than LABEL_OWN_GRACE_SECONDS ago with no own
record yet); label_filter_own_applications drops exactly the ours
and deferred candidates from a gathered list, preserving the rest
verbatim, and drops none when the own map is empty or malformed.
label_own_stale_applications given no open blocks returns exactly the
ours set (never deferred, and never the same entries
label_filter_own_applications still reports as a hand-flag) — and given
a blocked extract returns nothing for an item with a block still open, of
any kind, in that same repo; it has nothing to retry when the own map is
empty or malformed, or when the blocked extract is malformed, the safe
direction for a write. Three fixtures pin the cases #526 found the
pre-existing exact-order comparison missing: an own.ts recorded a few
seconds behind labelled_at (within tolerance) is still ours, an
add matching labelled_at followed by a later recorded remove is
still ours, and a label with no own record at all but labelled_at
inside the grace window is deferred — reported neither as a hand-flag
nor offered for stale removal — while the identical case past the grace
window still earns the pre-#526 hand-flag treatment (requirement 34g
unchanged). test/needs-refinement.test.sh passes cases built on the call
site’s own composition of the two: a hand-flag scan that finds the label
still present after a simulated removal failure, with the own-action log
showing the Script’s own add and nothing since, does not manufacture a
fresh block, and that same candidate is exactly what
label_own_stale_applications hands back for refinement_label_remove
to retry once no block stands behind it — while a label a human applied
after the Script’s last action, one whose removal was recorded as having
succeeded, and one whose own block is still open, all earn their existing
treatment and none is ever handed back to retry. A fourth fixture pins
the deferred case at the call site: a candidate labelled inside the grace
window with no own record earns no fresh block and is not offered back
for a stale-removal retry either.
**`log_latest_ts` and the snapshot horizon (agent-ops#670).**`test/label-marker.test.sh` also passes: `log_latest_ts` prints thenewest `.ts` across a mixed log stream, skips a line that fails toparse rather than failing on it, and prints nothing for an empty,missing, or unreadable stream. A replay of the agent-ops#598 trace pinsthe fix directly: an own-actions map without the peer's record,`labelled_at` `2026-08-21T07:41:25Z`, `NOW` fixed at the snapshothorizon `2026-08-21T07:36:00Z` — *before* `labelled_at`, exactly thenegative-age case a snapshot taken earlier in the cycle than a peer'slater write produces — classifies **deferred**, not **not-ours**; thesame candidate with `NOW` fixed at `2026-08-21T08:12:36Z` (wall clock atthe moment the read-back actually ran in that incident) reproduces thepre-fix **not-ours** misattribution, pinning the regression the fixcloses rather than only the fix itself. A negative `labelled_at` age(label applied after `NOW`) always classifies **deferred**, never**not-ours**, pinned so an `abs()` "simplification" of `own_class`'s`($now_epoch - $at_epoch) < $grace` test cannot silently regress it.`label_own_stale_applications` given the same fixed horizon excludes acandidate whose `labelled_at` falls after it from the stale-removal set,the other half of the same fix. The call-site wiring in `agent-cycle.sh`is pinned separately, by `test/label-marker-horizon-wiring.test.sh`:`union_log_horizon` is assigned after the `fleet_logs` snapshot thatmaterialises `union_log` and textually before the first `>> "$union_log"`append later in the cycle, nothing repairs the snapshot or otherwisetouches it in between (a repair's `log-repaired` record, stamped withwall-clock time, once set the horizon on every cycle while a peer copystayed damaged), and both read-back calls(`label_filter_own_applications`, `label_own_stale_applications`) arehanded it rather than falling back to the `date -u` default. That fileasserts against the text of `agent-cycle.sh` rather than against a blocklifted out of it, because the capture's *position* is the thing undertest and lifting the block would lift the ordering with it. Every fixtureabove stays green through either break — they drive`label_filter_own_applications`/`label_own_stale_applications` directlyrather than through the cycle script — so an append reordered ahead of thecapture would otherwise make the horizon track wall clock again throughthis node's own fresh events and silently undo the fix.39g. Priority triage bands correctly and never lowers a band
(requirement 39g). test/refiner-priority-triage.test.sh passes:
refiner_candidate_items admits an already-refined issues or
tech-debt entry only
when priority_set is literally false, marks it triage_only: true,
excludes a banded or claimed/blocked/void/exempt one exactly as
requirement 39a (The Refiner) already requires, and never admits an entry carrying no
priority_set key at all — the pre-existing shape every source but
issues/tech-debt still carries, and a tech-debt entry carrying a
priority_set: false band reaches maybe_run_refiner’s own priority
application the same way an issues one does. lib/issue-priority.sh’s ratchet, driven
against a stubbed gh: issue_priority_field_ids resolves the field
and option ids from a live GraphQL read and fails (never an empty
result read as “nothing to band”) when the field is absent;
issue_priority_apply re-reads the issue’s current band immediately
before writing, applies only when unset or strictly outranked by the
verdict’s own band, and skips — logged, not warned — an equal or lower
one, asserted from both directions; issue_priority_current itself
returns the raw option name unfiltered, and a current band outside the
four ranked names is skipped as skipped-unrankable — logged, not
warned, and never overwritten even by a verdict that would otherwise
strictly outrank it (agent-ops#509); a field or issue read failure, and a
failed mutation, are each a distinct failure reason, never silently
read as a skip. A failed mutation additionally carries the error key
(agent-ops#960), asserted from both directions against a stubbed gh
that writes to stderr before it fails: a rejection carrying a
type-mismatch-shaped GraphQL error yields that error’s first line and no
subsequent line, and a rejection with no stderr at all yields the key
still present and empty, never omitted. The cache directory’s own
lifecycle: sourcing the
library with ISSUE_PRIORITY_CACHE_DIR unset creates a directory and
marks it owned, and issue_priority_cache_cleanup then removes it —
fixture files inside it included, since an empty rm -rf proves nothing
about the real per-SLUG cache it stands in for — while a caller-supplied
path is marked unowned and still exists after the same call; a second
call once it has already run, and a call in a process where the
mktemp -d never produced a directory at all, each print nothing and
still return 0; re-sourcing the library in the same process, with
ISSUE_PRIORITY_CACHE_DIR still set to the directory the first source
created, still marks it owned rather than reading it as caller-supplied,
creates no second directory, and cleanup still removes it
(agent-ops#541). Repointing ISSUE_PRIORITY_CACHE_DIR to a caller’s own
directory and re-sourcing, then unsetting it and re-sourcing again, makes
the library create a second directory in the same process; both are
tracked in ISSUE_PRIORITY_CACHE_DIR_OWNED_PATHS, and a single
issue_priority_cache_cleanup call removes both while leaving the
caller’s own directory, sitting between them, untouched
(TD-PPagop-26082202). An ownership record exported to a bash -c child
process — ISSUE_PRIORITY_CACHE_DIR, …_OWNED=1 and …_OWNED_PATHS all
inherited, but stamped with the parent’s own $$ rather than the
child’s — is not trusted: the child marks the directory unowned, and its
own issue_priority_cache_cleanup call leaves the directory in place. The
array form of that same inherited-record check is asserted independently,
since bash cannot export an array and a parent can therefore only ever
export ISSUE_PRIORITY_CACHE_DIR_OWNED_PATHS as a scalar: with
ISSUE_PRIORITY_CACHE_DIR itself left unset so the child takes the
fresh-directory branch rather than the caller-supplied one, a bash -c
child that inherits …_OWNED_PATHS as a scalar naming a victim directory,
…_OWNED=1 and the parent’s own (foreign) …_OWNER_PID resets its own
array to hold only the directory it just created, rather than appending
onto the inherited scalar and folding the victim path into a record its
own issue_priority_cache_cleanup call would then rm -rf — the victim
directory still exists once that call returns (agent-ops#552). A
source that follows a cleanup does not trust the record cleanup left
behind: it creates a fresh directory, marks it owned, and field-id
caching works again in that process. A cleanup reached through a command
substitution is pinned as a case of its own, since that direct call
clears the record before the re-source ever reads it and so leaves the
source-time existence check unexercised: the subshell removes the
directory but its record-clearing never reaches the parent, which
re-sources holding a record still marked owned, still stamped with this
same $$ and still naming the now-removed directory, and a fresh owned
directory is created and caches field ids regardless (agent-ops#552). A
directory this file created is not abandoned when a caller subsequently
repoints ISSUE_PRIORITY_CACHE_DIR at its own path:
issue_priority_cache_cleanup still finds and removes the directory it
made earlier, and leaves the caller’s own (now-current)
directory, and ISSUE_PRIORITY_CACHE_DIR itself, untouched (agent-ops#552).
A failed cache write — ISSUE_PRIORITY_CACHE_DIR naming a directory
that does not exist — prints nothing to stderr, and still returns the
resolution it could not cache. A field missing one of the four options
is asserted from both directions (agent-ops#534): with a lower option
present, the verdict’s band falls back to the nearest lower one and
requested names the band actually asked for; with nothing lower
present (the verdict was already Low, or every lower band is also
missing), the fallback ties
upward to the nearest higher option instead; the ratchet then runs
against the fallback band, so a fallback that does not outrank the
current band is still skipped-lower-or-equal with requested still
reported; and a field with none of the four names writable at all is
band-option-missing, a reason distinct from field-unresolvable, with
no gh calls beyond the field resolution itself. maybe_run_refiner’s
wiring: an ordinary refined
verdict carrying priority records both item-refined and
issue-prioritised; a triage_only item’s priority-only verdict
records neither item-refined nor a label, with outcome triage-only
and no uncorroborated-comment warning; a needs-refinement verdict
carrying priority still applies the band despite the decline; the same
verdict on a triage_only item records no block, no
needs_refinement label and no blocked/blocked:needs-refinement
labels, with outcome triage-only-refused and a warning, while its
band still applies; a
failed band write is a warning that leaves the refinement or block
already recorded untouched — naming both the band actually attempted and
the band the verdict asked for when the failure followed a fallback, and
the verdict’s own band alone when it did not (agent-ops#551), and
appending the mutation’s own captured GraphQL error when the result
carries a non-empty error and no such clause at all when it is empty
(agent-ops#960) — while an
unrankable current band is not — it logs issue-prioritised-skipped
like any other ordinary skip, still carrying requested when a fallback
ran; and
DRY_RUN reaches no gh call and writes no event at all —
maybe_run_refiner’s own first guard already returns before any
candidate is claimed. scripts/gather-issues.sh’s priority_set is
asserted true for an issue banded outside the four names, with
priority itself still reading Medium (test/issues-prefetch.test.sh).
scripts/doctor.sh‘s own gate is asserted against the four banded
sources tokens a valid configuration actually carries, so the check
cannot regress to one that never runs, and its own EXIT trap is asserted
against an isolated TMPDIR left empty by all three of its exit paths —
a clean pass, --help, and an unreadable --config, the two of which
exit before any check runs at all (test/doctor.test.sh). The
pre-flight (issue #511):
refiner_drop_unbandable_triage (lib/refinement.sh) drops only the
named repositories’ triage_only entries, leaves every other candidate
from those repositories and every candidate from any other repository
untouched, is the identity on an empty unresolvable-repository list, and
falls back to its input unchanged (never []) on malformed candidates
JSON. issue_priority_options_any (lib/issue-priority.sh,
agent-ops#542) is asserted true whenever the field carries at least one
of the four band names, including only one, and false only when it
carries none. refiner_filter_unbandable_triage (lib/refinement.sh),
lifted verbatim and driven against a stubbed gh distinguishing three
repositories — one whose field query fails outright, one whose field
resolves carrying none of the four band names, one whose field resolves
complete: the failing repository’s and the no-bands repository’s
triage_only candidates never reach the returned set while their other
candidates and the complete repository’s candidates — triage_only or
not — do; exactly one warning per dropped repository is logged, each
naming the repository and the count of candidates it dropped, not one per
item, with the no-bands repository’s wording distinct from the
field-unresolvable one; a repository missing only some of the four
names is asserted unaffected by this pre-flight, reaching the returned
set byte-identical with no warning logged; a repeat resolution of any of
these repositories in the same process hits
issue_priority_field_ids’s own cache rather than issuing a second
query, including for the failing repository’s cached failure; a cycle
with no triage_only candidate at all issues no field query from this
path; and when every contributing repository’s field resolves with at
least one band option, the returned set is byte-identical to the input.
The call site’s own guard (issue #567): lifted verbatim by the comment
that immediately precedes it, since it is a call site rather than a
function of its own, and driven with a stubbed
refiner_filter_unbandable_triage counting its own invocations — with
refiner_model empty the pre-flight is never called at all, and with it
set the pre-flight still runs exactly once, unchanged.
**Every filing path bands what it files, and the ranking reads the band(requirement 1, agent-ops#2422).** Each of the Script's own filers hasits own test, driven against a stubbed `gh`, so none can regress alone:`test/tech-debt-file.test.sh` asserts `techdebt_file_issue` and`techdebt_file_debt` each reach the ratchet on a fresh create, never onthe dedup path (which returns the existing issue with its own banduntouched), and silently skip an empty or unrecognised band;`test/pager.test.sh` asserts the `High` option id actually written;`test/merge-budget.test.sh` the freeze escalation's `Urgent`;`test/sweep-decision-vetoes.test.sh` the revisit issue's `High`; and`test/monitor-priority-filing.test.sh` the Monitor's own two(MON AC 5d). The three stages that statea band in a verdict rather than writing it are covered at the wiring:`test/approver-tech-debt-file-wiring.test.sh`,`test/enabler-tech-debt-file-wiring.test.sh` and`test/merge-observed.test.sh` each assert the verdict's own `priority`arrives as the filer's trailing argument, and arrives empty where theverdict names none.
Priority inheritance (requirement 15e's own "may already be raised")is asserted directly in `test/dependency-gate.test.sh` —`issue_priority_inherit` raises a `Low` item that a `High` item names asits `Blocked-by:` dependency and names the raiser in`priority_raised_by`; never lowers a blocker that already outranks whatit blocks, and leaves no `priority_raised_by` where no raise happened;takes the highest of two blocked items' bands, naming only the itemcarrying it; ignores a cross-repository reference; and is the identity onan empty array, falling back to its input unchanged on malformed JSON —and end to end through both shipped gatherers, in`test/issues-prefetch.test.sh` and `test/gather-tech-debt.test.sh`, wherethe raised entry reaches the Co-Ordinator's own array banded and marked,the blocked item is held out by requirement 34j as usual, `priority_set`still reports the raise target's own triage rather than the raise, andthe tech-debt case's raiser is a non-tech-debt issue, proving inheritancecrosses the two bands. The trim order that makes it matter is asserted in`test/coordinator-input.test.sh`: capping a 62-entry tech-debt band keepsthe inherited-`Urgent` entry and the `High` entry it blocks, drops onlylower ones, keeps the raised entry's `priority_raised_by` through thecap, and at a cap of one keeps the single highest-ranked entry.11c. A broken Enabler cannot break a cycle (requirement 37). With a stubbed
stage that times out, exits non-zero, or (after requirement 9e’s salvage
resume also fails to parse) returns prose instead of JSON: the
cycle still exits 0, logs stage-end and one warning, writes no
unblocked, item-void, escalated or enabler-examined event. The
warning names every item the discarded engagement was given
(items: [{repo, item}, …]), and each of those items’ 35c tombstone is
expired rather than released — test/claim.test.sh passes: an expired
entry’s registry file still exists with its ts backdated and every
other field unchanged, and a gc run immediately afterward retires it.
Assert the ordering too — the engagement’s events precede
cycle-end — and that a limit phrase in that transcript produces an ordinary
limit-hit rather than being swallowed with the rest of the failure.
33a. The per-stage metering record matches docs/reference/metering-schema.md
(requirement 33a). test/metering.test.sh passes: lib/metering.sh’s
metering_fields derives model, provider (read from
lib/model-id.sh’s MODEL_PROVIDER, falling back to anthropic for a
model never resolved through resolve_model_id_into, and for an empty
one — which under set -euo pipefail resolves to that same fallback
rather than aborting the caller on bash’s own bad-array-subscript error
for an empty associative-array subscript, issue #2234), cost_usd,
duration_ms, num_turns,
is_error and tokens{input,output,cache_creation,cache_read} from a
single-model envelope and from a multi-model (subagent) envelope, summing
tokens across every modelUsage entry in the latter; a genuinely zero or
false value survives rather than collapsing to null; a missing, empty
or unparseable out-file degrades the envelope-derived fields to null
while model keeps the id it was passed; and an envelope whose
modelUsage entries are unreadable still yields one valid object, so no
envelope can cost a stage-end event its stage and exit_code. It also
derives lane (api, subscription or null — issue #2239, D30) from
the lane lib/stage-run.sh passes in alongside the gap statistics, not
from the envelope: test/metering.test.sh asserts it is carried through
exactly as given and degrades to null, never a guessed lane, when
omitted or unparseable; test/stage-run.test.sh asserts
lib/substrate-claude-code.sh‘s own substrate_claude_code_lane_of maps
a stub stream’s init event to the lane run_model_stage then carries
into stage_lane_json. Both
agent-cycle.sh and review-cycle.sh source
lib/metering.sh and merge its output into every stage-end /
review-stage-end event they log, so this one function’s correctness is
what “both pipelines emit conforming records” reduces to.
77. The configuration matches its schema, and the schema is an enforced
startup gate, not merely a checkable one (requirement 1b).
test/config-schema.test.sh passes: this repository’s own config.json
validates, so a key added to the config without a schema entry fails
immediately; every keyword the schema uses is one lib/config-schema.sh
implements, asserted by reading the keywords back out of the schema
rather than from a list maintained beside it; each keyword class is
exercised with a value that must be rejected, naming the path that is
wrong; and scripts/doctor.sh reproduces the two surviving cross-key
guards (the Enabler’s assignee, the implementation-plan path) as a
fail, its silent-breach combinations as a warn, and a config that
will not parse as exit 2 with nothing downstream attempted. Beyond the
library level, agent-cycle.sh and review-cycle.sh themselves are
driven end to end against a schema-violating config — with claude and
gh stubbed so reaching either would itself mean the gate had failed —
and asserted to exit non-zero naming config.schema.json, before either
stub is ever reached; the retired nice and prompt_overrides guards’
own wording is asserted gone in favour of the schema’s, and the
surviving Enabler-assignee guard is asserted to still fire on a config
the schema itself accepts — as is the duplicate-repos[]-slug refusal,
which exits 1 naming the repeated slug rather than reporting a schema
failure the schema itself does not find. Every case is a mutation of
test/fixtures/config-base.json — a configuration the suite owns, which
names no merge_autonomy or approver_* key at all, so a cross-key
rule’s negative case builds the state it claims to test instead of
inheriting half of it — run against the shipped scripts, so what is
asserted is the product rather than a restatement of it. That fixture is
itself asserted to validate against the schema, so a required key added
to the schema fails once, naming it. The shipped config.json is read
for two things only: that it validates, and that doctor.sh passes it
(including its own merge_autonomy pairing, at whichever rung the file
names — read back from it, never written down here). --offline
throughout: no assertion here needs the network.
A documented installation value is checked against the live config thesame way (`config_documented_value_mismatches`, issue #567): a key whose`x-docs.value` differs from its own schema `default` — `refiner_model`documented as `claude-haiku-4-5-20251001` while the key had never oncebeen set — earns a `warn` naming the key, the documented value and theresolved one; an empty resolved value renders `*(unset)*`, and anarray-valued documented cell is compared by its parsed JSON rather thanthis script's rendered text, so `[5]` against a documented `[0]` stillwarns while whitespace alone never does; `merge_autonomy` — whose`x-docs.value` equals its own `default` — earns no such warning at anyrung, at either the top-level key or a repository's own override; a keywith no `x-docs.value` at all, and one whose `x-docs.value` is an objectkeyed `readme`/`spec`, are both asserted silent even set far from theirown default; and the shipped `config.json`, unmodified, is asserted toreport no such mismatch at all — closing the loop #568 opened byinstalling `refiner_model` for real.
That drift check's own coverage is itself checked (`config_documented_value_coverage_gaps`,issue #2653): `config_documented_value_mismatches`'s `leaf_paths` walkdecides where to stop descending the schema the same way it decides whatcounts as a documented leaf — a node with no `properties` of its ownafter `$ref` resolution, or one that carries `properties` alongside itsown `default` (issue #2674's and PR #2647's shared stop condition,`has("properties") and not has("default")` deciding whether to recurse).That second clause is what keeps a key whose `$ref` target carries itsown `properties` member (the dual-shape `modelIdOrSet`/`modelIdOrEmptyOrSet`PR #2647 points every `*_model` key at, carrying `properties.models`)from dropping out of the walk silently, with no change to`config_documented_value_mismatches`'s own output when the live configalready matches what is documented — the one case nothing else wouldnotice. `config_documented_value_coverage_gaps`walks the schema independently, checking the documented-value conditionat every node along the way rather than only the ones `leaf_paths`happens to stop at, and reports any key the two walks disagree on. Aconstructed schema and config — built from scratch rather than derivedfrom `config.schema.json`, since the scenario is a property of theschema's own shape — assert this directly: a key is covered while its`$ref` target carries no `properties`, and still covered once it gains anempty one (its own merged node still carries both `properties` and itsown `default`), with `config_documented_value_mismatches`'s own outputunchanged across the mutation. Run over the shipped schema itself, thesame check is pinned to empty — every documented key is reached,including `refinement_policy` and `revert_rate_baseline`: each carriesits own `x-docs.value`/`default` naming a whole documented objectalongside `properties` of its own for shape validation, exactly the dualshape the stop condition treats as a leaf, so neither drops out ofcoverage (issue #2674). Pinned to empty, not merely asserted absent ofany particular name, so a key dropping out ofcoverage still turns this assertion red. That both keys are checkedrather than merely reached is asserted on the drift itself: a configresolving `refinement_policy` or `revert_rate_baseline` to anythingother than what the schema documents earns a `config_documented_value_mismatches`mismatch naming the key, the same way `refiner_model` (issue #567) doesabove.- The prose configuration tables are generated from the schema, and
regenerating them is gated (requirement 1b, component 16).
scripts/render-config-table.shwith no arguments run against this repository’s ownconfig.schema.json,docs/reference/configuration.md,docs/spec/implementation/README.mdanddocs/spec/review/README.mdleaves every file byte-identical to what is committed — regenerating a clean tree is a no-op — and--checkexits 0 against it;git diffconfirms nothing moved.test/render-config-table.test.shpasses: a key present in a fixture schema and absent from a region is added, a hand-edited row is restored,--checkexits non-zero naming the file, the region and the first differing key on a stale region and zero on a fresh one, a|inside prose survives escaped, four distinctx-docs.valuerows render verbatim, anx-docs.valuekeyed per audience gives each document its own value cell and falls through to the schemadefaultfor an audience it does not name, a key carrying nox-docsfor an audience falls back todescription, and a region whose first two lines are not a header row and a delimiter row is refused rather than rendered. A note over 500 characters is truncated at a word boundary — never inside a code span (single- or double-backtick delimited, the latter’s content free to carry a literal backtick) or a link, each covered by its own fixture note — with its full text reproduced in the matching Extended notes subsection, including for a dotted (schedule.*-style) key; a document with two Extended notes headings that would slug the same is refused, and so is a document missing either half of aconfig-table:notesmarker pair. A note that is an array of blocks (#220) — two paragraph strings; a paragraph, alistblock and a paragraph; a paragraph, acodeblock and a paragraph, each over the cap — flattens to one space-joined table-cell line (the list’s items comma-joined, the code’s newlines turned to spaces and backtick-wrapped, backing off to a wider delimiter with padding spaces when the code itself contains a backtick) and, separately, renders as real block Markdown in the Extended notes subsection: a blank line between paragraphs, real-list items, a real fenced code block, each still blank-line-separated from its neighbours; alist-only orcode-only note under the cap degrades the same way in its cell with no Extended notes subsection generated at all. A start marker carrying trailing prose after itsid=<id>token (#356) is matched and rewritten the same as one without: the fixture’s markers carry it and every render/--checkassertion above still passes against them, and the plain, unannotated form is separately exercised too (the orphan-marker fixture used for the no-heading-above-it case), proving both forms are accepted rather than only the newly-annotated one..github/workflows/config-table.ymlruns--checkon every pull request, so a schema edit landing without a matching doc regeneration (or the reverse) fails CI rather than drifting the wayunvoid_labelandstate_local_cycles_retainedboth did before this requirement existed. 1m.doctor.shchecks write access, Claude credentials, the rendered crontab andnicereordering, and--offlinestill runs the two that need no network (requirement 1b, component 14).test/doctor.test.shpasses, against a stubbedghandclaudeonPATH— the seamdoctor.shleaves for both, carrying no override variable for either — run without--offlineso these checks are actually exercised, with nothing onPATHable to reach a real network regardless: on the PAT path a.permissions.pushoftrueisok,falseisfail, and an absent field isskip;.archived: trueisfaileven when.permissions.pushistrue; under the forge authoring App — stubbed throughAUTHOR_TOKEN_CURLwith a throwaway key,GH_TOKENexported empty as the cron view has it —.permissionsall false is not read as “cannot push” (agent-ops#1397), an installation carryingcontents: writeover a covered repository isok, a narrower grant or a selection leaving the repository out isfailnaming which, and either installation read being unreachable isskip; Claude credentials check both of D4/D30’s two lanes independently — theapilane’s non-emptyANTHROPIC_API_KEYshaped like an Anthropic key (thesk-ant-prefix) isokoutright when it is shapedsk-ant-api, which the check reads as a key scoped at creation to a single workspace; one shapedsk-ant-but notsk-ant-apiisokonly with a well-shapedANTHROPIC_WORKSPACE_ID(wrkspc_…) or anANTHROPIC_CUSTOM_HEADERSalready naminganthropic-workspace-id— otherwisewarn, naming a malformed id when that is why (issue #2309); one not shaped like an Anthropic key at all iswarn, and its absence isoknaming it absent, each naming the lane’s configured weight and whether it is enabled; thesubscriptionlane’s ownclaude auth status --json— run withANTHROPIC_API_KEYstripped from that call’s environment, so it is checked regardless of whether theapilane above is also present — reportingloggedIn: truewith asubscriptionTypeisoknaming the lane present,loggedIn: truewith nosubscriptionTypeisoknaming a Console account rather than an open subscription lane (#2241), andloggedIn: falseisoknaming it absent, each of these three naming the lane’s configured weight and whether it is enabled, exactly as theapilane’s own lines do; both lanes absent isfail— distinguished from the subscription lane’s own parse failure, sinceloggedIn: falseis a legitimate answer rather than evidence the JSON could not be read — and aclaudewith noauthsubcommand leaves the subscription laneskip; the realdeploy/docker/render-crontab.shrun against a config whoseschedule.excluded_minutesrules out every minute isfail, the same renderer run against a trimmed copy of the repository missingcrontab.tmplisskip, and a clean render isoknaming the node and the cycle, review and heartbeat minutes the config asked for, and whether the cycle minute came from an explicit, allowedCYCLE_MINUTEor was hashed from the node’s name; a secondokline names the background timer minutes (state_sync_push_minutes,state_sync_fetch_minutes,log_rotation_minute) the config asked for; a repository with a non-zeronicegets its own line naming the value and the multiplier, and one with every repository atnice0 prints no line at all; and--offlinestill renders the crontab and reportsnicereordering while reporting write access and Claude credentials asskip. Must passshellcheck. 1n.--unattendedruns the GitHub section in full and skips only the two checks that spend, with wording distinct from--offline’s, and writesstate_dir/.doctor-status.json(requirement 2.6a).test/doctor.test.shpasses: against the same stubbedghandclaude, a run with--unattendedstill reports write access (the GitHub section is not skipped, unlike under--offline); Claude credentials and the stream-flushing probe are each reportedskipnaming--unattended, never--offline’s wording; still under--unattendedand spending no call and reading no live credential (agent-ops#2308), this node’s ownstate_dir/log.jsonlis read for the newest Co-Ordinatorattempt-failedsince its last Co-Ordinator success — a credential- shaped refusal (authentication_failed,workspace_scope_refused, or a 4xxapi_error_<status>) isfail, naming the event’s ownapi_message; a Co-Ordinator success since that refusal clears it; and a node with nolog.jsonlat all (or none since its last success) reports nothing extra, exactly as before this check existed — nothing on stdout or stderr, the read being guarded by the file’s own existence rather than by a redirection’s2>/dev/null, which bash applies after the input redirection it would have to cover; a completed run leavesstate_dir/.doctor-status.jsonwith atimestamp(a real UTC instant), averdict(the worst offail/warn/okthis run found), itsfails/warnsas arrays of the exact messages printed, and atoken_expiry(requirement 2.7a) that is{expires_at, days_remaining}when the GitHub section read aGitHub-Authentication-Token-Expirationheader andnullwhen it did not; an ordinary run with neither flag writes no such file and runs the Claude section for real, against the stub. Must passshellcheck. 6h. The pipeline creates the labels it applies, and touches no others (requirement 6a).test/labels.test.shpasses against a stubbedghthat records every invocation and refuses a duplicate the way GitHub does: an empty repository receives every label of its role and each is reported created,obsoleteincluded alongsideblockedas one of the two non-configurable, human-only labels the target role always carries; a second pass over the same repository reports nothing; a partly-labelled one receives only what it lacks; a name differing only in case counts as present, since GitHub’s uniqueness is case-insensitive; a label switched off by an empty configured name is not created; a renamed label is created under the configured name. The two safety properties are asserted from the request log rather than from the return value — noPATCH,PUTorDELETEis ever issued, and the only requests made at all are listings and creates — and the failure paths are asserted not to escalate: one refused create still creates the rest and returns 0, an unlistable repository returns 1 having created nothing and claimed no failures it did not observe, and a guarded call survives a total failure underset -e.
6j. Labels a stage asks for are minted safely, and only within the caps
(requirement 6c, issue #714). test/labels.test.sh passes:
labels_reserved_names lists the fixed set (blocked, blocked:*,
obsolete, complexity:*, pw::type:tech-debt, pw::owner-decision,
pw::decision, open-question) ahead of every non-empty configured
label name — the project-review pull-request label, and a repository’s
own override of it, among them — and a name switched off by an empty
configured value contributes nothing; labels_validate_name refuses an empty name, one
over 50 characters, one carrying a comma, and one matching a reserved
entry case-insensitively — by exact name or by prefix glob — while
passing an ordinary name and one at exactly the 50-character limit;
labels_mint creates and applies an accepted entry with its own colour
and description, carries the description of an entry that names one but
no colour through intact under the neutral-grey default rather than
confusing the two fields, refuses an entry that is not an object at all
without costing the well-formed entries beside it,
applies without creating a name already present,
refuses a reserved name without ever reaching gh, enforces its own
per-item cap (the default 3, and a smaller explicit one) by refusing the
surplus cap while the accepted entries still land, and reports
create-failed/apply-failed distinctly for a gh refusal at each
step — neither ever escalating past the returned report, and an empty
repository, empty LABELS_JSON or unusable KIND printing the
all-empty object rather than erroring.
test/refiner-verdicts.test.sh passes: a verdict’s own labels mints
and applies onto the issue behind it regardless of verdict itself, a
reserved name is refused and never reaches gh, and the per-engagement
pool of 10 is shared across items claimed in the same engagement — the
fourth of five items that each request labels within a shared budget
still lands on an exactly-exhausted pool, and the fifth’s own suggestion
is refused engagement-cap before any labels_mint call is even
attempted. A tech-debt item whose ref is not its backing issue number
logs that ref as its labels-minted event’s item (requirement 6c),
while the gh write underneath it still names the number.
test/implementer-labels-wiring.test.sh passes: a summary with no
labels field, or an empty one, calls labels_mint not at all; a
non-empty one calls it exactly once, against the pull request’s own repo
and number (parsed from its URL) with kind pr, reserved names drawn
from labels_reserved_names(CONFIG_FILE, SCHEMA_FILE), and the result
logged as one labels-minted event naming repo, item and
actor: "implementer".
test/config-schema.test.sh passes: scripts/doctor.sh fails a
configured label set to blocked:<anything>, case-insensitively, the
same as the pre-existing exact-blocked check.
Grep assertion for the inertness invariant’s own corollary: nothing in
agent-cycle.sh, lib/ or scripts/ branches on a label name that is
not in labels_reserved_names’s own list.
-
Human-visibility (requirements 38a–38c).
test/handoff.test.shpasses:_handoff_pr_approvedreadstruefor a standingAPPROVEDreview with nothingCHANGES_REQUESTED-blocking,falsefor the reverse, andfalseagain when the two positions are held by different reviewers (one approver, one blocker); a later review supersedes an earlier one from the same reviewer regardless of which state it moves to or from; a bot’sAPPROVEDreview is never counted (agent-ops#391); and an unreadable reviews list is a failure, never a guessedfalse.ensure_human_reviewerre-requests review from whoever has ever reviewed the pull request (any state) in preference toassignee; falls back toassigneeonly when nobody ever has; strikes the pull request’s own author off both lists before asking, so an author’sCOMMENTreview on their own pull request neither becomes a request target nor 422s the request for the human beside them, and an author-only reviews list, orassigneeequal to the author with nobody else known, is the distinguishableskip\tno-candidate(tech-debt/TD-PPagop-26081001.md), never a bareskip;skips (bare) while something is genuinelyCHANGES_REQUESTED-blocking, and while the pull request is a draft; the pending list excludes a bot-type or[bot]-suffixed entry the same way the reviews list does, and counts a requested team — agreeing with requirement 38e’s own read of the same rule (tech-debt/TD-PPagop-26081403.md); and an unreadable reviews list or pending list isfailed, never an assumedskip, while a pending-list read refused specifically by GitHub’s REST rate limit isfailed-rate-limited, told apart from that barefailed(agent-ops#1082).test/human-reviewer-handoff-wiring.test.shasserts what both call sites do with that answer, driving the Reviewer’s own handoff block and the Enabler’scomplete_handoffblock through the same cases:failed-rate-limitedstill warns, names GitHub’s rate limit as the cause, still falls back toenabler_assigneeforreviewers, and carries the distinguishing state onpr-readyrather than a barefailed.handoff_round_answeredis asserted directly there too, both callers’ halves at once: a markedactor=implementerreply after the blocking review isanswered, the same reply before it isunanswered, an unmarked comment and another actor’s marked comment never answer, and areview_requestedevent answers only the caller that passes that signal. Its failure direction is asserted as its own group, because that is where the requirement lives — an empty blocking timestamp, an argument that is not a single JSON array, two concatenated pages, and an array whose elements break the extraction are eachunknown, neveranswered.test/needs-refinement.test.shpasses:refinement_blocked_reason_labelmapsneeds-refinementtoblocked:needs-refinementand any other kind to nothing;refinement_block_fields’s third and fourth arguments recordblocked_label/blocked_reason_labelindependent of the label argument;refinement_label_add/_remove, the same primitiveneeds_refinement_labelalready uses, apply and remove bothblockedand its reason label; andrefinement_blocked_label_targetsfinds both of an issue’s blocked labels, scoped by repo the same wayrefinement_label_targetsis, surviving a void the same way, and finds only the reason label — never the genericblocked— for a legacy block that recordsneeds_refinement_assigneeand neither blocked-label field, since that block’s own event cannot prove which ofadded/presentthe migration sweep actually saw when it appliedblocked.refinement_label_project(agent-ops#651) reads before it writes: an absentblockedis added and reportedadded; a pre-existing one — another label on the issue does not mask this — ispresent, untouched and unrecorded; an unreadable label list is applied best-effort butunrecorded; and a label the repo does not have isfailed, the same four-way contract the deletedrefinement_assignee_projectonce had for the assignment this replaced.refinement_blocked_label_stale(agent-ops#651) offers up exactly theblocked/blocked:<reason>pair whose own-label-action history’s latest action isaddfor an item no longer open, correctly leaving alone a label whose block is still open, one whose removal already succeeded, and another repo’s identically-numbered item.refinement_assignee_remove— the one survivor of what used to be a pair, kept forscripts/sweep-legacy-refinement-assignees.shalone — still makes onegh issue edit --remove-assigneecall.test/sweep-human-visibility.test.shpasses against a stubbedgh: a pull request with nothing blocking it and no known reviewer yet is both re-requested (from the approver) and, when also approved, mergeable, green and idle pasthuman_nudge_idle_hours, nudged in the same pass; aCHANGES_REQUESTED-blocked pull request whose round is unanswered has no review request made for it and is never nudged; the same pull request whose round is answered — a marked Implementer reply after the blocking review — is re-requested viaconfirm_review_requested, still never nudged (the nudge’s own_handoff_pr_approvedgate holds it off regardless, since the same reviews fixture is stillCHANGES_REQUESTED); a reply predating the blocking review, or one carrying no marker at all, does not self-heal it; a round this cannot read (handoff_round_answeredreturningunknown) is awarning, never a guessed request; a listing the stub splits across two pages — the shape--paginateproduces — still self-heals when answered and is still silent when unanswered, which is what holds_sweep_round_answered’s reads to the streamed form; an answered round on a pull request whose rollup is not green (empty or mixed) produces no review request and no output at all — the green gate (agent-ops#338) short-circuits before_sweep_round_answeredis even asked; the same answered round on a rollup whose only non-SUCCESSentry isSKIPPEDstill self-heals, proving the self-heal shares_sweep_checks_greenwith the idle nudge rather than a stricter copy of it; a pull request nudged once already is not nudged again even when still idle; an unmergeable, not-yet-green, or not-yet-idle approved pull request is never nudged, and neither is one with an empty check rollup; an approved,MERGEABLE, green and idle pull request whosemergeStateStatusisBLOCKED— the base branch requiring a second approval_handoff_pr_approvedcannot see — is not nudged either, whileCLEAN,BEHINDand an unresolvedUNKNOWNall still are; a rollup whose only non-SUCCESSentries areSKIPPED— the shape every target repository’s pull requests carry, aCheckRungated off by apaths:filter or anif:, distinct fromStatusContextand so read by.conclusionalone, never.state— is nudged all the same, while aCANCELLEDor still-IN_PROGRESS(conclusionnull) entry still blocks it;human_nudge_idle_hours: 0disables the nudge while leaving the review-request self-heal unconditional; and a listing, a view, or a reviews read that fails is awarning, never silence — an unreadable reviews list warns twice for the same pull request, once fromensure_human_reviewer’s own candidate check and once from_handoff_pr_approved’s idle-nudge check, since each reads it independently and neither may mask the other’s failure; and, where that idle-nudge reviews read fails specifically on a GitHub REST rate-limit refusal, its warning names the cause distinguishably — GitHub’skindrate limit, read viagithub_limit_kindfrom one further diagnostic-only read of the same endpoint — rather than the same generic detail a non-rate-limit failure gets (agent-ops#1082). The same distinction holds at the sweep’s own review-request read: a rate-limited one still warns — never silence, which matching requirement 38a’s barefailedalone would produce — with— GitHub's REST rate limit refused the readappended to the unchangedcould not request review from …prefix requirement 38e classifies on, while a non-rate-limit failure at that read keeps that detail exactly as it was. A pull request whose only legal candidate is its own author is awarningnamingenabler_assignee, not silence — the oneskipreason the sweep itself surfaces, read off requirement 38a’sskip\tno-candidatedetail, unlike a still-CHANGES_REQUESTED-blocked pull request’s bareskip, which produces no action at all. Confirm the nudge comment carries the visible attribution header and both markers (agent-ops:pipeline-commentandagent-ops:human-nudge). 38e. A violation the sweep cannot heal is read back and re-verified, not guessed at.test/human-visibility-hygiene.test.shpasses:human_visibility_violationskeeps a repo-level (emptypr_url) warning with nothing to clear it; a laterhuman-review-requestedevent clears a same-pr_urlcould not request review from …warning, and a laterhuman-nudgedevent likewise clears a same-pr_urlcould not post the idle nudge commentwarning and, separately, a same-pr_urlcould not read the pull request's reviews …warning (_handoff_pr_approved’s own read failing inside the idle-nudge check alone joins the nudge family, since nothing else the sweep does for that pull request depends on that same read), but ahuman-dequeue-noticeevent for that samepr_urldoes not clear any of those three — nor does ahuman-nudged/human-review-requestedevent clear acould not post the merge-queue-dequeued noticewarning — proving the family split rather than assuming it (agent-ops#393); separately, ahuman-review-requestedevent does not clear acould not read the pull request's reviews …warning, confirming it is not read under the wider fail-safe default; a later event for a differentpr_urlor a different sweep leaves an identity’s warning untouched; an unrecognised warning shape (one none of the classes above match) is cleared by any of the three success events, the fail-safe default for a warning with no family of its own; a repeated identity keeps only its latest detail regardless of family; and a torn log line is skipped, not fatal.test/gather-human-visibility-hygiene.test.shpasses against a stubbedgh: violations naming a different repo are ignored; a repo-level violation survives only while its listing still fails live and is dropped the moment a fresh listing succeeds; a pull-request violation of any class is dropped once it is merged, closed, or back in draft; acould not request review from …violation is dropped oncereviewRequestsis non-empty, and separately once a non-bot review with stateAPPROVEDorCHANGES_REQUESTEDexists in the reviews list — neverreviewDecision, agent-ops#391, TD-PPagop-26081505 — and otherwise survives; areviewRequestsentry typedBot(keyed__typename, the discriminatorgh pr view’s exporter actually emits) or naming a[bot]-suffixed login alone does not drop it, while a requested-team-only entry does (tech-debt/TD-PPagop-26081403.md) — the bot half is defensive: today’s exporter drops Bot reviewers from the array entirely, so in production a Copilot-only request arrives as[]and is the “otherwise survives” case (see Gotchas); acould not post the idle nudge commentviolation on anAPPROVEDpull request survives while no comment carries both the exact<!-- agent-ops:human-nudge -->HTML-comment form and the pipeline-marker stamp — confirming the classes are told apart, not read off the same “has a human reviewed this” check, which would otherwise drop every nudge-class violation on sight — and separately survives a comment carrying the stamp but only prose mentioning the marker, a comment carrying the exact HTML form in a fenced code block but no stamp, and an ordinary pipeline comment carrying the stamp but no nudge marker at all (agent-ops#390, #428, mirroringtest/sweep-human-visibility.test.sh’s own discriminating cases), and is dropped only once a single comment carries both; acould not post the merge-queue-dequeued noticeviolation (TD-PPagop-26081504) survives while theagent-ops:merge-queue-dequeued:marker comment is absent and is dropped once it appears, the same marker-read shape as the nudge class; ano legal review-request candidateviolation (tech-debt/TD-PPagop-26081001.md) survives whileauthor/reviewsstill show no non-author, non-bot, submitted review and no pending (unsubmitted) review counts either, is dropped the moment such a reviewer appears, is dropped separately oncereviewRequestsis non-empty under that same bot filter (a candidate a CODEOWNERS auto-request already named, before anyone has reviewed — agent-ops #350, #353, #355), survives a Bot-typed/[bot]-suffixed-onlyreviewRequestsentry (defensive, as above) and is dropped by a requested-team-only one, and is dropped separately once the assignee named in its own detail text no longer names the pull request’s author; acould not read the pull request's reviews …violation (_handoff_pr_approved’s own read failing inside the idle-nudge check) has no follow-up action outcome of its own to inspect — the read failing was the whole violation — and is dropped unconditionally the moment the outergh pr viewre-check itself succeeds: since agent-ops#1085 moved_handoff_pr_approved(lib/handoff.sh) onto the same GraphQL surface, asking for the samereviewsfield, that outer call already succeeds at, reaching this class at all past that success is the whole answer — survives only while the outergh pr viewre-check itself is unreadable, the same fail-safe default every other class shares, proven bytest/gather-human-visibility-hygiene.test.sh’s ownSTUB_VIEW_RCcase rather than by a second, separately-stubbable read this class no longer makes; acould not read the pull request's state …violation (scripts/sweep-human-visibility.sh’s own broadgh pr view --json reviewDecision,mergeable,mergeStateStatus,statusCheckRollup,reviews, commentscall failing) is the same shape — no follow-up action outcome of its own, so it re-runs that exact call instead: dropped only once it succeeds again, judged on exit status alone; survives while it still fails, even though the narrower openinggh pr viewre-check (which omitsstatusCheckRollup) succeeds, proving the fix does not infer the answer from that narrower read either; and is dropped on a merged, closed or draft pull request the same as every other class, decided before the class-specific re-check is even reached; a genuinely unrecognised warning shape (one none of the six classes above match) survives for as long as its pull request stays open and not a draft; an unreadable live re-check keeps the violation rather than dropping it; a repo-level and a pull-request violation for the same repo combine into one candidate; and every surviving candidate carriessource: "human-visibility"and ahuman-visibility--prefixed ref.test/human-visibility-wiring.test.shpasses against the block lifted verbatim out ofagent-cycle.sh— the gate and the assignment that join the reduction to the gatherer, which neither test either side of it can reach: a repo whosesourceslisthuman-visibilityis gated in and its entry’shuman_visibilityarray carries the candidate; a repo whosesourcesomit it is left at[]with the gatherer never called for it; each repo is handed its own slice of the violations rather than the fleet-wide array; and a re-check that drops everything, or a cycle with no violations at all, still leaves every entry a valid[]. 38f. Merge-queue awareness reads the field GitHub actually exposes, and never guesses when it cannot.test/merge-queue.test.shpasses against a stubbedgh:merge_queue_probereportsqueued: true/falsecorrectly from a fixture GraphQL response; a dequeue event’screatedAt/reasonare reported whether or not the pull request is currently queued (re-queued-since is the caller’s ownqueued == "false"gate, not this function’s); aghfailure and a malformed response (aqueuedkey present but not a boolean) both return non-zero with no output a caller could mistake for a real answer; and bad arguments (an empty slug, an empty or non-numeric number, a slug with no/or with more than one) are rejected before ever callinggh, while a slug whose repository is named the same as its owner is probed like any other.test/merge-queue.test.shalso passesmerge_queue_dequeue_actionableagainst every reason value verified live ("manual"and"merged"false;"","failed_checks","merge_conflict"and an unrecognised value all true) (agent-ops#394).test/sweep-human-visibility.test.shpasses the merge-queue cases alongside its existing ones: a currently-queued pull request is never idle-nudged; a checks-failure dequeue produces its owndequeue-noticeaction (nevernudged) even withhuman_nudge_idle_hours: 0, naming the removal time and reason and carrying theagent-ops:merge-queue-dequeued:<time>marker; an already-notified dequeue is not notified again, while a later, fresh dequeue still gets its owndequeue-notice; a pull request re-queued since a recorded dequeue event gets neither a notice nor a nudge; an unreadable merge-queue probe leaves the ordinary idle nudge (stillnudged) behaving exactly as it did before this requirement existed; a failed dequeue-notice POST is awarning, never silence; a"manual"dequeue gets no notice even though it is otherwise fresh and unacknowledged (agent-ops#394); a dequeue older thanmerge_queue_dequeue_notice_max_age_hoursgets no notice even though it carries an actionable reason and no marker is on the pull request yet (agent-ops#394); andmerge_queue_dequeue_notice_max_age_hours: 0disables the notice outright, even for a same-second dequeue whose age (0) does not exceed the zero-width threshold arithmetic alone would apply (agent-ops#429). 38g. Requirement 38c’s ruleset dependency is reported, not silent (agent-ops#391).test/doctor.test.shpasses, over the same single-target-repo fixture andgh/rulesetsstub requirement 25a’s own ruleset-drift cases (acceptance check 8m) use: an active default-branch ruleset whosepull_requestrule carriesrequired_approving_review_count: 1isok, naming the count; the same with0is awarnnaming agent-ops#391 and stating this is informational, not a requirement 38 fault; an active default-branch ruleset with nopull_requestrule, and no active ruleset targeting the default branch at all, are both the sameskip; an unreadablerulesetsendpoint is its ownskip; two active default-branch rulesets requiring0and1report the strictest —okat1— in both list orders, so the verdict does not depend on what the API returned last; and none of these faildoctor.shitself. -
Finish-then-continue’s chain decision is a pure, tested function of what a cycle already gathered.
test/chain.test.shpasses:chain_sources_remainsums.sourcesacross every repo, zero when every repo’s is empty, summed across repos rather than stopping at the first;chain_should_continuechains when at least one source remains and the cycle’s own place in its lineage is still undermax_chained_cycles, stops exactly at and past the cap (includingmax_chained_cycles: 1, which disables chaining outright even on the first cycle), and fails closed (never chains) on a non-numericchain_countormax_chained_cycles. 67a. The chain only ever launches when it should, and never waits on what it launches.test/finish-then-continue.test.shpasses, against the realcleanupblock lifted out ofagent-cycle.sh:chain_eligible=1withexit_code == 0launches exactly one child, carryingAGENT_CYCLE_CHAIN_COUNTincremented from wherever this cycle’s own stood and the original argv verbatim (including an empty one, replayed as no argv rather than a stray token);chain_eligible=0never launches one, regardless of exit code;chain_eligible=1with an untrapped non-zero exit or a signal’s 128+n never launches one either; a handled ending (exit 0, the same as a stand-down) still does, since the item’s own disposition must not stall the fleet from picking up a different one sooner; and the parent’s own exit is never delayed by a slow child, confirmed by timing a run against one that sleeps. The launched child inherits no ignored signal disposition — asserted by having it report back which ofTERM,INTandHUParrived already ignored, which must be none — so a chained cycle stays killable by requirement 1’s takeover and by a container stop. 39b. A sub-hourly cycle interval is an explicit cron minute list, correct at every occurrence, and backward-compatible at the boundary.test/render-crontab.test.shpasses: the rendered cycle line lists the node’s own minute then everyschedule.cycle_interval_minutesafter it while still under 60, each occurrence dropped (not shifted) when it lands on an excluded minute rather than the whole render failing;cycle_interval_minutes: 60reproduces the exact single-minute, once-per-hour line every release before the key existed rendered;cycle_interval_minutesoutside 1..60, non-numeric, or absent-with-no- default all leave the baked crontab untouched, the same fail-safe every other malformed schedule key already gets.test/doctor.test.shpasses: the crontab report names the full comma list, not just the first occurrence. -
A pending image roll overrides an otherwise-eligible chain, never grants one, widens the gap at every clean, non-
--once, non---dry-runcycle-end whether or not there was a chain to give up, is honoured at the hook againstlock.jsonalone, is cleared once landed, and — while it is not — idles the next cycle at most once rather than letting it run underneath the marker (requirement 68 (Finish-then-continue), agent-ops#1096, amended by agent-ops#1102, widened by agent-ops#1103).test/chain.test.shpasses:chain_image_behindreads true only for a{"status":"behind",...}verdict — “current”, “unverified”, the JSON literalnulland malformed input all read false — andchain_write_roll_pendingwrites$state_dir/roll-pending.jsonnaming a bare ISO-8601untilschedule.cycle_interval_minutesminutes out (falling back to the schema default of 15 on a non-numeric argument), creatingstate_dirif it does not yet exist.chain_clear_landed_roll_pendingremoves that same file unless the verdict handed to it still reads “behind” — “current”, “unverified”,nulland no argument at all every clear it — and does nothing, without error, when the file is already absent.test/finish-then-continue.test.shpasses, against the same realcleanupblock as 39a, now driven with a stubbedimage_drift_ status/agent_ops_version: a “behind” verdict cancels an otherwise chain-eligible, exit-0 cycle and writes the marker; a “current” verdict still chains and writes no marker; a cycle with no chain to give up (chain_eligible=0) still writes the marker on a “behind” verdict, chaining nothing since there was nothing to cancel; a--oncerun never writes the marker on a “behind” verdict either, nor does a--dry-runrun (agent-ops#2103) — both cases still gated ahead ofchain_eligiblesince neither a real--oncenor a--dry-runrun is ever chain-eligible to begin with; and a cycle that did not end cleanly (a non-zero exit) never even reaches the check, marker included.test/watchtower-pre-update. test.shpasses: an unexpiredroll-pending.jsonmakes the hook exit 0 despite a live lock naming a live process in the hook’s own container, when that lock islock.json— but never when it isreview-lock.json, which still defers on its own ordinary judgement regardless of the marker, and whose deferral the hook’s own output never misdescribes as an override; the override’s own sign-off names the marker’s authority rather than the idle path’s “no cycle in flight”, which would contradict the in-flight line the same run already printed; an expired or unparseable marker leaves the ordinary lock-based judgement unchanged; no marker at all behaves exactly as before the marker existed.test/state-sync.test.shpasses:roll-pending.jsondoes not replicate to a peer’s branch, alongside the other live locks.The one case
chain_clear_landed_roll_pendingleaves open — a verdict still reading “behind” — is covered the same way (agent-ops#1102 option 2).test/chain.test.shpasses:chain_roll_pending_livereads true only for a marker naming anuntilthat has not yet passed, the identical parseroll_pending_allowuses;chain_updater_should_standdownreads true only forupdater_status’s own"deferring"or"stuck"/reason: "defer", never"rolled", a bare"stuck"/reason:"allow",null, or malformed input;chain_roll_standdown_availablereads true only when$state_dir/roll-standdown.jsonis absent or itscountis exactly0, failing closed (false) on an unreadable file or a non-numericcount;chain_roll_standdown_recordcreates that file atcount: 1with a freshsinceand increments an existing one while preserving itssince; andchain_clear_landed_roll_pendingnow also removesroll-standdown.jsonalongside the marker once the verdict stops reading “behind”, never while it still does.test/roll-standdown-wiring.test.shpasses, against the real post-acquire_lockblock lifted out ofagent-cycle.sh: a live marker with an eligible updater verdict logs astand-downnamingcause: "roll-pending"and the marker’s ownuntil, sets the node-state terminal toexternally-blocked/roll-pending, records one stand-down against the cap, leavesroll-pending.jsonbyte-identical to what it found (writing no new one), and exits before the block’s own end; the same marker with a verdict idling cannot fix ("rolled","stuck"/reason:"allow", ornull) runs normally with nothing logged; an expired marker is left alone for its own clock; and a second eligible cycle under a marker whose cap is already spent logs aroll-standdown-cappedevent naming the marker and the spent count instead of standing down, then still reaches its own end. 17e. Contended-claim-loss reporting is correct per node and per era (component 21).test/pickup-metrics.test.shpasses against a fixture union log:selectionandclaim-lostevents split “before”/“after” at each node’s own firstchainedevent, never at a fixed timestamp; a node with nochainedevent in the fixture falls wholly in “before”; a contended count includesheldandpr-heldclaim-lostcauses and excludes every other cause, including a line carrying nocauseat all; a malformed trailing line is skipped rather than aborting the read; and--sincebounds the window reported.scripts/pickup-metrics.shpassesshellcheck. 8s. The Approver runs only abovehuman, picks its tier correctly, and refuse-wins (requirements 8b, 8c).test/approver.test.shpasses against a stubbedgh:approver_tier_formapslow/medium/hightotrivial/standard/highand anything else tostandard;approver_model_for_tierpicksMODEL_COMPLEXonly forhigh;approver_refuse_streakcounts a login’s own trailingCHANGES_REQUESTEDreviews correctly over the line-per-review shape--paginate --jqemits — the aggregation runs once over every page’s lines at once, so no page boundary is observable to it — stopping at that login’s own most recentAPPROVED, ignoringCOMMENTEDandDISMISSED, ignoring another account’s reviews entirely, reading0for a login that never reviewed — and returns non-zero, printing nothing, when the list itself could not be read;approver_post_reviewposts withGH_TOKENset for that one invocation only, never leaking into a later call under the stub’s own default identity;approver_prior_refusal_bodiesreturns the same login’sREQUEST_CHANGESbodies oldest-first and nothing on an unreadable list.approver_post_or_warnitself (agent-ops#1082, against the samelib/github-limit.shsourced ahead oflib/approver.sha real caller always has): a write refused by a secondary rate limit is retried once and reaches GitHub on the retry,approver_last_post_okreporting1and no warning logged at all; a write still refused by that same limit after the retry logs awarning, withapprover_last_post_okreporting0, naming the rate limit distinguishably from a generic refusal and saying a retry was made; and a generic (non-rate-limit) refusal is not retried at all — one POST attempt only — and keeps the original, unchanged “GitHub refused the write” wording.approver_escalatecomposes the escalation issue’s “Why the pipeline is blocked” paragraph from the condition it was told fired (agent-ops#1214): theescalatecondition’s body says the adjudication judged it a genuine judgement call, therecurring-refusecondition’s says the disagreement kept recurring and never that the adjudication could not resolve it, and a condition it was not given keeps the “could not resolve the disagreement” wording an unparseable or unusable verdict earns — while thepr-<n>-approver- adjudicationitem refcreate_escalation_issuededups on, and the adjudication’s own reasons, stay the same under every one of them.test/approver-wiring.test.shliftsrun_approver_stage,approver_post_or_warnandapprover_stage_complexityverbatim out oflib/approver.shand drives them with every GitHub call, model launch and log write stubbed: at a genuinely configured (or manually killed)merge_autonomy: humanthe stage posts no review, launches no model and logs nothing at all, having askedmerge_autonomy_kill_statefor a fresh, retrying read (requirements 2.3a, 8b’s own fail-closed distinguishing behaviour, agent-ops#1081) rather than the process-lifetime memo. A stubbed fail-closed read (.record.kind == "fail-closed") — unlike the genuinely configured case — logs exactly onewarningnaming the pull request, the kill flag, and the cause, markedfail_closed: true;retried: truewhen the stub reports the retry was taken, and the warning’s own detail says so; either waymerge_autonomy_effective_levelitself is never even asked, since a fail-closedhumanis decided by the kill switch alone. Atagent-approvesacomplexity:lowpull request gets a deterministicAPPROVEwith no model launched,mediumandhighlaunchapprover_model_defaultandapprover_model_complexrespectively — the launched prompt assembled with an empty overrides object even when the harness’sprompt_overridescarries a poisonedapproverkey (requirement 4a’s lock) — a refusal’sreasonsbecome theREQUEST_CHANGESbody, and a synthetic refuse streak of two routes the next round toapprover_model_critical— for acomplexity:lowpull request too, which the grade alone would have approved without a model at all. Each failure path returns 0 having posted nothing and logged awarning: the stage disabled (approver_model_defaultempty), the credential absent, a verdict that would not parse, a verdict the Script does not recognise, and a review GitHub refused. An adjudicationrefusebelow the recurrence threshold postsREQUEST_CHANGESand escalates nothing on its own; at the threshold (a refuse streak of four — the third consecutive adjudicationrefuse) it also escalates, and an adjudicationescalate(or an unparseable/failed verdict) escalates regardless of the streak — the escalation issue’s own body naming which of those three conditions triggered it (agent-ops#1214).approver_stage_complexity(requirement 8b) is exercised separately: given a pre-Reviewerrev_complexityofmediumand a stubbedgh pr viewreporting the PR now carriescomplexity:high— the Reviewer’s own mid-round correction — it resolveshigh, and thathighreachesrun_approver_stage’s own tier choice (approver_model_complexlaunched, logged as the high tier), confirming the raise reaches the same round’s Approver rather than only the next one; agh pr viewreporting no change, or an unreadable label, leavesrev_complexityunchanged. Everyapprover-verdictthe stage logs carries therepoit ran for, themodelthat reached the verdict — empty on the deterministic Trivial tier, which launches none — andposted(requirement 33):truewhere the review reached GitHub,falseboth for a write GitHub refused despite anapproveverdict and for a verdict that attempted no write at all (an adjudicationescalate, or a verdict the Script does not recognise).scripts/doctor.shfails amerge_autonomyabovehumanconfigured withapprover_model_defaultempty, the same shape its existingapprover_app_idpairing check already fails on (test/doctor.test.sh).