Skip to content

fix(ci): trim GitHub commit API response in upload_benchmarks to avoid E2BIG on large merge commits - #25077

Merged
nchamo merged 2 commits into
merge-train/fairiesfrom
cb/fix-upload-benchmarks-argv
Aug 3, 2026
Merged

nchamo merged 2 commits into
merge-train/fairiesfrom
cb/fix-upload-benchmarks-argv

Conversation

@AztecBot

@AztecBot AztecBot commented Aug 1, 2026 •

Copy link
Copy Markdown
Collaborator

What

ci3/upload_benchmarks passes the whole GET /repos/.../commits/{sha} response to jq via --argjson info "$commit_info". That endpoint returns a files[] array with every changed file's patch, so for a merge-queue commit merging a large PR the response is large — 353KB for #25056's merge commit — past Linux's 128KB per-argv-element cap (MAX_ARG_STRLEN), which makes execve fail with E2BIG:

./ci3/upload_benchmarks: line 49: /usr/bin/jq: Argument list too long
##[error]Process completed with exit code 126.

The Upload benchmarks step has no continue-on-error, so this fails the required ci check and the PR is dequeued from the merge queue. It hits any PR whose merge commit's API response exceeds ~128KB, on every merge-queue attempt and on any ci-full run.

Observed on #25056, run 30681807033 (job 91320195476, 2026-08-01 04:03:07): step 9 Upload benchmarks fails on the line above. #25056's three earlier merge-queue attempts on 2026-07-30 failed in step 6 Run, before the upload step — this is the one confirmed occurrence so far, not a repeated one.

Introduced by 1048a26e20 (2026-07-20), which reached next on 2026-07-30 as 516cb5962b (#24806) — a fresh regression, not a chronic condition.

Fix

Pipe the API response through jq -c '{commit, author, committer, html_url}' before assigning to $commit_info. That's the exact set of top-level fields the downstream jq reads — via $info.commit.{author,committer,message}, $info.author.login, $info.committer.login, $info.html_url — so the output is byte-identical for normal commits and drops the 353KB case to 5.7KB. Whitelist-shape rather than a del(.files, .stats) blacklist, so it stays bounded regardless of what GitHub adds to the response later.

Notes

  • The sibling jq call in append_and_push() already avoids this by passing large inputs via --slurpfile (with a comment spelling out the 128KB cap); this call site was missed.
  • The value remains on argv, so the cap is raised rather than removed. The retained commit object carries commit.message plus commit.verification.payload, which repeats the message verbatim. Worst real case on next today is 67a22248a6, whose response trims from 1.34MB to 120,812 bytes — 92% of the 131,072-byte cap. A longer merge-train commit message would break it again. Moving the trimmed body to a temp file read with --slurpfile, as append_and_push() does, would close this by construction.
  • Curl-failure path is preserved: curl -sf failure → empty stdin → jq errors → the pipe exits non-zero → if ! triggers → commit_info='{}' (unchanged behavior).
  • ci3/upload_benchmarks_test still passes, but note it never exercises the API-success path (every case uses a fabricated sha, so curl 404s into the fallback) — it passes against the unfixed script too, so it does not guard this fix.

Refs #25056.


Created by claudebox · group: slackbot · requested by Nico Chamo · Slack thread

…d E2BIG on large merge commits

`ci3/upload_benchmarks` passes the whole `GET /repos/.../commits/{sha}` response to jq via
`--argjson info "$commit_info"`. That endpoint returns a `files[]` array with every changed file's
patch, so for a merge-queue commit merging a large PR the response is large (353KB for #25056's
merge commit) — past Linux's 128KB per-argv-element cap (`MAX_ARG_STRLEN`), which makes execve
fail with E2BIG. The shell reports:

    ./ci3/upload_benchmarks: line 49: /usr/bin/jq: Argument list too long
    ##[error]Process completed with exit code 126.

The bench-upload step then fails the ci check and the PR is dequeued from the merge queue. The
regression hits any PR big enough for its merge commit's API response to exceed ~128KB — merge-train
PRs first, but any full-CI-mode run on a comparably large PR too.

The sibling jq call in `append_and_push()` already avoids this by passing large inputs via
`--slurpfile` (with a comment spelling out the 128KB cap); this call site was missed.

Fix: pipe the API response through `jq -c '{commit, author, committer, html_url}'` before assigning
to $commit_info. That's the exact set of top-level fields the downstream jq reads (via
`$info.commit.*`, `$info.author.login`, `$info.committer.login`, `$info.html_url`), so output is
byte-identical for normal commits and stays well below the argv limit for large ones.

Whitelist-shape rather than `del(.files, .stats)` blacklist: guaranteed bounded regardless of what
GitHub adds to the response later.
@AztecBot AztecBot added ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR. labels Aug 1, 2026
@nchamo
nchamo marked this pull request as ready for review August 1, 2026 13:46
@nchamo
nchamo requested a review from charlielye as a code owner August 1, 2026 13:46
@nchamo nchamo self-assigned this Aug 1, 2026
The top-level trim still carried commit.verification.payload (repeats the
full message; 92% of the 128KB argv cap observed on a real next commit),
so a long merge-train message could re-trigger E2BIG. Whitelist the exact
leaf fields, cut the message to its first line at the source, and pass
the result to jq as a file so nothing large can reach argv at all.

Adds a regression test that serves an oversized API response through a
fake curl; it fails against both the original script and the top-level
trim, and exercises the previously untested API-success path.
@charlielye

Copy link
Copy Markdown
Contributor

Pushed bd7df55 to finish this off. The top-level trim was correct but still argv-bound: the retained commit object carries commit.verification.payload (repeats the full message — your own Notes measured 92% of the 131,072-byte cap on 67a22248a6), so a long merge-train squash message would re-trigger E2BIG. The commit:

  • deepens the whitelist to the exact leaf fields the entry reads and cuts the message to its first line at the source, bounding the result to ~1KB regardless of input;
  • passes it to the second jq via --slurpfile (a file, never argv), same as append_and_push — so the cap is unreachable by construction;
  • adds a regression test that serves an oversized response (including a 200KB verification.payload) through a fake curl on PATH. It reproduces the exact production failure against both the original script and the top-level trim, and closes the test-suite gap you flagged: the API-success path is now exercised.

Verified red/green: the test fails with jq: Argument list too long against the pre-push HEAD and passes with the fix; all 6 tests green.

@nchamo
nchamo merged commit 705524d into merge-train/fairies Aug 3, 2026
12 checks passed
@nchamo
nchamo deleted the cb/fix-upload-benchmarks-argv branch August 3, 2026 10:32
rangozd pushed a commit to rangozd/aztec-packages that referenced this pull request Aug 5, 2026
BEGIN_COMMIT_OVERRIDE
fix(pxe): validate a BoundedVec against its storage array on
deserialization (AztecProtocol#25035)
chore: add disclaimers on poc contracts (AztecProtocol#24975)
chore: begin nr constant cleanup (AztecProtocol#25014)
fix(txe): authorize sync_state utility calls in inlined contexts
(AztecProtocol#25034)
refactor(stdlib): a function's return type is a single optional AbiType
(AztecProtocol#25066)
feat(pxe): hash-pinned node read cache (AztecProtocol#24969)
feat(noir-projects): publish compiled protocol artifacts to npm (AztecProtocol#25075)
fix(ci): trim GitHub commit API response in upload_benchmarks to avoid
E2BIG on large merge commits (AztecProtocol#25077)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants