Repository navigation
Closed
Closed
Copy link
Labels
area: cliThe codeburn CLI and its core parsing/reporting enginebugSomething isn't workingstatus: has-prAn open pull request references this issue
Description
Problem
codeburn overview -p today crashes with a V8 heap OOM on large session corpora:
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
exit:134
Repro (reporter corpus, ~1.2GB session-cache shards, 410MB+ same-day sources):
NODE_OPTIONS="--no-deprecation --max-old-space-size=512" npx tsx src/cli.ts overview -p today
The run dies at ~512MB heap after ~5 minutes. Uncapped runs survive but retain ~1.46GB in the load phase alone.
Root causes (cache-I/O layer)
- Ranged loads assembled whole multi-hundred-MB month shards (
loadShardMemoizedwhole-parsed viaJSON.parse), including a 578MB shard that exceeds V8's max string length. - The pre-lock snapshot overlapped the canonical reload (~787MB duplicate live at once).
- Lock publishes rewrote the entire result file; codex discovery re-decoded the result cache per directory.
- Retained strings were tokenizer slices pinning whole input chunks (~1.2GB phantom heap on this corpus).
- Cross-provider dedup held full raw keys; provider queries scanned unrelated sections.
Fix
PR #1502 (branch fix/oom-bounded-shard-load):
- Session month shards decode incrementally, one turn at a time, keeping only in-range turns (same kept/dropped/carry contract).
- Codex result cache streams instead of whole-parsing; discovery labels served from calls-free metadata; publishes merge instead of full rewrite.
- Shard loads run serially; pre-lock snapshot released before reload.
- Retained strings detached from tokenizer buffers; dropped dedup keys are 128-bit digests; provider-scoped queries skip unrelated sections.
- Codex single-flight loads retry on publish-generation change; clear path bumps a global epoch.
Verification
npm test: full suite green;npm run test:locks: 36/36;tsc --noEmitclean.- Load-phase retention measured 1.46GB -> 232MB on the reporter corpus.
- New suites: range-filter (incl. 30k-turn record test), shard-stream, codex-range-filter, concurrent-publish gate, digest/marker tests.
Note: this fixes the load phase only. The same-day parse still retains ~1-2GB of full turns (see follow-up issue for the aggregate-mode fix).
Metadata
Metadata
Assignees
Labels
area: cliThe codeburn CLI and its core parsing/reporting enginebugSomething isn't workingstatus: has-prAn open pull request references this issue
Activity