From b73c4b50a27e2acdbe80875b4bfba20666889e28 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Sat, 21 Feb 2026 17:06:35 -0800 Subject: [PATCH] fix: make realtime conversation flake test order-insensitive (#12475) ## Why `codex-core::all` has a flaky test, `suite::realtime_conversation::conversation_start_audio_text_close_round_trip`, that assumes a fixed ordering between `conversation.item.create` and `response.input_audio.delta` requests. That ordering is not guaranteed: realtime text and audio input are forwarded through separate queues and a background task, so either request can be observed first while still being correct behavior. ## What Changed - Updated the assertion in `codex-rs/core/tests/suite/realtime_conversation.rs` to compare the two observed request types order-independently. - Kept the existing checks that `session.create` is sent first and that exactly two follow-up requests are recorded. ## Verification - Re-ran `cargo test -p codex-core --test all conversation_start_audio_text_close_round_trip` 10 times locally. --- codex-rs/core/tests/suite/realtime_conversation.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codex-rs/core/tests/suite/realtime_conversation.rs b/codex-rs/core/tests/suite/realtime_conversation.rs index 466686788..fc7b21e0e 100644 --- a/codex-rs/core/tests/suite/realtime_conversation.rs +++ b/codex-rs/core/tests/suite/realtime_conversation.rs @@ -120,7 +120,7 @@ async fn conversation_start_audio_text_close_round_trip() -> Result<()> { .as_deref() .expect("started session id should be present") ); - let request_types = [ + let mut request_types = [ connection[1].body_json()["type"] .as_str() .expect("request type") @@ -130,6 +130,7 @@ async fn conversation_start_audio_text_close_round_trip() -> Result<()> { .expect("request type") .to_string(), ]; + request_types.sort(); assert_eq!( request_types, [