Skip to content

The expensive-gather cache-save build binds nine stdin documents positionally without asserting stream exhaustion, so a gatherer regressing to multi-document output would silently shift every later band

Id: TD-PPagop-26083101 · Status: open · Filed: 2026-08-31

PR #1109’s cache-save build in lib/candidate-gather.sh delivers its nine raw values to jq on stdin, bound positionally with input as $name (requirement 4g). Requirement 4g’s guarantee — one document per value — is normally provided by the caller slurping (jq -s -c), but these are the raw gatherer outputs, unslurped. Today every gatherer emits exactly one compact document (verified in scripts/gather-tech-debt.sh, scripts/gather-issues.sh, and lib/candidate-select.sh’s gather_* wrappers), so there is no live defect. But the failure modes are asymmetric versus the old --argjson shape: a two-document band no longer errors — input silently binds the extra document to the next name, every later band shifts onto the wrong key, and the resulting cache document is a well-formed object that passes both expensive_gather_cache_save’s non-object refusal and _expensive_gather_cache_valid, so the misbinding would replay undetected for a full rotation. One unslurped gh api --paginate in any of nine scripts away from a silent misbinding. Relatedly, expensive_gather_cache_load’s jq -c '.' would print a multi-object cache file (only creatable by an external writer) as multiple lines, feeding the same multi-document shape downstream. Options: (a) assert stream exhaustion in the cache-save build itself, the handoff_answer_events precedent — one local edit, catches any gatherer regression at the save site where the existing || log_event "warning" already reports it; (b) slurp each band jq -s -c in the gatherers — nine edits, fixes it at the source but must be maintained in each; (c) accept the risk with the Reviewer’s PR #1109 comment as the only record. Raised by the Reviewer on PR #1109 (agent-ops#1107) and deliberately left unfixed there as out of scope.

Default: Option (a): add a stream-exhaustion assertion to the cache-save jq program (e.g. ending the pipeline with a check that [inputs] == []), because it is one local change at the exact site that relies on the contract and it reports through the caller’s existing warning path.

Section titled “Default: Option (a): add a stream-exhaustion assertion to the cache-save jq program (e.g. ending the pipeline with a check that [inputs] == []), because it is one local change at the exact site that relies on the contract and it reports through the caller’s existing warning path.”

Noticed while the Approver was judging https://github.com/Poetic-Poems/agent-ops/pull/1109.

Migrated to https://github.com/Pullwright/agent-ops/issues/2009.