SIGN IN SIGN UP

fix(token-usage): harden fork parent resolution

- A mid-read I/O error in collect_parent_prefix returned the truncated
  (possibly empty) prefix as verified-complete, so the child's replayed
  history verified against it and the rest double-counted as fresh
  usage; it now resolves to None — the burst-heuristic fallback — like
  a parent that failed to open.
- A fork marker arms replay matching only from the pristine state:
  repeated session_meta lines in a corrupt or crafted rollout no longer
  discard matching progress, re-trigger parent resolution per marker,
  or mis-skip genuine usage as replayed history.
- The sessions-tree scan considers only .jsonl candidates, and the
  first-line id probe reads at most 64KiB instead of buffering an
  arbitrary newline-free file into memory.
- Parent resolution answers only codex requests; another tool's
  request resolves as parent-unavailable instead of misparsing a
  foreign transcript as a rollout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
S
Sasha Varlamov committed
bba3d1537f9619e2ab52fda9b745c7ec55fbfbf0
Parent: adbc0c5