From 9afb96faffc2d679788f2192f9efce5451a0d7f2 Mon Sep 17 00:00:00 2001 From: jif Date: Fri, 7 Aug 2026 02:00:46 +0000 Subject: [PATCH] Retry busy app-server test executable spawns (#37354) ## Why App-server integration tests can encounter a transient `ExecutableFileBusy` error while starting their server process. ## What changed Retry that specific spawn failure up to twice with a 10 ms delay, while returning all other spawn errors immediately. GitOrigin-RevId: 0982a9fe66bae4c41f556c845d12fb515dbf752c --- .../app-server/tests/common/test_app_server.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/codex-rs/app-server/tests/common/test_app_server.rs b/codex-rs/app-server/tests/common/test_app_server.rs index 3b9f774d8f..d5b969b44c 100644 --- a/codex-rs/app-server/tests/common/test_app_server.rs +++ b/codex-rs/app-server/tests/common/test_app_server.rs @@ -257,10 +257,20 @@ impl TestAppServer { } } - let mut process = cmd - .kill_on_drop(true) - .spawn() - .context("codex-mcp-server proc should start")?; + cmd.kill_on_drop(true); + let mut retries = 0; + let mut process = loop { + let process = cmd.spawn(); + if !process + .as_ref() + .is_err_and(|error| error.kind() == std::io::ErrorKind::ExecutableFileBusy) + || retries == 2 + { + break process.context("codex-mcp-server proc should start")?; + } + retries += 1; + tokio::time::sleep(Duration::from_millis(10)).await; + }; let stdin = process .stdin .take()