Skip to content

lib/handoff.sh's handoff_answer_events still takes a repo's whole reviews/comments arrays as --argjson

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

Found while writing TD-PPagop-26081406’s regression tests (test/review-feedback.test.sh): handoff_answer_events in lib/handoff.sh still delivers REVIEWS_JSON, COMMENTS_JSON and REREQUESTS_JSON via --argjson, not stdin — the same argv-cap shape requirement 4g exists to remove everywhere else. A single review or comment body past MAX_ARG_STRLEN (131072 bytes) makes the call die at execve, and both call sites read $? as failure with no distinct “could not tell” outcome:

  • scripts/gather-review-feedback.sh calls it with the repo’s raw $reviews array, before $fresh (the already-converted TD-PPagop-26081406 site) is even derived — so a single oversized review makes the whole candidate rule fail here first, upstream of the site that item converted. Confirmed while writing this record: a fixture with one oversized review body reproduces /usr/bin/jq: Argument list too long from this call, even when every other input stays small.
  • scripts/sweep-human-visibility.sh calls the same function, through handoff_round_answered, for the identical reason (requirement 38c).

The fix is the same mechanical conversion TD-PPagop-26081401/26081406 already established elsewhere in this file’s siblings: concatenate the three documents, deliver on stdin with a here-string, bind positionally with input as $name in the printed order, and leave nothing but the function’s own bounded arguments (there are none here) in argv. Convert together with a regression test carrying a fixture proved past MAX_ARG_STRLEN, pinning which direction the call fails in today (unguarded — it propagates the jq failure straight to the caller, which is the caller’s own concern to handle, not this function’s).