The clear side of the 404 ambiguity — fleet_flag_delete reads a repo-level 404 as "already absent" and reports a flag cleared that is still set
Id: TD-PPagop-26081604 · Status: resolved · Filed: 2026-08-16 · Resolved: 2026-08-16 · Ref: https://github.com/Poetic-Poems/agent-ops/pull/491
TD-PPagop-26081602 (PR #474) taught the read side of the fleet-flag
machinery to tell GitHub’s two 404s apart: fleet_flag_fetch_status
(lib/toggle.sh) now probes repos/<state_repo> before calling a
flag-file 404 a clear flag, so a misconfigured state_repo slug or a
token whose scopes lost access fails closed rather than reading as
“nothing stands you down”. The clear side still collapses the same two
404s. fleet_flag_delete treats any 404 on its read-for-sha as “the flag
was already gone”: it drops the local cache, prints absent, and returns
0, which fleet_flag_delete_outcome translates to unconfigured — the
word its callers report as success.
So on exactly the state this repository already worries about — the state
repo missing, renamed, or invisible to this node’s token — an operator
running agent-cycle.sh --enable or --restore-merge-autonomy is told
the flag is clear, having cleared nothing. fleet_flag_delete’s own
header names this harm in as many words: “‘cleared’ reported for a flag
that is still set keeps the whole fleet standing down after the operator
believes they resumed it.”
Why it matters
Section titled “Why it matters”The operator on the wrong end of this is the one who most needs a true
answer, and the failure is silent in both directions. Their own node
stops reading the flag (the cache is dropped, and every subsequent fetch
404s), so --status and scripts/doctor.sh agree with them that all is
well — while every peer whose token can see the state repo keeps
reading the flag and keeps standing down, or keeps forcing
merge_autonomy to human. Nothing in the fleet reports the
disagreement; the flag can only be cleared by someone who notices the
pipeline is still stopped and goes looking at the state repository by
hand.
The read side’s asymmetry argument does not carry over as a mitigation. There, failing closed on an unreadable switch was the safe direction and the cost of getting it wrong was a node running when it should have stopped. Here the report is simply false, whichever flag it is about.
lib/toggle.sh—fleet_flag_delete’s 404 branch (greponHTTP 404|Not Foundover the read-for-sha’s stderr) is where the two 404s collapse intoabsent;fleet_flag_delete_outcomeabove it is what turns that into theunconfiguredsuccess word.agent-cycle.sh—--enable,--clear-limitand--restore-merge-autonomyare the three operator paths that report the outcome word.docs/IMPLEMENTATION-PIPELINE-SPEC.md— requirement 2.3a’s fleet-flag clearing and requirement 12’s management commands both describe the outcome vocabulary; whichever the fix changes needs its requirement amended with it.scripts/doctor.sh—check_repo_accessonstate_repofails loudly on this state already, which is the operator-run mitigation in the interim, but nothing on the clearing path consults it.
Suggested fix
Section titled “Suggested fix”Reuse the probe TD-PPagop-26081602 added rather than inventing a second
one — it is already extracted as fleet_repo_visible (lib/toggle.sh),
shared precisely so this fix does not grow a probe that drifts: on a 404
from the read-for-sha, probe repos/<state_repo>, and let only a probe
that confirms the repo is visible resolve to absent. Anything else is a
failed delete — return non-zero, so fleet_flag_delete_outcome says
failed and the operator is told the flag could not be cleared and why.
Note that the delete path, unlike the fetch, has no cached copy to fall
back to and therefore needs no cached-or-unreachable branch, only the
honest failure. --this-node
paths and the no-state-repo no-op must keep reporting exactly as they do.
Extend test/toggle.test.sh’s stub-gh coverage with the repo-level-404
delete case (both probe outcomes) and test/agent-cycle-* with the
operator-facing wording for a delete that could not be confirmed.
Found in review of PR #474 (https://github.com/Poetic-Poems/agent-ops/pull/474), and out of TD-PPagop-26081602’s scope, which is the read path alone.