mirror of
https://github.com/openai/codex.git
synced 2026-10-21 17:48:44 +00:00
Clear pending turn start on interrupt
This commit is contained in:
@@ -161,6 +161,12 @@ impl InputQueue {
|
||||
.extend(input.into_iter().map(PendingInput::new));
|
||||
}
|
||||
|
||||
pub(crate) async fn clear_start_turn(&self) {
|
||||
for pending_input in &mut self.state.lock().await.turn_pending_input {
|
||||
pending_input.start_turn = false;
|
||||
}
|
||||
}
|
||||
|
||||
#[expect(
|
||||
clippy::await_holding_invalid_type,
|
||||
reason = "active turn checks and turn state updates must remain atomic"
|
||||
|
||||
@@ -3229,6 +3229,7 @@ impl Session {
|
||||
pub async fn interrupt_task(self: &Arc<Self>) {
|
||||
info!("interrupt received: abort current task, if any");
|
||||
let had_active_turn = self.active_turn.lock().await.is_some();
|
||||
self.input_queue.clear_start_turn().await;
|
||||
self.abort_all_tasks(TurnAbortReason::Interrupted).await;
|
||||
if !had_active_turn {
|
||||
self.cancel_mcp_startup().await;
|
||||
|
||||
Reference in New Issue
Block a user