A Boolean Almost Cost Us a Double-Fire: Replacing already_executed with Six Explicit States
A public standards list did to us what every maintainer fears: it broke our reference verifier in front of everyone. The fix took 24 hours. This post is about what the bug actually was, because the shape of it โ a boolea
A public standards list did to us what every maintainer fears: it broke our reference verifier in front of everyone. The fix took 24 hours. This post is about what the bug actually was, because the shape of it โ a boolean standing in for a process โ is one of the most common silent defects in agent-runtime code.
The bug
Our recovery-admission reference verifier (ECR โ recovery actions admission control) modeled the executor's retained disposition as a single boolean: already_executed. True = refuse the replay attempt. False = proceed with the rest of the authorization binding.
On the agent2agent IETF list, Justin Kintzele (J Diesel NY) publicly identified the hole: an in-process exception test cannot see the live-worker case, because the claiming owner is still running when the boolean is read. After a process crash or reboot between "invoking an external side effect" and "persisting the receipt", fresh authorization alone cannot tell a retry apart from a second effect. A boolean cannot represent the states between "nothing happened" and "it happened" โ and the dangerous middle is exactly where blind retries double-fire.
Six states
The fix replaces the boolean with six explicit dispositions, fail-closed:
| State | Meaning | Fresh attempt? |
|---|---|---|
absent |
no retained record | allow |
claimed |
O_CREAT|O_EXCL won, handler unfinished | refuse (owner alive) |
in_progress |
handler running | refuse (blind retry double-fires) |
outcome_unknown |
owner dead / lease expired | refuse โ reconciliation required |
completed |
result persisted | refuse (replay, or NONCE_CONFLICT if same nonce with different digest) |
reconciled |
outcome_unknown resolved by external evidence | allow |
Two rules do most of the work: a crash window with no explicit record is outcome_unknown, never absent; and only absent/reconciled admit a fresh attempt. The legacy boolean maps True โ completed for compatibility.
The test that had to turn red
We've been burned before by tests that verify their own construction. So the suite ships with a mutation self-test: --mutation-no-disposition disables the six-state check entirely and requires the disposition suite to go red. Delete the load-bearing branch โ 1 failed with the real failure signature; restore โ 9/9 green. A suite that stays green when the code under test is removed proves nothing.
(That lesson came from another public review, on a different repo, where a maintainer correctly called out that our first test "only verified its own construction". Public refutations are how we learn. We record them, with attribution, in our VERIFIED_BY.md โ a refutation that stands after review is credited more prominently than a pass.)
Why this matters beyond one repo
Autonomous agents are starting to carry money and side effects. The numbers on the runtime side are rough โ one independent sandbox study of 13,756 stdio MCP packages found only 46.5% even start and pass before any security check. When a recovery action retries after a crash, "did it already happen?" is a money question, and a boolean is not an answer.
Fixed vectors, idempotent replay, and signed receipts are how we think it should be answered. Our verifier-divergence corpus (DOI 10.5281/zenodo.24618874) publishes 11 fixed vectors against 5 Ed25519 verifier implementations, and independent teams now pin their runs against it with content hashes. The six-state suite lives in DSHCorrectover/correctover-recovery-admission โ clone it, run python3 ecr/verify-binding.py --mutation-no-disposition, and watch it go red on purpose.
The meta-point
AI (and AI-built systems) cannot be trusted to self-certify โ not ours, not anyone's. The gate has to live outside the thing being verified: a maintainer's hostile read, a mutation that must turn red, a third party who can re-derive your numbers from public anchors. If your test suite can't fail when the guarantee is deleted, you don't have a test suite; you have a mirror.
Cross-posted from our engineering notes. Attribution policy: hostile readers welcome, paid in credit, not in silence.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.