From 9c3ebac3b72778f78b0fbfeacc96de970f950117 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Fri, 25 Apr 2025 13:41:17 -0700 Subject: [PATCH] fix: flipped the sense of Prompt.store in #642 (#663) I got the sense of this wrong in https://github.com/openai/codex/pull/642. In that PR, I made `--disable-response-storage` work, but broke the default case. With this fix, both cases work and I think the code is a bit cleaner. --- codex-rs/core/src/codex.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index 0d17c8e4..a23c11cd 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -677,13 +677,15 @@ async fn run_turn( let (prev_id, store, is_first_turn) = { let state = sess.state.lock().unwrap(); let is_first_turn = state.previous_response_id.is_none(); - if state.zdr_transcript.is_some() { + let store = state.zdr_transcript.is_none(); + let prev_id = if store { + state.previous_response_id.clone() + } else { // When using ZDR, the Reponses API may send previous_response_id // back, but trying to use it results in a 400. - (None, true, is_first_turn) - } else { - (state.previous_response_id.clone(), false, is_first_turn) - } + None + }; + (prev_id, store, is_first_turn) }; let instructions = if is_first_turn {