diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index 847a85cef7..ffbd23fa48 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -1663,10 +1663,6 @@ impl Session { _call_id: Option, response: RequestUserInputResponse, ) { - if response.interrupted { - // An interrupted request_user_input should end the turn without a follow-up request. - self.mark_request_user_input_interrupted().await; - } let entry = { let mut active = self.active_turn.lock().await; match active.as_mut() { @@ -1680,6 +1676,11 @@ impl Session { match entry { Some(tx_response) => { + if response.interrupted { + // An interrupted request_user_input should end the turn without a follow-up + // request; only mark the active turn when the response is still pending. + self.mark_request_user_input_interrupted().await; + } tx_response.send(response).ok(); } None => {