From de5a0357059e4bb000375c856678ed93eae402e7 Mon Sep 17 00:00:00 2001 From: anais Date: Tue, 23 Jun 2026 11:39:51 -0700 Subject: [PATCH] fix resume response metadata source --- .../src/request_processors/thread_processor.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/codex-rs/app-server/src/request_processors/thread_processor.rs b/codex-rs/app-server/src/request_processors/thread_processor.rs index 83edd29011..da3c3c47ab 100644 --- a/codex-rs/app-server/src/request_processors/thread_processor.rs +++ b/codex-rs/app-server/src/request_processors/thread_processor.rs @@ -3337,7 +3337,14 @@ impl ThreadRequestProcessor { .await?; ResumeHistoryExtent::Full }; - let mut response_thread = stored_thread.clone(); + let mut response_thread = self + .read_stored_thread_for_resume(thread_id, path, /*include_history*/ false) + .await + .ok() + .filter(|response_thread| { + stored_threads_have_same_resume_source(response_thread, &stored_thread) + }) + .unwrap_or_else(|| stored_thread.clone()); response_thread.history = None; let history = self.take_stored_thread_initial_history(&mut stored_thread)?; Ok((history, response_thread, history_extent)) @@ -4988,6 +4995,13 @@ fn set_thread_name_from_title(thread: &mut Thread, title: String) { thread.name = Some(title); } +fn stored_threads_have_same_resume_source( + candidate: &StoredThread, + verified: &StoredThread, +) -> bool { + candidate.thread_id == verified.thread_id && candidate.rollout_path == verified.rollout_path +} + pub(crate) fn thread_from_stored_thread( thread: StoredThread, fallback_provider: &str,