From c80d3be21af7083e656c0c732b6054f731e9feab Mon Sep 17 00:00:00 2001 From: claude Date: Mon, 16 Mar 2026 08:32:04 +0000 Subject: [PATCH] fix: handle malformed JSONL lines gracefully in post-buffered-inline-comments Wrap per-line JSON.parse in try-catch so a single truncated/malformed entry (e.g. from an OOM mid-write) skips with a warning instead of aborting the entire batch and dropping all comments. Co-authored-by: vtmocanu --- src/entrypoints/post-buffered-inline-comments.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/entrypoints/post-buffered-inline-comments.ts b/src/entrypoints/post-buffered-inline-comments.ts index 763dae7..aa960a6 100644 --- a/src/entrypoints/post-buffered-inline-comments.ts +++ b/src/entrypoints/post-buffered-inline-comments.ts @@ -155,7 +155,14 @@ async function main() { const comments: BufferedComment[] = raw .split("\n") .filter(Boolean) - .map((line) => JSON.parse(line)); + .flatMap((line) => { + try { + return [JSON.parse(line) as BufferedComment]; + } catch { + console.log(`::warning::Skipping malformed JSONL line: ${line.slice(0, 120)}`); + return []; + } + }); if (comments.length === 0) { console.log("No buffered inline comments");