From 8ac495b79988995cae163d5a67ecd72b78f73629 Mon Sep 17 00:00:00 2001 From: felixxia-oai Date: Thu, 24 Sep 2026 10:44:03 +0000 Subject: [PATCH] Fix sleep interruption test event handling and fixture lifetime (#47813) ## Why The list-voices barrier can consume the sleep completion event that `any_new_input_interrupts_sleep` needs to observe. ## What changed Enqueue agent mail directly in the test so the subsequent wait can observe sleep completion. Keep the `TestCodex` fixture alive for the duration of the test by cloning its `codex` handle instead of moving it out. GitOrigin-RevId: 957165c2f20cc4d76df763cd41fd99816b477be3 --- codex-rs/core/tests/suite/pending_input.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/codex-rs/core/tests/suite/pending_input.rs b/codex-rs/core/tests/suite/pending_input.rs index ff90e54404..0453bf811f 100644 --- a/codex-rs/core/tests/suite/pending_input.rs +++ b/codex-rs/core/tests/suite/pending_input.rs @@ -670,7 +670,7 @@ async fn any_new_input_interrupts_sleep() { response_completed_chunks("resp-3"), ]) .await; - let codex = test_codex() + let test = test_codex() .with_model("gpt-5.4") .with_config(|config| { config @@ -684,8 +684,8 @@ async fn any_new_input_interrupts_sleep() { }) .build_with_streaming_server(&server) .await - .expect("build Codex test session") - .codex; + .expect("build Codex test session"); + let codex = test.codex.clone(); submit_user_input(&codex, INITIAL_PROMPT).await; wait_for_sleep_item_started(&codex, FIRST_SLEEP_CALL_ID, SLEEP_DURATION_MS).await; @@ -694,7 +694,8 @@ async fn any_new_input_interrupts_sleep() { wait_for_sleep_item_completed(&codex, FIRST_SLEEP_CALL_ID, SLEEP_DURATION_MS).await; wait_for_sleep_item_started(&codex, SECOND_SLEEP_CALL_ID, SLEEP_DURATION_MS).await; - submit_queue_only_agent_mail(&codex, "new mailbox input").await; + // The list-voices barrier can consume the sleep completion that we need to observe next. + enqueue_queue_only_agent_mail(&codex, "new mailbox input").await; wait_for_sleep_item_completed(&codex, SECOND_SLEEP_CALL_ID, SLEEP_DURATION_MS).await; wait_for_turn_complete(&codex).await;