Files
orca/src/main
Neil c74ba15f31 fix(claude): stream the provider history window (#21742)
* fix(claude): stream the provider history window

An oversized Claude transcript made restart reconciliation unresolvable:
readClaudeProviderHistoryWindow buffered the whole project JSONL, so a file
past the 16 MiB bound returned an inconsistent boundary — the one answer the
reconciler can never act on — and a file just under it still went resident.

The window now reuses the streaming primitives from #21024 instead of a
whole-file read. Two bounded passes run over ONE pinned descriptor and size:
the graph pass builds the branch proof (uuid/parentUuid only), and the replay
pass hands back the first record per chain uuid, fingerprinted on the spot. A
repair appended mid-read re-runs BOTH passes at the grown size, so the replay
can never read bytes the proof did not vouch for. The 16 MiB bound survives as
a per-record framing limit, which is the only remaining way the source could
become resident.

claude-transcript-branch-proof.ts is split at its real seam to stay under
max-lines: claude-transcript-branch-graph.ts is what the rows mean as a graph,
and the proof file is which bytes the graph gets to see.

Peak heap over a 252 MiB transcript: 542 MiB whole-file, 53 MiB streaming —
and flat at 53 MiB for a 63 MiB transcript, where whole-file took 136 MiB.

* fix(claude): fail closed when the ancestry walk misses the anchor

The source-budget anchor test filtered on `"latest"`, which also removed the
last-prompt marker. The transcript was unprovable, so the empty window and
single pass it asserted came from an INCONSISTENT verdict, not from the
leaf-equals-anchor path. Filter the record only and assert the boundary.

`ancestryChain` returned [] both for "the leaf IS the anchor" and for a walk
that fell off the graph. The first means nothing followed the anchor; the
second means we never looked. Throw on the second, so the window reports an
inconsistent boundary rather than non-delivery.
2026-09-20 22:12:23 -07:00
..
…
2026-09-03 17:32:59 -07:00
…
…