Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After
thread/revert, Codex can write replacement rollouts namedrollout-...-<threadId>_<rolloutId>.jsonlwhile keeping<threadId>insession_meta.id. The CLI compares that ID only with the filename's trailing UUID, so it defers the entire replacement file. Child sessions can also remain deferred because the parent index finds only the original, older rollout.Validate both UUIDs and require replacement metadata to match the logical thread ID, while retaining the physical rollout ID in request IDs so per-file event indexes do not collide. Resolve a parent's history across its rollout segments before applying the fork cutoff. For explicitly paginated replacements, select the segment active at the fork and follow physical
history_basereferences, respecting their byte prefixes so discarded history is not treated as inherited replay. Creation ordering uses UTC metadata because filename timestamps are local wall time; event order within each file is preserved. Explicitly paginated replacement files retain ancestry metadata but reference their old history rather than copying its events, so their own live usage must not be filtered as parent replay.Billable files with logical self-parent references or invalid replacement identities remain deferred without advancing the import cursor. Identical copies are not replayed twice; conflicting copies, missing timestamps, stale replicas, and ambiguous segment ordering retain conservative deferral. For replacement rollouts, parent snapshots validate their root identity from the same opened file used for the cache stamp. For paginated reconstruction, only the segment active at the fork can establish cutoff completeness. Invalid candidate identities, missing referenced segments, and incomplete referenced prefixes defer billable children without advancing their cursors.
Adapted from the merged desktop fixes farion1231/cc-switch#6905 and farion1231/cc-switch#8213, preserving the CLI's incremental import and parser/cache structure. Replacement ancestry follows Codex's replacement writer and its physical prefix reference semantics.
Validation (Rust 1.91.1, isolated HOME/config directories on Linux):
cargo fmt --checkpasses.RUSTFLAGS="-D warnings" cargo check --lib --no-default-featuresandcargo test --lib --no-default-features --no-runpass, matching the Linux library-only CI build.cargo build --bin cc-switchandcargo test --docalso pass.1b43ce6in the same environment (running as root) acrossimport_export_sync,prompt_commands,provider_commands,proxy_service, andworkspace_commands; no new integration failures were introduced. The integration tests selected by Rust CI pass.cargo clippyfails on the existingclippy::reversed_empty_rangeserror atsrc/cli/tui/ui/home_chart.rs:806, reproduced on unchanged base1b43ce6.cargo clippy -- -A clippy::reversed_empty_rangespasses; the source is not changed to suppress it.Scope: this keeps the existing
token_countaccounting model and replay path for parent families without replacement rollouts. Paginated parent reconstruction is limited to references within the same logical thread; cross-thread history projection remains conservatively deferred. Compaction responses whose cumulative token counters do not increase are still outside that model. The separate idle/completed-parent cutoff behavior discussed in #392 is also unchanged.