From 32deb67fc63d4139500ed6f3f0f2c3fb89b6cedd Mon Sep 17 00:00:00 2001 From: starr-openai Date: Thu, 7 May 2026 01:52:19 -0700 Subject: [PATCH] Harden Windows realtime and agent resume tests Avoid PowerShell command forms that depend on method invocation for the delegated realtime shell-tool test, and wait for a shutdown status before resuming the same subagent thread in the nickname/role restore test. Co-authored-by: Codex --- .../tests/suite/v2/realtime_conversation.rs | 8 ++++---- codex-rs/core/src/agent/control_tests.rs | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/codex-rs/app-server/tests/suite/v2/realtime_conversation.rs b/codex-rs/app-server/tests/suite/v2/realtime_conversation.rs index 975819dc7f..7b39d14669 100644 --- a/codex-rs/app-server/tests/suite/v2/realtime_conversation.rs +++ b/codex-rs/app-server/tests/suite/v2/realtime_conversation.rs @@ -2154,10 +2154,10 @@ fn realtime_tool_ok_command() -> Vec { #[cfg(windows)] { vec![ - "powershell.exe".to_string(), - "-NoProfile".to_string(), - "-Command".to_string(), - "[Console]::Write('realtime-tool-ok')".to_string(), + "cmd.exe".to_string(), + "/D".to_string(), + "/C".to_string(), + "echo(|set /p dummy=realtime-tool-ok".to_string(), ] } diff --git a/codex-rs/core/src/agent/control_tests.rs b/codex-rs/core/src/agent/control_tests.rs index b95aad4489..dc2d7d23b0 100644 --- a/codex-rs/core/src/agent/control_tests.rs +++ b/codex-rs/core/src/agent/control_tests.rs @@ -1631,6 +1631,22 @@ async fn resume_thread_subagent_restores_stored_nickname_and_role() { .shutdown_live_agent(child_thread_id) .await .expect("child shutdown should submit"); + if !matches!(status_rx.borrow().clone(), AgentStatus::Shutdown) { + timeout(Duration::from_secs(5), async { + loop { + status_rx + .changed() + .await + .expect("child status should reach shutdown"); + if matches!(status_rx.borrow().clone(), AgentStatus::Shutdown) { + break; + } + } + }) + .await + .expect("child should shut down before resume"); + } + drop(child_thread); let resumed_thread_id = harness .control