You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cora scan sends files to the LLM in batches, but the LLM response is truncated mid-JSON, causing parse failure. The batch is skipped, and 0 issues are reported — even though the LLM found valid issues before truncation.
Reproduction
cora scan --path web/tests/e2e --format compact
# → 5 files to review, 1 batch (default batch-files=20)# → WARN: batch scan failed — "failed to parse LLM JSON response:# EOF while parsing a string at line 45 column 6"# → Scanned 5 files — Found 0 issues.
The LLM response prefix shows a valid finding was generated:
[
{
"file": "fixtures.ts",
"line": 90,
"severity": "major",
"issue_type": "bugs",
"title": "Substring URL matching in mockPassthrough is fragile",
"body": "The condition `!route.request().url().includes('/settings')..."// ← TRUNCATED HERE
}
]
The issue was real (substring URL matching is fragile), but it was silently dropped.
Expected Behavior
Partial recovery — parse whatever valid JSON objects exist before truncation, report those
Retry with smaller batch — if batch fails, retry with --batch-files 1 or split the batch
Report parse failures as errors — don't silently return "0 issues" when the LLM found issues but JSON was truncated
Suggested Fix
Lower default --batch-files from 20 to 5 (or auto-adjust based on response size)
Add JSON repair logic (cora already has a repair attempt, but it fails: "after repair: expected : at line 45 column 8")
When parse fails, extract individual JSON objects from the truncated response using a streaming parser
Log the raw LLM response to a temp file for debugging (currently only prefix is shown)
Environment
cora 0.8.1
Provider: openai (Z.AI glm-5.2 via https://api.z.ai/api/coding/paas/v4)
Activity
fix(scan): recover partial findings from truncated LLM JSON (#383) (#387