Skip to content

docs/spec/implementation/gotchas.md

Failure modes this system actually shipped with, kept because each one is cheap to reintroduce and expensive to notice. They share a shape: the pipeline stays green while quietly doing nothing. Nothing crashes, no alert fires, PRs keep appearing from the other work sources — and the only evidence is money spent on work that was already done. Budget for the fact that an autonomous system’s characteristic failure is not an error; it is a silent, confident, recurring no-op.

Trap What it looks like when it bites Build it this way instead
A --json field that is cheap to type and expensive to fetch gh pr list --json commits cost 31 GraphQL points a call against a repository with three open pull requests, because gh asks for commits(last: 100) in each of the --limit slots and GitHub charges for nodes requested, not returned. Two gatherers × three repos × two nodes × four cycles an hour was most of the 5,000-point hourly budget, and the fleet exhausted it on 2026-08-12 — after which every work source read as empty and the pipeline looked idle rather than blocked. Ask for the scalar (headRefOid, not commits[-1].oid) and fetch the rest from REST per candidate, where the budget is thousands. Measure a call’s real cost — bracket it with gh api rate_limit, which is itself exempt — rather than assuming that a listing of three items costs three items’ worth.
A listing that silently comes back at its page size gh pr list defaults to --limit 30 and says nothing when it truncates, so the back-pressure gate simply counted low — and a gate that counts low opens. Nothing bounds the listing at max_open_agent_prs, because a PR waiting to be merged carries the label but is excluded from the sum. State the cap (GITHUB_PR_LIST_LIMIT) instead of inheriting one, and test for it (github_pr_list_truncated). Then decide per call site which direction is dangerous: a work source that misses a candidate has merely not fired, whereas a gate that undercounts has let work past a cap that was already full.
A helper returns non-zero for a legitimately empty result, and the script runs under set -e [[ -z "$x" ]] && x="$(helper)" takes the helper’s exit status, so the whole cycle dies at that line. Here it died two lines before logging the failure it had just detected — nine cycles left nothing behind but a selection event and exit 1. A lookup that finds nothing is a normal outcome: return 0 and print nothing. Reserve non-zero for real errors. Assert it at the real call-site shape under set -e, not on the function alone — the function looked fine; the interaction was the bug.
The writer of an event and the reader of it disagree about the key attempt-failed recorded no repo/item; the blocked extract grouped by exactly those. Every event collapsed into one anonymous group, so no failed attempt ever blocked anything — for months, undetected, because each half reads correctly on its own. Round-trip the contract in a test: write the event, read it back through the real extract, assert the item is blocked. Any log the system reads back is a contract with itself.
A model’s clean “I can’t/needn’t do this” is treated as a crash A {"status":"blocked"} report went down the failure path and was filed as "implementer exited 0", throwing away the reason and unblock condition — the entire product of a full model run. So the next cycle bought the same discovery. A verdict is a result. Persist it with the model’s own words (requirement 9a), and note which verdict it is (requirement 9b). The log is the system’s only memory: a finding you don’t write down, you pay for again, on a schedule, forever.
Done-ness inferred from one channel “Done” meant a merged PR references it. Work that landed as a direct commit — or before the repo required PRs — has no PR, so it reads as outstanding forever, and the item is re-selected every cycle for as long as it exists. Don’t let one provenance channel be the only proof. Cross-reference the curated register (R12a), and let the agent that actually looks at the repo settle it once (requirement 9a). Prefer evidence from the tree over evidence from process metadata.
A rule with two implementations The dashboard and the Script each computed “blocked”. They disagreed, and the dashboard — the very place you would look to spot this bug — showed the wrong answer confidently. One definition, shared (requirement 34a). If a second consumer needs it, it sources the first, and the shared unit is where the test lives.
Identifiers assumed globally unique dependabot-alert-1 exists in every repo; date-numbered registers collide across repos too. Keying on the id alone makes one repo’s block starve another repo’s unrelated work. Key on the scope plus the id (requirement 34). Ask what an id is unique within before using it as a key.
A contract asserted in one document and required by none This spec’s design notes state the review “writes the R-NN cross-reference into each mirrored tech-debt entry” — and docs/spec/review/README.md never asked for it. Both documents were internally consistent; the system between them was not, and the dedup it justified never worked. When one component’s design depends on another’s behaviour, make it a numbered requirement in the document that builds that component, and cite it from both sides. Prose describing what another component “does” is a wish, not an interface.
A state that can never say “done”, read as if it could reviewDecision stays CHANGES_REQUESTED after the agent pushes its fix — GitHub won’t let a PR’s author dismiss a review on their own PR, and the agent is the author. So “is there unanswered feedback?” answered from the PR’s own state is always yes, forever. The PR is selected, fixed, re-selected, re-fixed, hourly, at Sonnet prices, and every cycle looks like a productive one. Ask “what would ever change this value?” before keying on it. Where the answer is “nothing we can do”, the state cannot be the signal — derive whose turn it is instead (requirement 3c: an answer event — a marked reply or a re-requested review — after the blocking review, the same shape as “a later green run supersedes”). A field that can only ever hold one value is not a condition, it is a constant.
A proxy signal that an unrelated action can forge “Whose turn is it” was derived by comparing the blocking review’s timestamp against the head commit’s committedDate — a real fix that came in stayed the answer. But a conflict-resolution force-push re-stamps every commit’s date to push time, with no review of its own having happened, so rebasing a PR to resolve a merge conflict silently read as “answered” and PR #205’s unresolved CHANGES_REQUESTED dropped out of every selection query for hours (agent-ops#239) — the same family lib/handoff.sh had already fixed twice under different names. Before trusting a timestamp as evidence an actor did X, ask what else moves that timestamp. Where anything unrelated can, key on an event the platform stamps only when X itself happens (a review-requested event, a marked reply) rather than a field that merely correlates with it.
The formal signal and the substance in different places The blocking CHANGES_REQUESTED review’s body read, in full: “Refer to https://…#pullrequestreview-4718691960”. All 6.5 KB of actual findings were in a separate COMMENTED review, by a different account — because the agent’s own account raised the PR and therefore cannot request changes on it. A gatherer that read only the blocking review would have handed the Implementer the words “Refer to” and called the brief complete. Gather the whole round, whoever wrote it, and pass it verbatim. When a platform rule (an author cannot review their own PR) forces a workflow to split across accounts, the split is structural and permanent — design for it rather than discovering it in the one review that mattered.
A change-detection digest that tracks churn instead of meaning The no-op short-circuit (requirement 3b) digested the run id of each workflow’s latest run. poetic schedules sync-framework.yml at 0 * * * * — hourly, the same cadence as the pipeline — so that one workflow busted the fingerprint on every single cycle. The feature was installed, tested, logged, green, and saved nothing; the only symptom was the bill it was built to reduce, unchanged. Found by reading the repo’s actual cron lines, not by any test. Digest the fact the consumer reads, not the record it lives in. Requirement 15 asks “is this workflow’s latest run a failure” — that is the conclusion, not the id. Before digesting a field, ask what changes it and on what cadence; anything that moves on a timer moves faster than the thing you are trying to detect. Then assert the negative (a green rerun changes nothing), because every positive test still passes on the broken version.
A cost-control feature that makes cost the only thing it protects Skipping a stage to save money is a decision to do nothing, and doing nothing is what a healthy idle pipeline also looks like. Get the skip condition subtly wrong — a source outside the fingerprint, a failed API call digested as “empty” — and the pipeline stops picking up work while reporting perfect health, forever, because nothing that stands down ever fails. Make the skip’s claim narrow enough to be provable (“nothing changed”), never broad enough to be wrong (“there is no work”). Mark unusable samples rather than degrading them to empty. Cap the whole mechanism with a time-based valve (none_selected_recheck_hours) so a gap in coverage is a bounded delay rather than an outage, and pay the occasional wasted run for it — the run you skipped wrongly costs more than the one you ran needlessly.
A switch with no way back on An agent disables the pipeline to edit safely, then dies mid-session — killed, timed out, or just finished and forgetful. The switch stays set. No cycle runs again. Nothing alerts, because “no PRs this week” is exactly what a quiet week looks like, and the operator finds out days later. Give any deliberate stop an expiry (requirement 2.3), and make indefinite something a human explicitly asks for. Same shape as the stale-lock rule (requirement 1): every mechanism that halts this system needs an answer to “what if whoever set it never comes back?”
One state carrying two meanings, where an agent can reason its way out of it “Blocked” meant both something is in the way and there is nothing to do. The Co-Ordinator is told to clear blockers that have lifted; it checked an already-done item, correctly found nothing in its way, and logged unblocked — returning it to the pool to be rediscovered forever. Every component obeyed its spec exactly. The fix for the previous row created this one, and it took a live cycle to see. Split the states (requirement 9b): blocked is clearable by an agent, void only by a human. Test that the clear for one cannot fire on the other. The tell: if the same fact that ought to make a state permanent is also grounds for clearing it, the state is wrong. Ask of every agent-clearable state: what would the agent have to believe to clear this, and is that belief the reason it exists?
A staleness clock reset by the system’s own housekeeping abandoned-drafts (requirement 3e) measured a draft’s staleness from updatedAt, which moves for anything at all. On poetic#92 a label edit deferred detection by a full abandoned_draft_after_hours, and — the sharper case — the Enabler’s own comment correctly diagnosing the stall reset the clock in the same breath it cleared the block, deferring the very recovery it had just enabled. Filtering by comment author could not fix it: every pipeline write happens under the same GitHub account a human also comments as. Ask “would this system itself ever produce this signal, and does that mean what a human producing it would mean?” before trusting a timestamp as “somebody is on it” (TD26072605). Where the answer differs, stamp what you write (lib/pipeline-marker.sh’s invisible marker) so the reader can tell its own hand from a human’s, and discount your own bookkeeping (label edits) unconditionally. Same shape as “a change-detection digest that tracks churn instead of meaning” above, but the churn here is the system talking to itself.
An operating-system limit the input grows into, one edit at a time The assembled prompt went to the stage as claude -p "$prompt". Linux caps one argv entry at 131072 bytes; prompts/coordinator.md grew from 37850 bytes to 62603 over seven days of ordinary requirement work, and on 2026-08-01 the assembled Co-Ordinator prompt reached 131441 — 369 bytes over. execve failed, the stage exited 126 with Argument list too long, the cycle logged attempt-failed and then cycle-end exit_code 0. Every node in the fleet went quiet within the hour and the dashboard showed four healthy idle nodes; the prompt ships in the image, so one roll broke all of them at once, and the node that had not rolled for four days broke the moment its operator ran docker compose up -d. Never put unbounded content in argv. Prompts, diffs, issue bodies, JSON briefs — all of it goes on stdin, where no such cap exists. The general rule: when an input grows monotonically with the product’s own development, find the ceiling before shipping it, because the failure lands not on the commit that caused it but on whichever later one crosses the line — and here that is a documentation-shaped commit, reviewed by people thinking about wording. Ask of any limit you are within: what consumes the remaining margin, and who would notice it being consumed?
A query whose wrong answer is the same shape as a clean result The gate added for requirement 31c asked the code-scanning API for the pull request’s alerts on refs/pull/<n>/head. GitHub files a pull request’s analysis under refs/pull/<n>/merge; the head ref has no analysis at all, so the API answered [] with a 200 — not an error, not an empty-because-broken sample, just “no alerts”, which is exactly what a clean pull request returns. The security half of the gate was therefore inert from the moment it shipped, and its unit tests all passed, because the stub was written to serve the same ref the code asked for. Checked against the case the gate was built for, poetic-fiddle #216’s high-severity alert is listed on refs/pull/216/merge and absent from refs/pull/216/head in every state — so the gate would have waved through the one pull request it existed to stop. When a check’s failure mode is an empty result, the empty result must be distinguishable from a legitimate pass before it is trusted: assert the query’s parameters, not only what the code does with the answer. A stub written from the implementation confirms the code agrees with itself, which is not the property under test — pin the ref, the endpoint, the SHA against the real platform once, and keep that as the assertion. Same family as “a cost-control feature that makes cost the only thing it protects” above: any mechanism whose broken state looks like its healthy state needs a positive signal that it actually ran.
Two different faults that reach the caller in the same shape TD-PPagop-26081305 split review_gate_required_checks in two so a node that cannot read GitHub would stop being recorded as N broken pull requests — dirty for a pull request with no required checks (poetic-fiddle #190’s conflicting-PR-runs-no-CI trap), unknown for a gh that could not answer. It split them on the shape of gh’s stdout: [] against nothing at all. But gh pr checks --required reports an empty required-check list as an error — no required checks reported on the '<branch>' branch, returned before the --json payload is ever written — so #190 arrives with empty stdout and a non-zero exit, byte-for-byte what a 502 looks like, and the [] branch is unreachable in production. Shipped, it would have filed every conflicting pull request as a degraded node, under an unblock_condition saying nothing found implicates the pull request: the same misattribution the item was written to remove, pointed the other way. The tests passed because the stub, written before the split, had always modelled #190 as its ERROR case. Before splitting one verdict into two, establish what the tool actually emits for each case — read its source, or run it against a real instance of each — rather than what its --json contract suggests it emits. A CLI’s error path is not covered by its output schema, and “no results” is the case most likely to be reported as a failure rather than as an empty one. Where two cases share a shape, the discriminator has to come from the channel that differs (here, stderr), and the stub has to carry the tool’s own wording verbatim for both — otherwise the test asserts a shape nothing produces.
One platform fact, two readers, two shapes The bot filter tech-debt/TD-PPagop-26081403.md added to both readers of “is a human review pending” was written once, in REST’s vocabulary — "type": "Bot", [bot]-suffixed logins, both real in requested_reviewers[] — and applied verbatim to the other reader, gh pr view --json reviewRequests, which is GraphQL-backed: gh’s exporter (cli/cli api/export_pr.go) keys each entry on __typename, never type, and its User/Team switch has no default case, so a Bot requested reviewer — Copilot code review, the item’s motivating case — is dropped from the array before any filter runs. The gatherer’s half of the filter was a silent no-op, and its fixtures, written from the filter rather than from gh’s real output, passed for the wrong reason. Harmless here only because the dropped entry leaves [], which reads as “nobody asked” — the answer the item wanted anyway. The same platform fact read through two channels arrives in two shapes, so a predicate ported between readers must be re-derived per channel, not copied. Capture what each channel actually emits (run the real tool against a live case, or read its exporter’s source) before writing either the filter or its fixtures, and fixture the stub from that captured output, never from the predicate under test — a stub written from the implementation proves the code agrees with itself, which is not the property under test. Where the shape makes a branch unreachable today, keep it only as labelled defence and assert the reachable path (here: emptiness) too. Same family as the row above, met from the opposite side: there two cases shared one shape; here one case wears two.
A health check that only compares peers, never ground truth Diagnosing the outage above meant reaching into a container’s stderr, because the dashboard’s only “is this node current” signal (version, the node’s own build) compared nodes against each other. All four nodes had adopted the same broken image, so all four agreed, and agreement rendered as four healthy green cards — the same shape a genuinely healthy, fully-rolled fleet produces. The comparison could not distinguish “up to date” from “uniformly broken” because both are “everyone agrees.” Peer agreement proves consistency, not correctness — it cannot catch the whole group being wrong the same way at once. Compare against a reference outside the set being checked (the registry’s own published commit, not another node’s opinion of it — lib/image-drift.sh, #155), the same reasoning origin/main serves for compose.yaml drift (#131). Ask of any “do these agree” check: what happens when every one of them is wrong in the same way?
A terminal state with a clearing event, but no retirement path for the ordinary case Requirement 34c gives void exactly one exit — a human’s hand-appended unvoided — because nothing else may reason its way out of a terminal state. That is correct for a wrong void; it says nothing about a right one, which is the overwhelming majority, and a right void never earns its one exit. The set grew by one entry for every item ever voided, forever, and on 2026-08-12 it reached 122 entries and 133,615 bytes — past MAX_ARG_STRLEN — taking the fleet down the same way the row above already had (issue #309). The fix for that row (requirement 4g’s stdin delivery) raised the ceiling; it did not stop the set from still climbing toward whatever ceiling came next. An append-only set bounded only by its one human-authorised exit is bounded in theory and unbounded in practice, because the exit is for the exceptional case, not the ordinary one. Ask, of any state whose correctness is what keeps it around: once this verdict has been acted on and nothing more will ever change about it, does anything let it go? If the only answer is “a human clears the wrong ones”, that is a correctness escape hatch wearing a retention policy’s job — build the second one (requirement 34n) separately, gated on the fact already being acted on rather than on a verdict having been reached.
A limit outside the process, that only the vendor’s error message names Requirement 4g moved the fleet-state aggregates off argv and wrote, in its own text, that doing so “raised the ceiling; it did not stop the set from still climbing toward whatever ceiling came next”. The next ceiling was the model’s context window. Nothing in this repository had ever measured a prompt against it: MAX_ARG_STRLEN at least has a number in a header file, whereas the window is a property of a model id in config.json, and the tokens it is spent in are not a unit the Script can count. So the issues band grew a comment at a time — ~212999 tokens, ~220498, ~226580 — and on 2026-08-21 the API refused four consecutive cycles on every node (agent-ops#641). The refusal said exactly what was wrong, in coordinator.out; the Script recorded coordinator exited 1 and the escalation sent its reader to coordinator.out.stderr, which an API refusal leaves empty. A limit enforced by something you do not run is still your limit, and the fact that you cannot measure it exactly is an argument for a measured proxy with headroom, not for not measuring. Ask, of any input assembled from history: what refuses this when it gets too big, does anything here know that number, and what does the refusal look like when it comes? Two habits fall out. Bound the whole artefact the limit applies to — requirement 4i budgets the assembled prompt, not the runtime input, because budgeting the input alone would let the prompt’s own growth eat the headroom silently. And when a vendor hands you a diagnosis, keep it: a stage that exits non-zero having been told why must put that reason in the record, and group its crash-loop ladder on the stable half of it, never on the numbers that move every cycle.
A verdict cemented by the very mechanism built to stop paying for it Requirement 3b’s no-op fingerprint exists to skip a Co-Ordinator run that could only repeat its last answer — a claim about what changed, deliberately never about whether the answer was right. The tech-debt band was still the Co-Ordinator’s own live read (issue #310): between 2026-08-10 and 2026-08-12, with ~30 eligible items sitting in the register, it returned none-selected with reasons that misdescribed the band (“requires per-item evaluation…”, “heavily voided or blocked” — 29 of 30 were neither). Nothing about that answer being wrong stopped the fingerprint from matching it: the rule only ever asked “would the inputs look the same,” and they did, so the fleet replayed the wrong verdict for free across all of 08-11 — 240 stand-downs, not one Co-Ordinator invocation. A cost-control skip that trusts a verdict’s fingerprint has no opinion on the verdict’s content, and was never designed to — so give the parts of the system that can hold an opinion (the Script, which now pre-filters the band deterministically per requirement 3t) a way to say “this one doesn’t count.” A none-selected whose own stated reason contradicts data the Script itself already computed must not be allowed to arm the short-circuit — omit the fingerprint from that event, the same way an empty one already is, so the very next cycle asks again rather than replaying the wrong answer until the forced recheck. Same family as “a cost-control feature that makes cost the only thing it protects” above, sharpened: that row is about a skip condition computed wrong; this one is about a skip condition computed correctly over a verdict that was itself wrong, which no fingerprint hygiene alone can catch — it needs a second, independent check of the verdict’s content.
Detecting a wrong verdict is not the same as recovering from one Requirement 3t’s corroboration gate (above) stops a rejected verdict from arming the fingerprint, so the next cycle is never frozen on a stale wrong answer again. But detection alone left the rejected cycle itself still standing down empty-handed — and issue #310’s own incident showed the same wrong verdict recurring across cycles and nodes, not as a one-off. A gate that only ever un-arms the fingerprint degrades, under a persistent confabulation, into a warning-per-cycle loop with zero selections: visible on the log, but liveness still depending entirely on the model eventually reasoning its way to a different answer. Give the failure a second, cheaper try before treating it as a stalled cycle (requirement 3v’s one retry, quoting the Script’s own contradiction back at the model — a pointed correction, not a generic “try again”), and then a recourse that does not depend on the model at all (mechanical fallback selection, scoped to bands the Script can already enumerate without live judgement). The general shape: a machine check that can detect a wrong answer is only half the fix if the only recovery it can trigger is “ask the same question again next cycle” — pair detection with an escalating, boundedly-costed retry path, so the system’s liveness stops being hostage to the one component it cannot make more reliable by construction.
A machine check proved on one band is not a machine check Requirement 3t’s corroboration gate closed issue #310’s freeze by counting one band — tech-debt — and the fix read as complete because that was the band the incident happened in. It was not: a none-selected over a non-empty issues, findings, review_feedback, merge_conflicts, abandoned_drafts, human_visibility or register_hygiene array passed the gate untouched, so the identical confabulation one band over would have frozen the fleet the identical way, with nothing in the log even able to detect it. The pre-fetch fixed “the model declines to read the source”; the corroboration fixed “the model misdescribes what it was handed” — but only where somebody had already been burned. State the invariant, not the instance: every load-bearing negative the model asserts must be corroborated against the Script’s own count of what it handed over (requirement 3x), and then build it as one band-parameterised mechanism rather than one check per band, so adding a band cannot silently add a hole. Expect the generalisation to surface what the single-band version could ignore — here, that issues was the one band whose decline routes were not exhaustive (a question-or-discussion issue could be skipped silently and requirement 16a explicitly forbade reporting it), which is a real gap the narrow check had simply never had to look at. A check that cannot be generalised without changing a policy is usually telling you the policy is the defect.
A safety justification written as “harmless until X lands,” read after X has landed TD-PPagop-26081507 recorded that the merge-autonomy kill switch’s fail-open no-cache case was “harmless: nothing arms an approval or a landing on the flag” — explicitly, deliberately, “until WI-5 lands.” WI-5 (this document’s own Approver stage, requirements 8b/8c) is the first behaviour-affecting caller of merge_autonomy_effective_level, and it landed with that tech-debt item still open and its own fix (agent-ops#448) still unmerged: the justification expired the moment this stage started reading the kill switch for a real decision, and nothing forced the two facts to be checked against each other. A deferred item whose own body names the change that revokes its justification is a dependency, not a footnote — treat “must not arm until X” the same as a numbered Blocked-by:, checked at the moment X is about to land, not left to a reader noticing the tech-debt file in passing. Landed here anyway, deliberately, because the exposure is layered — merge_autonomy’s product default is human fleet-wide, every level above it needs an explicit per-installation opt-in, and the live installation had not yet raised it past Stage 0 — but the register entry stays open and this row exists so the next reader does not have to rediscover the ordering risk from source.
A gate written for one caller silently has no caller on the recovery path Requirement 31c’s gate — required checks green, no new security-severity alert — was written and tested against the Reviewer’s own ready handoff, and every acceptance check for it drove that one path. The Enabler’s complete_handoff (requirement 32b) flips the identical draft-to-ready action through a different call site, added later, and nobody re-asked whether the gate bound there too — it did not, by omission rather than by decision. PR #433: the Implementer failed, so the Reviewer block never ran at all, and two hours later an Enabler engagement read complete_handoff’s own four preconditions (“checks green”, “no unanswered concern”) as satisfied — vacuously, since nothing had ever checked or raised a concern to answer — and flipped the pull request to ready with a red check list and no Reviewer having ever read the diff. An irreversible action reachable from more than one call site needs its gate to live under every caller, not beside one of them (requirement 34a) — a second path added later inherits nothing a first path’s own inline check protected. Where a caller performs a recovery of another stage’s work (here: finishing a handoff the Reviewer left undone), ask what the recovery is standing in for, and refuse to stand in for a stage that never actually ran — a precondition can read as satisfied for the sole reason that nothing has asked it yet.
An escalation route that needs the very thing whose absence it reports Requirement 2.0b escalates a rejected — or missing — GitHub credential through create_escalation_issue, which reads and writes GitHub under the same GH_TOKEN the probe has just established is unusable — so gh issue list and gh issue create fail the same way the probe’s own call just did (HTTP 401: Bad credentials for a rejected token, gh’s local “no authentication token” refusal for a missing one), and the filing 0b’s text describes fails every cycle for as long as the credential problem persists. The warning-and-retry fallback that is a genuine exception for requirement 1c’s freeze and requirement 2.7’s crash loop — whose triggers leave GitHub reachable — was 0b’s expected path, so the spend stopped but nobody outside the node was told, until acceptance check 2m’s escalation_webhook_notify closed the gap: a credential-independent webhook, POSTed from inside create_escalation_issue itself on every failure, so no escalation route had to be revisited individually (TD-PPagop-26082304). Before writing “and it escalates”, ask what the escalation route itself depends on, and whether the condition being escalated breaks it. Where the answer is yes, the alarm needs a carrier the fault cannot take down — for a GitHub-credential fault, one that is credential-independent of GH_TOKEN. Keep the doomed attempt (it costs one call, and it is right if the fault is ever narrower than assumed), but record in the requirement that its failure is the norm, so no later reader mistakes “escalates” for “reaches someone”. Put the fallback where the doomed attempt already fails once, shared by construction, rather than at each call site, which a future new route could forget.
A “snapshot” horizon captured too late is wall clock wearing a disguise Requirement 39f’s own-label grace period (agent-ops#670) is supposed to measure how stale union_log is, not how long the cycle has been running — but union_log is not immutable after it is snapshotted: the cycle appends its own fresh local log lines into it at least three times before the requirement-39f read-back runs. Computing the horizon as “the newest .ts in $union_log” at read-back time, instead of once right after the snapshot, would silently reintroduce almost the same bug the fix exists to close: this node’s own events, appended in between, advance the horizon in step with wall clock, so a long cycle would again read a peer’s label write — still absent from the snapshot proper — as older than it really is. Capture a derived “as-of” value once, immediately next to the read whose staleness it is meant to describe, into a variable — not a function re-derived from state the rest of the cycle goes on to mutate. union_log_horizon="$(log_latest_ts "$union_log")" sits on the very next line after union_log is materialised, textually before any >> "$union_log" append, so nothing downstream can move it forward by coincidence.
A fail-closed gate that fails every time, and so is never seen to pass landing_protected_paths_hit (requirement 8d) read its changed-file list with gh api …/files -F per_page=100, and gh api sends a request carrying -f/-F fields as a POST unless --method GET says otherwise — a 404 on this path. The read failed on every call from the day D18 Stage 2 was entered; every call site did the right thing with the exit 2 and refused to arm. The fleet logged 72 landing-refused events reading unknown:could not establish …'s changed-file list, raised and reviewed pull requests as usual, and never armed a single landing in five days — while the stage report, correctly, showed 0 autonomous landings (agent-ops#718). Give a gate that can refuse for an environmental reason a way to be seen never succeeding: alert on a refusal reason whose rate is 100%, and make the first success of a new capability an explicit, dated exit criterion rather than an assumption (the Stage 1 exit check’s “merged with only the App’s approval is not merged by the App” distinction is the same lesson, one rung down). In tests, stub a dependency’s rule, not just its shape — the stubbed gh that dispatched on the path alone answered happily to a request the real one refuses.
A killed command destroys the work that finished before it, not just the work in flight The Reviewer’s own Bash tool kills a command still running at 10 minutes and returns nothing for it — not partial stdout, not the exit code of whatever it had already checked, nothing (requirement 29a). On agent-ops#734 the model read that as a command to retry rather than a wall to plan around: three consecutive 10-minute kills against the same unbatched test/*.test.sh run burned exactly a third of a 90-minute budget for zero test evidence, and a fourth hour of ad hoc re-batching still did not finish — so the review’s own findings, already complete after the first 13 minutes, were never posted in time and the whole engagement was recorded as a failed attempt. Before running anything that might be large, ask what the tool that runs it will do if it is too large — here, silently discard everything, including the part that already succeeded. Where the answer is “nothing survives,” split the work into pieces sized to the limit before the first attempt (scripts/run-tests.sh --list, requirement 29a) rather than sizing down only after a kill proves the first guess wrong, and land whatever is already decided (a review’s own findings, posted as formed — requirement 30a) before starting the part that risks the wall, so a kill there costs only the part still in flight.
A network-layer fault surfacing behind an application-layer control With DOCKER_MTU unset on a host whose egress link sits below 1500, DNS resolves, squid accepts the CONNECT — and the TLS handshake inside the tunnel hangs and resets, which reads as “the egress allowlist is blocking me” when squid already said yes. The debugging then happens at the wrong layer, in the allowlist, where nothing is wrong. The egress network carries the same DOCKER_MTU driver_opts as the default bridge, and doctor.sh’s Egress fail message names the trap. Rule the MTU out (compose.yaml’s own note tells you how) before touching the allowlist.
A pipeline stage whose reader exits first, under pipefail do_push took the newest cycle id with `find … sort -r
A cleanup path that only ever runs during the very failure it exists to clean up after _techdebt_unfile undid a half-finished tech-debt filing’s writes on the one path that reaches it: techdebt_file_debt’s own failure handler, calling straight back into the GitHub API whose failure just put it there. The correlation is near-total — a transient window that fails a branch-create or contents-write call is the same window that fails the DELETE meant to undo it — so the cleanup was likeliest to fail exactly when it was needed and silently fine the rest of the time, which is why nothing noticed. On 2026-08-23, fourteen consecutive td/<id> reservations (TD-PPagop-26082407 through -26082420) orphaned in a seventy-second window, and nothing short of a human running git push origin --delete by hand would ever have released them: scripts/sweep-orphan-branches.sh deliberately leaves a bare reservation branch alone (issue #545, since it cannot tell whether the id was filed elsewhere), and the push-triggered release workflow only ever fires for an id that actually reached main — one that never did stays invisible to both, forever, exactly as lib/tech-debt-file.sh’s own header conceded before TD-PPagop-26082427 (_techdebt_release_ref, scripts/release-pending-reservations.sh) closed it. A failure-path cleanup that calls back into the same dependency whose failure triggered it is not a backstop, because the two share a failure mode by construction — one retry, run once, in the same breath as the fault. Ask, of any “undo what I just wrote” step: what happens if the undo fails too, and is anything left that will ever try it again? Where the answer is “no”, make the failure durable — a marker outside the failed call’s own blast radius (here, a different repository’s contents API) that a later, independent, periodically-retried pass can act on — rather than one best-effort attempt logged and swallowed.
A promise measured from the wrong event lets a later one silently outrun it Requirement 35a’s issue-closed reason compared the item’s latest escalation against its latest block B ($escalation.ts > $b.ts) — the raise time, not the human’s act. That held only as long as nothing re-blocked the item between the raise and the next Enabler pass; a Co-Ordinator needs-refinement re-flag is cheap and frequent (agent-ops#683, TD-PPagop-26082816) and moved B past the escalation on three items in one run on 2026-08-27 (#706, #779, #810). Each stranded close then satisfied neither issue-closed (keyed on the raise) nor threshold (requirement 36b’s thrash guard refuses a second refinement without a human touch), so the only exit was a second escalation asking the human to say again what they had already said (#849→#905, #784→#906, #813→#910) plus an Opus engagement to establish that nothing had changed — the exact cost agent-ops#627 exists to remove (TD-PPagop-26082901). When a rule promises to react to a human act (closing an issue, approving a review), key it on evidence of the act and what it answered, not on a timestamp from before the act that something else can silently move past. Where the something-else is itself cheap and frequent, assume it will race the human, and give the exemption a second, narrower path keyed on “this later event still refers to what the act already settled” (here: a needs-refinement re-flag with no item-refined since the escalation) rather than widening the original comparison until it drifts from what it was measuring.
A bash default that only the empty case ever exercises The fit-exemption gate read ${coordinator_fit_report_json:-{}}. ${parameter:-word} closes on the first unquoted }, so the default word was { and a literal } was appended straight after it — harmless on the one path nobody was watching (the variable unset or empty, composing exactly {}), and silently corrupting it into invalid JSON on every path that mattered (a real, non-empty fit report). jq failed to parse it, the guard read the failure as “fit did not run”, and requirement 34e’s fourth refusal, requirement 3x’s trimmed exemption and requirement 65’s fabrication check were dead code on every fitted cycle from the day the guard shipped — the fleet fitted at rung 15 on 47 cycles in one day (2026-08-28) with none of the three ever firing (TD-PPagop-26082816, agent-ops#933). Every test that exercised the gate had only ever driven the empty case, which is precisely the one the bug leaves working. A ${var:-word} default containing an unescaped {/[ is a trap in bash, not a style choice — the closing brace/bracket it needs is the first one bash finds, not the one the author meant. Prefer initialising the variable to a real value ahead of the guard (the set -u-driven convention this file already uses for coordinator_fit_allowance) over threading a brace-shaped default through a parameter expansion at all. And when a guard’s fixture only ever sets its input to empty or unset, that fixture cannot tell “the gate is off” from “the gate is broken” — assert the non-empty case too, the one place this shape of bug hides.
A per-entry scan that was “cheap at a handful-to-low-hundreds” gh_shim_cache_invalidate found the entries a write invalidates by opening every file in http-cache/ with a jq — two per entry. Nothing bounded the count, the prune ran at two days, and once the authoring App went live each hourly token was a new identity re-caching every path: 13,000–19,000 entries a node, 484 identities on one. Every registry PUT/DELETE — the pager’s per-window claims, claim.sh gc’s ~90 deletes a cycle — then cost two to three and a half minutes of CPU, the pre-Co-Ordinator phase grew from 45 to 150 minutes on every node inside a day, and the fleet landed 8 PRs in 24 h with a healthy budget and a fast GitHub (agent-ops#1422). Never let a write’s cost be a function of the cache’s size: lay the cache out so the thing a write invalidates is one directory it can name (http-cache/<identity>/<path-hash>/), and key identity on what the data is actually scoped by (the installation), not on a credential that rotates. When a comment sizes a loop by an assumed count, test the assumption at a hundred times that count.
A fix that rests on a mechanism one uncontrolled observation named agent-ops#1827 read two abandoned Publisher working sets as proof that bash skips the EXIT trap on an untrapped TERM, and the first fix trapped TERM, INT and HUP to an exit. Its own regression case passed forty-one times with those traps deleted, because bash runs the trap on a fatal signal; the reproduction that had “confirmed” the leak had diffed /tmp before and after a publish while two other publishes were writing there. A fix built on it would have shipped, tested, and changed nothing about the leak it named. Before building on a mechanism, make it fail on demand in isolation — one process, one directory it alone writes, the signal sent the way production sends it — and attribute what is left to a process by a name that carries its pid, never by the difference between two listings of a shared directory. A fix whose test passes without it is a comment, not a fix: write the case that fails first, and if none can be written, the mechanism is not the one at work.
A whole-document parse of a log that many writers append to, failing open limit_union_record, limit_standdown_since, the --status decisions and overrun counts and the drained dedup each slurped a fleet log with jq -s, discarding its stderr and forcing its status true. From 2026-09-16 the union held 33 spliced lines — the head of one record run into the whole of a later one, left by writes a full disk cut short on both VM nodes — so every slurp aborted and every reader answered empty: no limit in force, no freeze start (and GNU date -d "" then answered midnight today, so a freeze could never come of age), zero decisions. Nothing looked wrong for two weeks, because “nothing found” and “could not read” came back identical (agent-ops#2037). Read a log as raw lines and parse each on its own — jq -nR over inputs with a per-line fromjson? // empty, folded with reduce — so one bad line costs one line and the reader holds one record at a time; plain inputs under jq -n aborts on the same line. Let a read that fails outright exit non-zero, and have the caller report it (guard_warn) rather than read it as absence. Fold with reduce, not first, limit or any: under jq 1.6 a try, which fromjson? is, swallows the break those are built on, so over such a stream they do not stop.
Repairing a stream after the sort that ordered it The fleet union is sorted by line, and every line opens with its ts, so a spliced line — the head of one record run into the whole of a later one — sorts at its head’s timestamp. The first repair of #2037 rewrote each cycle’s sorted snapshot, putting the record it recovered in the spliced line’s slot, ahead of records older than itself: with this node’s limit-hit at 09-17 and a peer’s recovered one at 09-18, the freeze’s start read 09-18 and the governing hit came from the 09-17 record. Once the peer repaired its own copy and the sort placed the record properly, the start moved back to 09-17, the once-per-freeze dedup keyed on it found nothing, and a second escalation would have been filed. The repair also appended a wall-clock log-repaired record, which then set requirement 39f’s horizon on every cycle while any peer copy stayed damaged. Take a damaged line apart before the sort, so each record it holds enters the sort on its own: a record’s place in an ordered stream belongs to the record, not to the line it arrived on. And never write into a snapshot a value — a repair record, a timestamp — that a later read of the snapshot takes for evidence about what the snapshot holds.
A reader that filters almost everything away, written to slurp first and filter second log_latest_ts and crash_loop_open_escalations each held the entire fleet-log union in one jq array just to take a max or throw almost all of it away again — correct the day each was written, when the union was “one read of a file the cycle would have read anyway”. By 2026-10-10 the union had grown to 111 MB (merge-observed logged thousands of times a day is most of it), and both readers run every cycle, one of them — log_latest_ts, for requirement 39f’s horizon — before the lock is even checked. ockham-2’s parent cgroup OOM-killed five jq processes that day (anon-RSS 541-616 MB each against a 1536 MiB ceiling), and a killed log_latest_ts fails open to an empty horizon with nothing in the log but the kernel’s own dmesg to show for it — the reader’s own fail-safe contract made the failure invisible from inside the pipeline. label_own_actions_map, audited against the same question once the first two were found, held the identical shape for a label’s own handful of own-label-action events. Ask, of any reader over a log that only ever grows: does its own memory hold the whole stream, or only the part its answer actually needs? A reduce fold needs one running value, never the stream; a reader that keeps a small minority of events needs a select before the collection that holds them, never after. Where the two disagree, a reader can look “filters most things away” and still cost like a full slurp, because the filtering happened one step too late. Separately: a reader cheap enough to run is still a reader a tick that finds the lock already held should never have to run at all — requirement 1’s own pre-lock check exists so that case costs a stat, a small cache read and a kill -0, with the union never built in the first place.