Skip to content

agent-cycle.sh hands scripts/gather-human-visibility-hygiene.sh its whole violations log as a single argv element

Id: TD-PPagop-26081502 · Status: resolved · Filed: 2026-08-15 · Resolved: 2026-08-15 · Ref: https://github.com/Poetic-Poems/agent-ops/pull/435

Found while writing TD-PPagop-26081406’s regression tests (test/gather-human-visibility-hygiene.test.sh): requirement 4g’s whole framing is “fleet-state JSON reaches jq on stdin, never in argv” — but MAX_ARG_STRLEN (131072 bytes) is a kernel-wide per-argument execve cap, not a jq-specific one, and it binds a shell script’s own CLI invocation exactly as it binds jq --argjson. agent-cycle.sh calls:

out="$("$SCRIPT_DIR/scripts/gather-human-visibility-hygiene.sh" "$slug" "$violations" "$pr_label" ...)"

$violations is the fleet-wide human-visibility violations log for this repo — unbounded past this call, the same aggregate shape every other site TD-PPagop-26081301/26081401/26081406 converted. Delivered as the script’s own second positional argument, it is a single argv element subject to the identical 131072-byte cap jq --argjson was hitting. Confirmed while writing this record: invoking the script directly with a 151202-byte $violations argument fails with Argument list too long before the script’s own internal jq calls (already converted by TD-PPagop-26081406) ever run — nothing inside the script can fix this, because the process never starts.

The fix is scripts/gather-human-visibility-hygiene.sh reading violations from stdin instead of its second positional argument (its own internal jq calls already expect stdin delivery post-TD-PPagop-26081406, so this is a consistent shape change, not a new one) — mirroring scripts/nudge-dependabot-rebase.sh’s own stdin-delivered candidates array, already right on this point. Update the one call site in agent-cycle.sh (and its usage comment) to pipe $violations in rather than pass it positionally, and add a regression test driving the real script over a violations log genuinely past MAX_ARG_STRLEN — the same technique test/nudge-dependabot-rebase.test.sh already uses for its own stdin-fed candidates array.