mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
Preserve history resume thread ID semantics
This commit is contained in:
@@ -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,
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user