mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
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: