Skip to content

agent-cycle.sh answers "I could not tell" with "there is nothing" at 88 guarded call sites

Id: TD-PPagop-26081407 · Status: resolved · Filed: 2026-08-14 · Resolved: 2026-08-14 · Ref: https://github.com/Poetic-Poems/agent-ops/pull/398

agent-cycle.sh carries 88 occurrences of the shape

Terminal window
x="$(some-command … 2>/dev/null || echo '[]')"

— a command whose stderr is discarded and whose failure is replaced by a literal. Most are jq; a minority are date, wc and cat. By the value substituted:

fallback count
echo 0 32
printf '%s' "$var" (pass through unchanged) 19
echo '[]' 18
echo '{}' / printf '{}' 9
other literals (main, auto, ?, 1970-01-01T00:00:00Z, …) 10

The guard itself is not the defect. A cycle that dies because one jq could not parse one optional field is worse than a cycle that carries on, and this script runs unattended under set -euo pipefail, where an unguarded substitution is a killed cycle. That reasoning is sound and is why the shape spread.

What the shape gets wrong is narrower and worse: 59 of the 88 substitute an answer that is indistinguishable from a real one. An empty array is not the same fact as “I could not compute the array”, a zero is not the same fact as “I could not count”, and nothing downstream can tell which it received. The other 29 — pass-throughs and defaults like main or auto — are mostly benign, because the value they yield is one the caller would have accepted anyway.

On 2026-08-14 the shape did exactly this, at agent-cycle.sh:1106. unaccounted_items’ own 2>/dev/null || echo '[]' turned an execve failure into zero unaccounted items, so the Script corroborated the Co-Ordinator’s none-selected verdict and wrote no requirement 3v contradiction — silently, and precisely when there was the most recorded refinement to account for. The root cause there is an argv-cap delivery recorded separately as TD-PPagop-26081406; this record is about the second half of it, which is that nothing anywhere said the computation had failed. Requirement 4g’s own statement makes the same observation about its three fail-open sites: “what those three implement is exactly the machinery that retires void state, so the failure had disabled its own remedy.”

Reproduced against main:

builder input bytes -> 446001
builder rc -> 126 (jq: Argument list too long)
downstream result -> [] (indistinguishable from "nothing unaccounted")

What good looks like, and where it already exists

Section titled “What good looks like, and where it already exists”

The gatherers do not have this problem, because they were written the other way round. scripts/gather-tech-debt.sh and scripts/gather-issues.sh fail through degrade, which says why on stderr before it yields []; since TD-PPagop-26081401’s review, scripts/gather-merge-conflicts.sh and scripts/gather-hand-flagged-refinements.sh do the same per candidate through warn. In every case the fallback value is unchanged — only the silence went.

agent-cycle.sh needs no new mechanism to match them. log_event exists at agent-cycle.sh:547, and the script already uses log_event "warning" for exactly this class of degradation elsewhere (the dropped needs_refinement entry at 1357, the unparseable-verdict warnings). A degradation that reaches the union log is one the dashboard, the crash-loop ladder and a human reading cron.log can all see.

Scope: triage first, not a blanket conversion

Section titled “Scope: triage first, not a blanket conversion”

Converting all 88 would be wrong, and 88 new warnings per cycle would be noise that buries the ones that matter. The first job is to classify each site against two questions:

  1. Can this input fail at run time? A jq 'length' over a value this script built and validated three lines earlier cannot; one over a value that arrived from gh, from the log, or from a stage’s output can.
  2. Is the fallback distinguishable from a real answer? printf '%s' "$unchanged" is; echo '[]' and echo 0 are not.

Only sites failing both tests need to change, and the change is to report — log_event "warning" where the log is reachable, stderr where it is not — while keeping the fallback exactly as it is. Sites that pass are worth a one-line comment saying which test they pass, so the next reader does not re-triage them.

Convert a site together with a test that pins it in the direction it fails, as requirement 4g’s acceptance check requires and as the pins added for TD-PPagop-26081401’s converted sites do.

  • TD-PPagop-26081406 — the argv-cap deliveries whose failures this shape swallows, including the agent-cycle.sh:1106 chain above.
  • TD-PPagop-26081401, TD-PPagop-26081301 — the two completed argv sweeps; requirement 4g’s own text records the silent-degradation half of the 2026-08-12 outage as the reason its rule exists.
  • PR #369 — the same distinction applied to the Publisher: an assemble that failed is no longer published as an empty payload, because a page that ages against its own generated_at reports an outage where an unparseable one hides it.