Skip to content

fix: bound cache-load memory for ranged queries - #1502

Closed
iliaal wants to merge 1 commit into
getagentseal:mainfrom
iliaal:fix/oom-bounded-shard-load
Closed

iliaal wants to merge 1 commit into
getagentseal:mainfrom
iliaal:fix/oom-bounded-shard-load

Conversation

@iliaal

@iliaal iliaal commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1504.

Fixes the codeburn overview -p today heap crash at the cache-I/O layer.

What was wrong

Ranged loads assembled whole multi-hundred-MB month shards before filtering (loadShardMemoized whole-parsed via JSON.parse, including a 578MB shard that exceeds V8's max string length); the pre-lock snapshot overlapped the canonical reload (~787MB duplicate); 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).

What changed

  • 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 so in-flight loads cannot repopulate a cleared memo.

Verification

  • npm test: full suite green; npm run test:locks: 36/36; tsc --noEmit clean.
  • 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.

Stacked follow-up (aggregate parse mode for the bare-today headline) builds on this branch.

Session month shards decode incrementally (one turn at a time,
keeping only in-range turns); the codex result cache streams,
serves discovery labels from calls-free metadata, and publishes
by merge; shard loads run serially with the pre-lock snapshot
released before reload. Retained strings detach from tokenizer
buffers, dropped dedup keys are 128-bit digests, and provider
queries skip unrelated sections.
@iliaal
iliaal requested a review from iamtoruk as a code owner September 19, 2026 22:50
@github-actions

Copy link
Copy Markdown

Closing for now: this is your first pull request here and it changes 3869 lines with no issue behind it. Open an issue describing the change first so we can agree on the shape before the work is written, then reopen this with the issue number in the description. Small fixes do not need this.

@iliaal

iliaal commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

Issue filed as requested: #1504 (linked above via Fixes). Requesting reopen.

@ozymandiashh ozymandiashh added bug Something isn't working area: cli The codeburn CLI and its core parsing/reporting engine labels Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli The codeburn CLI and its core parsing/reporting engine bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

overview -p today crashes with heap OOM on large corpora (cache-load layer)

2 participants