From 89ff3ccfb31bacc83cf5829eb35797ee81d03826 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Wed, 11 Mar 2026 18:53:16 -0700 Subject: [PATCH] codex: fix CI failure on PR #14410 Filter the turn completion assertion to the parent thread so the spawn metadata integration test is robust to child-first completion ordering. Co-authored-by: Codex --- .../app-server/tests/suite/v2/turn_start.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/codex-rs/app-server/tests/suite/v2/turn_start.rs b/codex-rs/app-server/tests/suite/v2/turn_start.rs index 8d893e807a..f621241d88 100644 --- a/codex-rs/app-server/tests/suite/v2/turn_start.rs +++ b/codex-rs/app-server/tests/suite/v2/turn_start.rs @@ -1840,13 +1840,20 @@ async fn turn_start_emits_spawn_agent_item_with_model_metadata_v2() -> Result<() )]) ); - let turn_completed_notif = timeout( - DEFAULT_READ_TIMEOUT, - mcp.read_stream_until_notification_message("turn/completed"), - ) + let turn_completed = timeout(DEFAULT_READ_TIMEOUT, async { + loop { + let turn_completed_notif = mcp + .read_stream_until_notification_message("turn/completed") + .await?; + let turn_completed: TurnCompletedNotification = serde_json::from_value( + turn_completed_notif.params.expect("turn/completed params"), + )?; + if turn_completed.thread_id == thread.id && turn_completed.turn.id == turn.turn.id { + return Ok::(turn_completed); + } + } + }) .await??; - let turn_completed: TurnCompletedNotification = - serde_json::from_value(turn_completed_notif.params.expect("turn/completed params"))?; assert_eq!(turn_completed.thread_id, thread.id); assert_eq!(turn_completed.turn.id, turn.turn.id);