Retry busy executable launches in packaged daemon tests (#46524)

## Why

Freshly copied executables can briefly remain busy on Linux CI workers, causing packaged daemon tests to fail at launch.

## What changed

Retry the command launch in `packaged_daemon_launch` up to twice on `std::io::ErrorKind::ExecutableFileBusy`, waiting 10 ms between attempts. Other launch errors still propagate immediately.

GitOrigin-RevId: afb6213173a7ae4bcfe2e1e6fab6ced65ab5bf77
This commit is contained in:
felixxia-oai
2026-09-18 15:57:46 +00:00
committed by copyberry
parent 74af2496c9
commit 5701a576cc

View File

@@ -524,10 +524,22 @@ fn packaged_daemon_launch(action: &str, initial: InitialDaemon) -> Result<()> {
br#"{"shutdownGraceSeconds":0}"#,
)?;
let cli_before = daemon.codex.canonicalize()?;
let result = daemon
.command()
.args(["app-server", "daemon", action])
.output()?;
let mut command = daemon.command();
command.args(["app-server", "daemon", action]);
// A freshly copied executable can briefly remain busy on Linux CI workers.
let mut retries = 0;
let result = loop {
let result = command.output();
if !result
.as_ref()
.is_err_and(|error| error.kind() == std::io::ErrorKind::ExecutableFileBusy)
|| retries == 2
{
break result?;
}
retries += 1;
std::thread::sleep(Duration::from_millis(/*millis*/ 10));
};
ensure!(
result.status.success(),
"{}",