Preserve history resume thread ID semantics

This commit is contained in:
Ahmed Ibrahim
2026-06-15 23:04:19 -07:00
parent d944966608
commit 36fa334951
2 changed files with 3 additions and 5 deletions
@@ -2597,7 +2597,7 @@ impl ThreadRequestProcessor {
let include_turns = !exclude_turns;
let resume_result = 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 if let Some(stored_thread) = stored_thread_from_running_probe {
@@ -3034,14 +3034,13 @@ impl ThreadRequestProcessor {
#[tracing::instrument(level = "trace", skip_all)]
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 {
parent_id: ThreadId::from_string(thread_id).ok(),
parent_id: None,
history: history
.iter()
.cloned()
@@ -3448,7 +3448,6 @@ async fn thread_resume_supports_history_and_overrides() -> Result<()> {
let RestartedThreadFixture {
mut mcp, thread_id, ..
} = start_materialized_thread_and_restart(codex_home.path(), "seed history").await?;
let expected_forked_from_id = thread_id.clone();
let history_text = "Hello from history";
let history = vec![ResponseItem::Message {
@@ -3494,7 +3493,7 @@ async fn thread_resume_supports_history_and_overrides() -> Result<()> {
"mock_provider",
history_text,
ThreadStatus::Idle,
Some(expected_forked_from_id),
None,
)
);