close-report reviewer gate fails CLOSED on a >128KB diff (prompt exceeds MAX_ARG_STRLEN, claude never runs) #2162
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#2162
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
close-report.sh's independent-reviewer gate (#197) fails every close CLOSED whenever the claimed commits' combined diff is larger than ~128 KB, even in a sandbox where the reviewer cannot authenticate (which #228/#2155 decided must SKIP, not fail).Observed on #2154 (an i18n seam ticket, ~1553-line / ~146 KB diff): the close-report gate refused with
and posted an
independent reviewer … verdict malformed, despite all deterministic gates passing and the reviewer being structurally unauthenticated in the worker sandbox.Root cause
cr_review_invoke(.sandcastle/close-report.sh~L300) passes the whole reviewer prompt as a singleargvstring:cr_review_build_promptembedsgit show … | head -c 200000— up to 200 KB of diff. On Linux a single argument string is capped atMAX_ARG_STRLEN= 131072 bytes (128 KB), independent of the 2 MB totalARG_MAX. A prompt over that cap makesexecvefail withE2BIG:so
claudenever runs,: > "$result"leaves the result file empty, and|| trueswallows the failure.cr_review_parseon an empty file →_cr_review_fail→_cr_review_is_auth_errorreturns 1 (an empty file fails its[ -s "$rf" ]guard) → verdictmalformed→ fail CLOSED.This defeats the #228/#2155 intent: an un-runnable reviewer should be treated as ABSENT and SKIPPED, never fail the close. The arg-size failure is indistinguishable from "reviewer ran and returned garbage" only because the un-run signal (E2BIG → empty file) is classified as malformed.
Reproduced deterministically in the #2154 worker sandbox:
Argument list too long, rc 126, 0-byte result file;{… "result":"Not logged in · Please run /login", usage.input_tokens:0 …}that_cr_review_is_auth_errorcorrectly classifies asunauthenticated→ SKIP.So the bug bites any ticket with a >~128 KB diff, and on an authenticated host would brick those closes regardless of auth.
Proposed fix (one of)
claude -p --model … --output-format json < "$prompt_file"(claude-preads the prompt from stdin when no prompt argument is given). Removes theMAX_ARG_STRLENceiling entirely.cr_review_invokedetect the empty-result / non-zero-rc case and classify an un-run reviewer (claude present, invocation failed to execute, zero bytes out) as absent → SKIP, preserving fail-CLOSED only for a reviewer that produced non-empty non-usage output. (Keep the #197 posture for a reviewer that genuinely ran.)TDD: a
cr_review_parse/cr_review_invokecase over a >128 KB prompt file asserting the close is not refused CLOSED when the reviewer could not execute.Found while working
#2154 (i18n Go seam: member dashboard + join-rejection surfaces). The ticket's own work is complete, verified green on every deterministic gate, and pushed to its worker branch; this gate is the sole blocker. Filed per CLAUDE.md Rule 9 (protected-path machinery bug → separate issue,
ready-for-session, ADR 0174) —.sandcastle/close-report.shis a protected path.Close-report — #2162 already landed under #2161 (concurrent duplicate)
This exact bug — the
close-report.shindependent-reviewer gate (#197) failingCLOSED whenever the reviewer prompt exceeds the Linux single-argument limit
MAX_ARG_STRLEN(~128 KiB) becauseexecvereturnsE2BIGbeforeclaudestarts, leaving an empty result that
cr_review_parseclassified asmalformed— was fixed on
mainby a concurrent session as #2161, commit6df89b67(landed before this ticket was drained). #2161 is closed; its title and root
cause are identical to this one, and it names the same live close (#2154) that
first surfaced the gate.
Both of this ticket's proposed fixes are already live on
origin/main:close-report.sh:310now feedsthe prompt to
claude -pon stdin:--output-format json < "$prompt_file"instead of the old single-argv
"$(cat "$prompt_file")". Removes theMAX_ARG_STRLENceiling entirely.close-report-lib.sh:621_cr_review_is_auth_errornowreturn 0s on an absent/empty result file, so anexec failure (E2BIG → 0-byte result) normalises to
unauthenticated→ SKIP,never
malformed. A reviewer that genuinely RAN always writes a non-empty--output-format jsonenvelope, so the #197 fail-CLOSED posture is preservedfor real garbage (RV-C), while a large diff is never worse than an absent
reviewer (RV-C2).
The TDD this ticket asked for is also already in place and green:
close-report-libRV7/RV8 (empty/missing result → skip, was malformed) and
close-reportRV-C2(empty result → close PROCEEDS over a large diff).
Proof (this session, on
origin/main):.sandcastle/tests/close-report-lib-test.sh→ 81 checks passed.sandcastle/tests/close-report-test.sh→ 142 checks passed.sandcastle/close-report.sh:310carries< "$prompt_file";.sandcastle/close-report-lib.sh:621returns 0 on empty/missing.No new code change is needed — the fix is already on
main(including theupstream dev-factory vendor and FACTORY_REF bump described in #2161's commit).
Closing as a duplicate of #2161.
Ruled by agent under ADR 0174 — veto anytime. Two-way door: nothing was landed
from this session; the ticket is closed only because the identical fix is already
proven live on
main.