review-bot intermittently fails to parse the LLM response with "unexpected end of JSON input" even when the response body is complete valid JSON.
Evidence
From gargoyle CI run 1736 (job 4559), gpt-review log:
level=INFO msg="LLM response received" bytes=4357
level=ERROR msg="failed to parse LLM response" error="parse LLM response as JSON: unexpected end of JSON input
Raw response: {..."
The raw response logged is complete, valid JSON (REQUEST_CHANGES verdict + 6 findings). json.Unmarshal still returns "unexpected end of JSON input."
This suggests the response body is being partially read before being passed to the JSON parser. The logged bytes (4357) match what the server reported, but the buffer passed to json.Unmarshal is truncated.
Impact
Causes gpt-review CI job to fail and exit 1
Always succeeds on retry — purely transient
Observed in 3 of last 50 runs (6%)
Fix
Audit HTTP response body reading in review-bot. Likely suspect: buffered reader not fully draining before passing to json.Unmarshal. Consider:
Using io.ReadAll instead of buffered reads
Adding explicit retry on JSON parse error (defensive)
## Bug
`review-bot` intermittently fails to parse the LLM response with `"unexpected end of JSON input"` even when the response body is complete valid JSON.
## Evidence
From gargoyle CI run 1736 (job 4559), gpt-review log:
```
level=INFO msg="LLM response received" bytes=4357
level=ERROR msg="failed to parse LLM response" error="parse LLM response as JSON: unexpected end of JSON input
Raw response: {..."
```
The raw response logged is complete, valid JSON (REQUEST_CHANGES verdict + 6 findings). `json.Unmarshal` still returns "unexpected end of JSON input."
This suggests the response body is being partially read before being passed to the JSON parser. The logged bytes (4357) match what the server reported, but the buffer passed to `json.Unmarshal` is truncated.
## Impact
- Causes gpt-review CI job to fail and exit 1
- Always succeeds on retry — purely transient
- Observed in 3 of last 50 runs (6%)
## Fix
Audit HTTP response body reading in `review-bot`. Likely suspect: buffered reader not fully draining before passing to `json.Unmarshal`. Consider:
1. Using `io.ReadAll` instead of buffered reads
2. Adding explicit retry on JSON parse error (defensive)
## Linked
gargoyle issue #652
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Bug
review-botintermittently fails to parse the LLM response with"unexpected end of JSON input"even when the response body is complete valid JSON.Evidence
From gargoyle CI run 1736 (job 4559), gpt-review log:
The raw response logged is complete, valid JSON (REQUEST_CHANGES verdict + 6 findings).
json.Unmarshalstill returns "unexpected end of JSON input."This suggests the response body is being partially read before being passed to the JSON parser. The logged bytes (4357) match what the server reported, but the buffer passed to
json.Unmarshalis truncated.Impact
Fix
Audit HTTP response body reading in
review-bot. Likely suspect: buffered reader not fully draining before passing tojson.Unmarshal. Consider:io.ReadAllinstead of buffered readsLinked
gargoyle issue #652