A single malformed line in the inline-comment buffer crashes the entire post step, losing every valid buffered comment
Type: bug (error handling)
Severity: medium
Area: src/entrypoints/post-buffered-inline-comments.ts
Effort: trivial
Summary
The post step parses the buffer file with an unguarded JSON.parse per line:
// src/entrypoints/post-buffered-inline-comments.ts (main)
const comments: BufferedComment[] = raw
.split("\n")
.filter(Boolean)
.map((line) => JSON.parse(line));
If any line fails to parse, main() rejects, the catch handler logs
post-buffered-inline-comments failed and exits 1 — and every buffered
comment is lost, including the ones that are perfectly valid.
This contradicts the buffer's own writer. removeBufferedComment()
(src/mcp/inline-comment-buffer.ts) deliberately keeps lines it cannot
parse:
} catch {
// Keep anything we cannot parse rather than silently dropping it.
return true;
}
So the codebase already acknowledges that malformed lines can legitimately be
present in the buffer, yet the only reader of the buffer crashes on them.
Failure scenarios
A. Truncated append. The buffer at /tmp/inline-comments-buffer.jsonl is
appended by the MCP server process (appendFileSync). A runner that is
killed mid-write, or two server processes appending large comment bodies
concurrently, can leave a partial final line. The next post step then throws
on that line and posts nothing at all.
B. Any other corrupting event (disk issues, an external process writing
to /tmp) — same outcome: one bad line suppresses all valid review comments,
which is the worst possible failure mode for a replay step whose whole
purpose is not losing the model's comments.
Suggested fix
Skip malformed lines with a ::warning:: annotation and post the remaining
valid entries (mirroring how this file already warns for
confirmed=false / classified-as-probe comments). Happy to open a PR.
A single malformed line in the inline-comment buffer crashes the entire post step, losing every valid buffered comment
Type: bug (error handling)
Severity: medium
Area:
src/entrypoints/post-buffered-inline-comments.tsEffort: trivial
Summary
The post step parses the buffer file with an unguarded
JSON.parseper line:If any line fails to parse,
main()rejects, the catch handler logspost-buffered-inline-comments failedand exits 1 — and every bufferedcomment is lost, including the ones that are perfectly valid.
This contradicts the buffer's own writer.
removeBufferedComment()(
src/mcp/inline-comment-buffer.ts) deliberately keeps lines it cannotparse:
So the codebase already acknowledges that malformed lines can legitimately be
present in the buffer, yet the only reader of the buffer crashes on them.
Failure scenarios
A. Truncated append. The buffer at
/tmp/inline-comments-buffer.jsonlisappended by the MCP server process (
appendFileSync). A runner that iskilled mid-write, or two server processes appending large comment bodies
concurrently, can leave a partial final line. The next post step then throws
on that line and posts nothing at all.
B. Any other corrupting event (disk issues, an external process writing
to /tmp) — same outcome: one bad line suppresses all valid review comments,
which is the worst possible failure mode for a replay step whose whole
purpose is not losing the model's comments.
Suggested fix
Skip malformed lines with a
::warning::annotation and post the remainingvalid entries (mirroring how this file already warns for
confirmed=false/ classified-as-probe comments). Happy to open a PR.