diff --git a/scripts/scrum_review.sh b/scripts/scrum_review.sh index 845fe1e..52bebe3 100755 --- a/scripts/scrum_review.sh +++ b/scripts/scrum_review.sh @@ -75,20 +75,27 @@ run_review() { \`\`\`diff $DIFF_CONTENT \`\`\`" - local body - body=$(jq -n --arg model "$model" --arg sys "$SYSTEM" --arg user "$user" \ - '{model:$model, max_tokens:4096, messages:[{role:"system",content:$sys},{role:"user",content:$user}]}') printf " %-6s %s ... " "$short" "$model" local t0=$SECONDS local status - # Pipe the body via stdin (`-d @-`) — large diffs (>~128KB) blow - # past the kernel's argv limit when passed via `--data `. - # Phase A+B was 128875 bytes and hit "Argument list too long" until - # this fix. - status=$(printf '%s' "$body" | curl -sS -o /tmp/scrum_resp.json -w '%{http_code}' --max-time 240 \ + + # Build the body via temp files — both jq's --arg AND curl's + # --data run into the kernel's argv limit (~128KB) when the diff + # is large. Voice-ai full bundle was 156K and hit it twice. + # Piping through files (and using --rawfile for jq) sidesteps both. + local body_file user_file sys_file + body_file=$(mktemp); user_file=$(mktemp); sys_file=$(mktemp) + printf '%s' "$user" > "$user_file" + printf '%s' "$SYSTEM" > "$sys_file" + jq -n --arg model "$model" --rawfile sys "$sys_file" --rawfile user "$user_file" \ + '{model:$model, max_tokens:4096, messages:[{role:"system",content:$sys},{role:"user",content:$user}]}' \ + > "$body_file" + + status=$(curl -sS -o /tmp/scrum_resp.json -w '%{http_code}' --max-time 240 \ -X POST "$GATEWAY/v1/chat" \ -H 'Content-Type: application/json' \ - --data-binary @-) + --data-binary "@$body_file") + rm -f "$body_file" "$user_file" "$sys_file" local elapsed=$((SECONDS - t0)) if [ "$status" != "200" ]; then printf "✗ HTTP %s (%ds)\n" "$status" "$elapsed"