Sonnet (and likely other models) sometimes emit JSON responses with unescaped double quotes inside string values:
{"finding":"The comment says OTP_VERSION is the major version (e.g. "28")"}
This causes json.Unmarshal to fail with invalid character '2' after object key:value pair, which makes the entire review fail even though the model produced valid content.
Seen in gargoyle CI: sonnet-review on PR #551 (job 3173).
Fix
PR #45 adds a repairJSON fallback that walks the JSON character-by-character and escapes interior quotes not followed by structural characters.
Consider also strengthening the prompt to tell the LLM to avoid unescaped quotes
## Problem
Sonnet (and likely other models) sometimes emit JSON responses with unescaped double quotes inside string values:
```json
{"finding": "The comment says OTP_VERSION is the major version (e.g. "28")"}
```
This causes `json.Unmarshal` to fail with `invalid character '2' after object key:value pair`, which makes the entire review fail even though the model produced valid content.
Seen in gargoyle CI: sonnet-review on PR #551 (job 3173).
## Fix
PR #45 adds a `repairJSON` fallback that walks the JSON character-by-character and escapes interior quotes not followed by structural characters.
## TODO
- [ ] Merge PR #45
- [ ] Build new binary and create a release (v0.3.2)
- [ ] Update gargoyle CI action to use new version
- [ ] Consider also strengthening the prompt to tell the LLM to avoid unescaped quotes
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.
Problem
Sonnet (and likely other models) sometimes emit JSON responses with unescaped double quotes inside string values:
This causes
json.Unmarshalto fail withinvalid character '2' after object key:value pair, which makes the entire review fail even though the model produced valid content.Seen in gargoyle CI: sonnet-review on PR #551 (job 3173).
Fix
PR #45 adds a
repairJSONfallback that walks the JSON character-by-character and escapes interior quotes not followed by structural characters.TODO