fix(codex): strip forked history via parent-rollout token-prefix alignment

Rewrite the Codex session importer: identify forks by forked_from_id or
subagent thread_spawn.parent_thread_id (conflicts defer), anchor thread
identity to the rollout filename UUID, and align child token_count
signatures against the parent rollout as a strict prefix so replayed
parent history only establishes the cumulative baseline and is never
imported as child usage. Ambiguous alignments defer without advancing
the cursor and recover once the parent appears; parent signatures are
cached per (path, cutoff).

Fixes the 3x-20x double counting behind #5335/#5433 while keeping
reference-type subagents fully counted (#5381).
This commit is contained in:
Jason
2026-07-20 12:16:48 +08:00
parent a10b569a53
commit df3e07edbb
File diff suppressed because it is too large Load Diff