From 232ffcffc6a493f5867cd383476fa2fe9e643f8f Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Mon, 16 Mar 2026 12:52:40 -0700 Subject: [PATCH] codex: clarify compacted replacement history sync Add an inline comment explaining why replacement_history is refreshed from the final in-memory items after the ghost snapshot tail merge. Co-authored-by: Codex --- codex-rs/core/src/codex.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index fcd274841a..d898f2c97f 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -3381,6 +3381,9 @@ impl Session { ); state.replace_history(items.clone(), reference_context_item.clone()); } + // `items` may have gained a concurrent ghost snapshot tail under the + // state lock, so refresh the persisted replacement history to match the + // in-memory install. compacted_item.replacement_history = Some(items); self.persist_rollout_items(&[RolloutItem::Compacted(compacted_item)])