diff --git a/codex-rs/core/src/session/mod.rs b/codex-rs/core/src/session/mod.rs index beef55e907..4f9c1bccd5 100644 --- a/codex-rs/core/src/session/mod.rs +++ b/codex-rs/core/src/session/mod.rs @@ -622,6 +622,7 @@ impl Codex { inherited_shell_snapshot, user_shell_override, }; + // Generate a unique ID for the lifetime of this Codex session. let session_source_clone = session_configuration.session_source.clone(); let (agent_status_tx, agent_status_rx) = watch::channel(AgentStatus::PendingInit); diff --git a/codex-rs/core/src/session/rollout_reconstruction.rs b/codex-rs/core/src/session/rollout_reconstruction.rs index 89a93c2f8a..08436a03e8 100644 --- a/codex-rs/core/src/session/rollout_reconstruction.rs +++ b/codex-rs/core/src/session/rollout_reconstruction.rs @@ -28,15 +28,12 @@ pub(super) struct PreparedInitialHistory { impl PreparedInitialHistory { pub(super) fn new(history: InitialHistory) -> Self { - let reconstruction_plan = match &history { - InitialHistory::Resumed(resumed_history) => { - Some(Session::reconstruct_rollout_plan(&resumed_history.history)) - } - InitialHistory::Forked(rollout_items) => { - Some(Session::reconstruct_rollout_plan(rollout_items)) - } + let rollout_items = match &history { + InitialHistory::Resumed(resumed_history) => Some(resumed_history.history.as_slice()), + InitialHistory::Forked(rollout_items) => Some(rollout_items.as_slice()), InitialHistory::New | InitialHistory::Cleared => None, }; + let reconstruction_plan = rollout_items.map(Session::reconstruct_rollout_plan); Self { history, reconstruction_plan,