From c360485a135246d45a4f381d9002d126fde8f5b1 Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Thu, 5 Mar 2026 20:01:21 -0800 Subject: [PATCH] Clarify newest surviving turn-context snapshot selection Co-authored-by: Codex --- codex-rs/core/src/codex/rollout_reconstruction.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codex-rs/core/src/codex/rollout_reconstruction.rs b/codex-rs/core/src/codex/rollout_reconstruction.rs index e8e9c730c8..928afe4b9d 100644 --- a/codex-rs/core/src/codex/rollout_reconstruction.rs +++ b/codex-rs/core/src/codex/rollout_reconstruction.rs @@ -170,6 +170,9 @@ impl Session { active_segment.turn_id.as_deref(), ctx.turn_id.as_deref(), ) { + // Reverse replay walks newest-to-oldest, so the first surviving + // `TurnContextItem` we see for this turn segment is the newest + // surviving context snapshot for the turn. if active_segment.previous_turn_settings.is_none() { active_segment.previous_turn_settings = Some(PreviousTurnSettings { model: ctx.model.clone(),