Skip to content

fix: scorer.sh --update-queue overflows argv on large function counts - #156

Merged
bodencrouch merged 3 commits into
masterfrom
fix/scorer-jq-argv-overflow
Jul 30, 2026
Merged

fix: scorer.sh --update-queue overflows argv on large function counts#156
bodencrouch merged 3 commits into
masterfrom
fix/scorer-jq-argv-overflow

Conversation

@bodencrouch

Copy link
Copy Markdown
Contributor

Summary

Found while trying to re-run the autonomous vacuum/repair campaign for swkotor.exe (12,845 functions) after shipping the packaged-source stdcall/callee-calling-convention fixes in PR #155 -- the campaign exited after all 15 pipeline stages resumed cleanly but before any vacuum activity, with:

scripts/scorer.sh: line 123: /usr/bin/jq: Argument list too long

Root cause: jq --argjson entries "$(printf '%s\n' "$report" | jq '.entries')" ... passes the entire scored-entries JSON (score/reason/metrics for every function) as a single argv string. At this queue's scale that payload is multi-megabyte, exceeding the OS argv-size limit.

Fix: write .entries to a temp file and use --slurpfile instead of --argjson -- the same script already uses this exact pattern (--slurpfile entries "$entries_tmp") three lines above for the same kind of large-array plumbing; this just applies it consistently to the second call site.

Test plan

  • Reproduced the exact "Argument list too long" failure with the old --argjson approach against a realistic ~3.6MB synthetic entries payload (12,845 entries)
  • Confirmed the --slurpfile fix runs cleanly against the same payload and produces correct merged/scored queue output
  • bash -n scripts/scorer.sh syntax check passes
  • Code review (ce-code-review, 6 personas: correctness, testing, maintainability, project-standards, agent-native, learnings) -- no P0/P1 findings; applied one P3 maintainability fix (lazy tempfile creation, mirroring existing queue_tmp pattern)

Follow-up (not in this PR)

  • scripts/vacuum.sh:190 calls scorer.sh --update-queue with no logging around it, which is why this bug's failure was silent. Worth wrapping in the same log_progress/write_session pattern used elsewhere in vacuum_start().
  • No automated regression test exists for --update-queue at scale (repo has no shell test harness for this script).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ros3797gzvmswnJudQ1Znk

Copilot added 3 commits July 30, 2026 08:25
jq --argjson entries "$(...)" passes the entire scored-entries JSON as a
single argv string. At swkotor.exe's queue scale (12,845 functions with
per-entry score/reason/metrics), this payload is multi-megabyte and exceeds
the OS argv-size limit, hard-failing with "Argument list too long" -- this
silently aborted the autonomous vacuum/repair campaign's queue-scoring step
before it could run, discovered when a full-queue --autonomous run exited
after only 15/15 stage-resume receipts with no vacuum activity at all.

The same script already uses the safe pattern (--slurpfile reading from a
temp file, avoiding the argv limit entirely) three lines above for the same
kind of large-array plumbing -- this just applies it to the second call site
that didn't.

Verified: reproduced the exact "Argument list too long" failure with the old
--argjson approach against a realistic ~3.6MB synthetic entries payload
(12,845 entries), confirmed the --slurpfile fix runs cleanly against the same
payload and produces correct merged/scored queue output.
Mirrors queue_tmp's existing pattern -- both temp files are only used
inside the --update-queue block, so both should be lazily created there
rather than unconditionally near the top for every scorer.sh invocation.

Found by code review (ce-code-review, 6 personas); no correctness impact,
just avoids a needless mktemp on every non-update-queue run.
Pre-existing on master, unrelated to this branch's scorer.sh fix -- inherited
from the base commit. Fixed here since it was blocking this PR's ruff CI
check. Same class of pre-existing lint issue fixed independently on several
other branches this session.
@bodencrouch
bodencrouch merged commit 88e90fe into master Jul 30, 2026
18 of 20 checks passed
@bodencrouch
bodencrouch deleted the fix/scorer-jq-argv-overflow branch July 30, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant