Skip to content

bot-comment retry scan fails with "jq: Argument list too long" on PRs with many comments — undispositioned bot comments are never retried #2072

Closed

Description

@don-petry

Summary

The bot-comment retry scan added in #2022 fails closed on PRs with many comments: jq is invoked with the whole comment list as a command-line argument and exits with Argument list too long, so the scan skips the PR and never retries its undispositioned bot comments.

Evidence — PR #1953 (2026-10-07)

pr-review run 37660413486 (workflow_dispatch, head 01aaf93) logged:

[bot-comment-retry] scripts/lib/bot-comment-retry.sh: line 230: /usr/bin/jq: Argument list too long
[bot-comment-retry]   [warn] bot-comment retry: could not read PR 1953 comments in petry-projects/.github-private — skipping (fail closed)

The gate in the same run withheld approval because 4 PR issue comments lacked a verified disposition. The retry that exists to clear exactly that case never ran. On 2026-10-04 the same scan worked on this PR (it dispatched a retry for one CodeRabbit comment); the comment history has grown since.

Cause

scripts/lib/bot-comment-retry.sh (~L230) passes the fetched comments to jq via --argjson or an argument, which hits the OS argument-size limit (ARG_MAX) once the JSON is large.

Proposed fix

Feed the comment JSON to jq on stdin or from a file (jq --slurpfile / jq < file), never as an argument. Apply to every jq --argjson/--arg call in the retry library that carries comment bodies.

Acceptance criteria

  • The scan reads PRs with thousands of comments and several MB of comment text without error.
  • A fetch or parse failure still fails closed, with a distinct warning from the size case.
  • bats test with a synthetic large comment set (well over ARG_MAX).

Generated by Claude Code

Activity

  1. don-petry commented on Oct 7, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead Implementation Plan

    Issue: #2072 — bot-comment retry scan fails with "jq: Argument list too long" on PRs with many comments

    Scope

    Stop bcr_fetch_pr_comments from passing accumulated comment JSON to jq as command-line arguments (--argjson); stream each page to a temp file and merge with jq -s reading the file, and emit a distinct stderr reason for each fail-closed path.

    Implementation Checklist

    • scripts/lib/bot-comment-retry.sh: bcr_fetch_pr_comments appends each page's nodes array to a temp file and merges with jq -cs 'add' (no --argjson of comment data); temp file removed on every path
    • Same function: distinct [warn] on stderr for API failure / GraphQL errors / unparseable page / invalid pagination / merge failure (still returns 1, echoes nothing on stdout)
    • Audit other --arg/--argjson uses in the retry library and callers (dev-lead-retry.sh, dev-lead-intent.sh) — only L230 carries comment bodies

    Tests to Write

    • tests/dev-lead/unit/test_bot_comment_retry.bats: synthetic multi-page response (thousands of comments, several MB — well over ARG_MAX) is read and returned in full
    • Fail-closed cases emit a distinct reason on stderr and nothing on stdout

    Test Command

    bats tests/dev-lead/unit/test_bot_comment_retry.bats tests/dev-lead/unit/test_intent_bot_comment_retry.bats

  2. don-petry commented on Oct 7, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead: Implementation Complete — PR #2073

    The implementation for issue #2072 is durable: commits are pushed and a pull request is open. This record is backed by verifiable artifacts you can confirm in one click.

    Review happens on the PR. Acceptance criteria and test results are evidenced by the PR's diff and CI checks — not asserted here. If a later stage fails, this claim is retracted in place.

  3. added 2 commits that reference this issue on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug reportsdev-leadFor dev-lead agent pickup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions