A repo-level 404 reads as a clear flag — the merge-autonomy kill switch still fails open when the state repo is missing or invisible to the token
Id: TD-PPagop-26081602 · Status: resolved · Filed: 2026-08-16 · Resolved: 2026-08-16 · Ref: https://github.com/Poetic-Poems/agent-ops/pull/474
TD-PPagop-26081507 (resolved by PR #448) made the merge-autonomy kill
switch fail closed on a fresh node whose state repo is unreachable with no
cached copy — but “unreachable” there means a transport-level failure
(DNS, connection refused, a 5xx). GitHub’s contents API answers “this
repository does not exist, or this token cannot see it” with the same
404 Not Found as “the flag file does not exist” — deliberately, so a
private repository is indistinguishable from a missing one — and
fleet_flag_fetch_status (lib/toggle.sh) classifies every 404 as
clear. So a misconfigured state_repo slug, or a token whose scopes
lost access to it, still resolves the switch as clear:
merge_autonomy_effective_level answers the configured level, not
human, on exactly the freshly-provisioned population the 26081507
asymmetry was designed to protect. Found in review of PR #448
(https://github.com/Poetic-Poems/agent-ops/pull/448#issuecomment-5302523640),
and deliberately left out of that item’s scope.
Why it matters
Section titled “Why it matters”WI-5 (#408) arms the Approver stage on merge_autonomy_effective_level:
from the moment it lands and a repository’s merge_autonomy rises above
human, this case means a node posting App reviews — and once WI-7
(#410) arms landing, a node landing pull requests — while an operator
who pulled the §6 lever believes everything is forced back to human.
Requirement 2.3b’s guarantee (“an unreachable repo with no cached copy
reads as killed”) is true of the transport case and not of this one; the
spec now says so explicitly rather than overclaiming.
lib/toggle.sh—fleet_flag_fetch_status’s 404 branch (greponHTTP 404|Not Foundover theghstderr) is where the two 404s collapse intoclear; its status-list comment names this item.lib/merge-autonomy.sh—merge_autonomy_kill_state’s comment names this item.docs/IMPLEMENTATION-PIPELINE-SPEC.md— requirement 2.3b and the “fails closed only on a fresh, cache-empty node” Design decisions entry both carry the caveat and reference this item; the resolver updates both.scripts/doctor.sh—check_repo_accessonstate_repoalready fails loudly on exactly this state (“unreachable with this token — claims, fleet flags and the shared log would not replicate”), which is the operator-run mitigation in the interim; nothing the pipeline itself consults.
Suggested fix
Section titled “Suggested fix”With or before any repository’s merge_autonomy rising above human
(the Stage 1 promotion of D18’s rollout, #402) — and in any case before
WI-7 arms a landing path — teach the 404 branch to tell the two apart:
on a contents-API 404, probe repos/<state_repo> itself; a 2xx there
means the repo is visible so the 404 was the flag file’s own (clear),
anything else means the repo is missing or invisible and must classify as
unreachable (or a distinct status that merge_autonomy_kill_state
resolves the same way). The probe costs one extra REST call on the 404
path — the switch’s steady state — which is negligible against the REST
budget, but its own failure modes (the probe timing out, a 403 with the
repo visible) need the same explicit classification this comment trail
gives the fetch. fleet_flag_fetch’s RAW-only contract must stay
byte-identical so fleet/disabled.json and the usage-limit flag keep
failing open. While in there, consider letting scripts/doctor.sh’s
kill-switch line print the synthesised record’s reason the way
--status’s toggle_describe already does, so an operator seeing
“SET” during an outage also sees why (review of PR #448, minor note).
Extend test/toggle.test.sh’s stub-gh coverage with the
repo-level-404 case (both probe outcomes), and
test/merge-autonomy.test.sh with the resulting kill-state resolution.