close-report reviewer gate fails CLOSED when the reviewer prompt exceeds MAX_ARG_STRLEN (~128KB): prompt passed as a single argv arg #2161
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#2161
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
.sandcastle/close-report.sh's independent-reviewer gate (#197) fails CLOSED for ANY close whose reviewer prompt exceeds the Linux single-argument limitMAX_ARG_STRLEN(~128 KiB), bricking the close with:Cause
cr_review_invokepasses the whole reviewer prompt as a single argv argument:The prompt = skeleton + issue body + criteria + the full diff of the claimed commits. When that exceeds ~128 KiB (one argv string cannot exceed
MAX_ARG_STRLEN, independent ofARG_MAX), the exec fails beforeclaudestarts:so
$resultis empty, andcr_review_parseon an empty file →_cr_review_fail→ not auth-error (no zero-usage JSON to detect) →malformed→ fail CLOSED. Reproduced: a 142,886-byte single-arg prompt reliably trips it; the same model with a small prompt returns the normal/loginzero-usage shape that #2155 correctly classifiesunauthenticated→ SKIP.This is the SAME can-not-run class as #228 (unauthenticated) and the absent-binary case, both of which the gate SKIPs — but an empty result from an exec failure falls through #2155's zero-usage check and bricks the close instead.
Proposed fix (pick one or both)
claudeon stdin instead of argv — e.g.claude -p --output-format json < "$prompt_file"(or a--prompt-file/heredoc form). This removes theMAX_ARG_STRLENceiling entirely and is the real fix.Found while
Closing #2154 (an i18n Go-seam slice, ~143 KiB diff across 40 files). The work is complete, committed (
9346f37f), pushed to the worker branch, and every deterministic gate + the full test suite pass; only this reviewer gate bricks the close. #2154 is goingagent-blockedon this..sandcastle/is a protected path (#445) — filed for an interactive session per ADR 0174 rule 9 rather than edited from the swarm.Close report — landed (push mode)
Ruled by agent under ADR 0174 — veto anytime. Two-way door: a revertible pin bump + a four-file re-vendor, proven by the red-before-green suites below. No one-way door touched.
What landed
Both fixes the ticket proposed:
cr_review_invoke(.sandcastle/close-report.sh) now feeds the reviewer prompt toclaude -pon stdin (< "$prompt_file") instead of as a single argv argument. Stdin has noMAX_ARG_STRLENceiling, so the full-diff prompt can never trip theArgument list too longexec failure again._cr_review_is_auth_error(.sandcastle/close-report-lib.sh) now treats an absent or empty result file as can-not-run → SKIP (verdictunauthenticated), nevermalformed. This extends #2155's zero-usage skip to the empty-result case the exec failure produced, so a large diff is never worse than an absent reviewer. The fail-CLOSED posture (#197) is preserved for a reviewer that genuinely RAN — it always writes a non-empty--output-format jsonenvelope, so a non-empty-but-garbage result still normalises tomalformed.Vendored-path handling (#445 / ADR 0180)
.sandcastle/close-report*.share vendored factory files. The fix landed upstream on dev-factory backport branchbackport/idss-2161(commit472d5636, off the current pinea75077899) and was re-vendored into this repo:FACTORY_REFea75077899→472d5636close-report.sh,close-report-lib.sh,tests/close-report-lib-test.sh,tests/close-report-test.sh), 212 unchanged,check-harness-drift: OK.Proof
printf '…' | claude -p --output-format jsonreturns a well-formed JSON envelope — the stdin form is valid and does not mis-parse or hang.close-report-libRV7/RV8 flipped (empty/missing result now SKIPs, wasmalformed);close-reportRV-C split — RV-C keepsmalformed=refuse for a non-empty garbage result, new RV-C2 asserts an empty result SKIPs and the close PROCEEDS.close-report-lib(81) +close-report(142) pass; drift gate OK.Commits
main:6df89b67backport/idss-2161:472d5636Context
This bricked the close of #2154 (an ~143 KiB i18n Go-seam diff); #2154 has since landed on
main. The forward-port of this fix onto dev-factorymain(LANDING=pr) is owed as a follow-up, like #2155's.