fix(growth): handle multi-line json:candidate extraction (#3185)

The Claude output contains pretty-printed JSON spanning multiple lines.
`tail -1` only grabbed the last line ("}"). Use `tr -d '\n'` to join
all lines into a single JSON string before POSTing to SPA.

Co-authored-by: Claude <claude@anthropic.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Ahmed Abushagur <ahmed@abushagur.com>
This commit is contained in:
A 2026-04-05 14:34:18 -07:00 committed by GitHub
parent 32fad1c389
commit 0ece17d92e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -156,9 +156,9 @@ fi
# --- Phase 3: Extract candidate and POST to SPA ---
CANDIDATE_JSON=""
# Extract the json:candidate block from Claude's output
# Extract the json:candidate block from Claude's output (may be multi-line)
if [[ -f "${CLAUDE_OUTPUT_FILE}" ]]; then
CANDIDATE_JSON=$(sed -n '/^```json:candidate$/,/^```$/{/^```/d;p;}' "${CLAUDE_OUTPUT_FILE}" | tail -1)
CANDIDATE_JSON=$(sed -n '/^```json:candidate$/,/^```$/{/^```/d;p;}' "${CLAUDE_OUTPUT_FILE}" | tr -d '\n')
fi
if [[ -z "${CANDIDATE_JSON}" ]]; then