refactor(core): simplify initial history preparation

This commit is contained in:
Ningyi Xie
2026-06-08 14:17:57 -07:00
parent 6e97ccb73c
commit ac22b25d85
2 changed files with 5 additions and 7 deletions
+1
View File
@@ -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);
@@ -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,