fix(server): bound usage transcript lines - #7265
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved 42f1b50 Defensive bug fix replacing Node's readline with a bounded reader to prevent V8 crashes from oversized transcript lines. The change is self-contained with comprehensive tests and a conservative 64MB default limit. You can customize Macroscope's approvability policy. Learn more. |
Summary
readlinewith a byte-bounded JSONL reader for usage transcriptsWhy
A Codex rollout can contain a very large tool or patch event on one JSONL line. Node's
readlineconstructs the entire line before yielding it, so a line above V8's string limit throwsRangeError: Invalid string lengthfrom the stream callback and terminates the T3 server when Usage is opened.The new reader retains at most 64 MiB for a record. Once a record crosses that limit, it drains bytes through the next newline without decoding them, then continues processing later usage records normally.
Validation
vp test run apps/server/src/usage: 40 tests passedFixes #7258.
Implemented with GPT-5.6 Sol via Codex.
Note
Bound per-line bytes in
readTranscriptRecordsto skip oversized JSONL recordsnode:readlinewith a newreadBoundedLinesasync generator in usageTranscriptReader.ts that accumulates file bytes until a newline, discarding lines that exceed a configurable byte limit before constructing a string.DEFAULT_MAX_LINE_BYTES), which is well below V8's max string length but above expected valid transcript records.TranscriptReadOptions.maxLineBytesparameter onreadTranscriptRecords.\r) and yields unterminated final lines.Macroscope summarized 42f1b50.