mirror of
https://github.com/openai/codex.git
synced 2026-11-05 20:10:33 +00:00
refactor(core): simplify initial history preparation
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user