Repository navigation
Conversation
Session month shards decode incrementally (one turn at a time, keeping only in-range turns with the exact kept/dropped/carry contract); shard loads run serially with the pre-lock snapshot released before the canonical reload. Out-of-range turns contribute raw dedup keys to cross-file suppression markers; retained strings detach from tokenizer buffers. The codex result cache rewrite, digest wiring, and aggregate parse mode follow as stacked PRs.
|
Thank you. tsc is clean on this head, the 15 touched tests pass, and the leaf diff against #1506 is identical on every period, cold and warm. Same blocker as #1506, so this one waits with it. Warm medians, this head vs main: The same size gate fixes it: parse normally under a threshold, stream only the oversized file. Nothing else is open on this PR. Once the gate is settled on #1506 this follows straight after. Conflicts against main: |
Per-string flattening at assembly copied every string of every turn (kept or dropped): ~829k turns x dozens of strings of Buffer + string churn that GC could not retire under a heap cap, dying in the sept shard at ~500MB live. streamShardArrayField takes detachStrings (default true); the filtered loader passes false and flattens only what it keeps (kept turns + meta at fold time, carry refs + first project in finishSlice). (cherry picked from commit 1b30177)
The streaming walk costs 15-20s where JSON.parse needs milliseconds (525MB of shards in ~11s on this corpus); it exists for the one shard past V8's max string length. Shards at or under 256MB now take plain JSON.parse through the same per-record projection (filterShardFile / validateCachedFile); larger ones stream exactly as before. A single readFile is already an atomic snapshot, so the small path needs no fingerprint guard. Byte-identical results on both paths are pinned by the size-gate parity suite (kept, sliced, PR-whole, key-overlap, all-dropped, invalid).
The single result file decodes entry by entry; discovery labels come from calls-free metadata; publishes merge dirty entries; single-flight loads are shared and retry on mid-decode publish, with a global clear epoch.
9bbec7c to
f13b35f
Compare
…reaming Same size gate as session shards (SHARD_STREAM_GATE_BYTES now lives in shard-stream.ts, shared by both): the timestamp scan reuses the exported retainCodexEntry rule per entry so the paths cannot drift, and the entry load applies the same retain rule in memory. The streaming mid-flush rendezvous test pins the stream path explicitly. Parity between paths is pinned by the new codex size-gate test.
10231ac to
056d395
Compare
|
Follows the #1506 gate: same threshold, timestamp scan reuses the exported |
|
Thank you for this work. The diagnosis in #1503, #1506, #1508 and #1509 (cache load holding whole month shards, the post-lock reload, the string limit on huge shards, the codex results cache) was right, and it shaped what we shipped. We're closing the stack instead of merging it because, measured on real and reporter-sized corpora, it didn't bound memory as stacked and made warm runs slower for normal users:
What we did instead, as two smaller steps with every figure checked identical to main:
On a heavy corpus Your Cursor Agent fix in #1513 is going in, with a small patch on top. |
Stacks on #1506 (review that first; this diff includes it until it merges). Split out of that PR per review: the codex-cache rewrite rides separately from the session-shard work.
What changed
Verification