mirror of
https://github.com/openai/codex.git
synced 2026-11-09 20:50:33 +00:00
codex: remove fork history source wrapper
This commit is contained in:
@@ -384,7 +384,6 @@ use codex_protocol::protocol::ConversationStartParams;
|
||||
use codex_protocol::protocol::ConversationStartTransport;
|
||||
use codex_protocol::protocol::ConversationTextParams;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
use codex_protocol::protocol::ForkedHistory;
|
||||
#[cfg(test)]
|
||||
use codex_protocol::protocol::GitInfo as CoreGitInfo;
|
||||
use codex_protocol::protocol::InitialHistory;
|
||||
|
||||
@@ -35,7 +35,6 @@ use codex_external_agent_sessions::PendingSessionImport;
|
||||
use codex_external_agent_sessions::prepare_validated_session_imports;
|
||||
use codex_external_agent_sessions::record_imported_session;
|
||||
use codex_protocol::ThreadId;
|
||||
use codex_protocol::protocol::ForkedHistory;
|
||||
use codex_protocol::protocol::InitialHistory;
|
||||
use codex_thread_store::ThreadMetadataPatch;
|
||||
use std::collections::HashSet;
|
||||
@@ -306,10 +305,7 @@ impl ExternalAgentConfigRequestProcessor {
|
||||
.thread_manager
|
||||
.start_thread_with_options(StartThreadOptions {
|
||||
config,
|
||||
initial_history: InitialHistory::Forked(ForkedHistory {
|
||||
source_thread_id: None,
|
||||
history: rollout_items,
|
||||
}),
|
||||
initial_history: InitialHistory::Forked(rollout_items),
|
||||
session_source: None,
|
||||
thread_source: None,
|
||||
dynamic_tools: Vec::new(),
|
||||
|
||||
@@ -2501,7 +2501,7 @@ impl ThreadRequestProcessor {
|
||||
let include_turns = !exclude_turns;
|
||||
|
||||
let (thread_history, resume_source_thread) = match if let Some(history) = history {
|
||||
self.resume_thread_from_history(&thread_id, history.as_slice())
|
||||
self.resume_thread_from_history(history.as_slice())
|
||||
.await
|
||||
.map(|thread_history| (thread_history, None))
|
||||
} else {
|
||||
@@ -2928,20 +2928,18 @@ impl ThreadRequestProcessor {
|
||||
|
||||
async fn resume_thread_from_history(
|
||||
&self,
|
||||
thread_id: &str,
|
||||
history: &[ResponseItem],
|
||||
) -> Result<InitialHistory, JSONRPCErrorError> {
|
||||
if history.is_empty() {
|
||||
return Err(invalid_request("history must not be empty"));
|
||||
}
|
||||
Ok(InitialHistory::Forked(ForkedHistory {
|
||||
source_thread_id: ThreadId::from_string(thread_id).ok(),
|
||||
history: history
|
||||
Ok(InitialHistory::Forked(
|
||||
history
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(RolloutItem::ResponseItem)
|
||||
.collect(),
|
||||
}))
|
||||
))
|
||||
}
|
||||
|
||||
async fn resume_thread_from_rollout(
|
||||
@@ -3121,14 +3119,14 @@ impl ThreadRequestProcessor {
|
||||
}
|
||||
}
|
||||
}
|
||||
InitialHistory::Forked(forked) => {
|
||||
InitialHistory::Forked(items) => {
|
||||
let mut thread = build_thread_from_snapshot(
|
||||
thread_id,
|
||||
session_id.clone(),
|
||||
&config_snapshot,
|
||||
Some(rollout_path.into()),
|
||||
);
|
||||
thread.preview = preview_from_rollout_items(&forked.history);
|
||||
thread.preview = preview_from_rollout_items(items);
|
||||
Ok(thread)
|
||||
}
|
||||
InitialHistory::New | InitialHistory::Cleared => Err(format!(
|
||||
|
||||
Reference in New Issue
Block a user