fix: skip oversized JSONL lines instead of failing the session#20
Conversation
Replace bufio.Scanner with a lineReader that silently skips lines exceeding 64MB and continues parsing. Previously, a single oversized tool_result line (e.g. 22MB command output) caused the entire session to be dropped with "bufio.Scanner: token too long". The lineReader starts with a 64KB buffer and grows on demand. Oversized lines are skipped — the session appears with a gap but the remaining messages are preserved. Closes #12 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
lineReader.next() was treating all read errors as EOF, silently discarding I/O failures. Add err field and Err() method (matching bufio.Scanner pattern), restore post-loop error checks in both parsers, and add TestLineReaderIOError. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
The hints extractor used lineReader but didn't check lr.Err() after the loop, silently dropping I/O failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
Summary
bufio.Scannerwith a customlineReaderthat usesbufio.Reader.ReadLine()to skip lines exceeding 64MB instead of aborting the entire session parselineReader.Err()(matchingbufio.Scannerpattern) rather than silently swallowing themCloses #12
Test plan
TestLineReader— normal lines, oversized skip, all oversized, empty input, blank lines, no trailing newline, exact limit, one over limitTestLineReaderIOError— customio.Readerthat yields data then returns a non-EOF error; verifies lines are returned andErr()exposes the I/O errorTestParseCodexSessionOversizedLineSkipped— integration test placing an oversized line between normal JSONL entriesCGO_ENABLED=1 go test -tags fts5 ./...)🤖 Generated with Claude Code