From 4635d489254ba6d80eb6d2ef501929b0c617b6ec Mon Sep 17 00:00:00 2001 From: jif Date: Mon, 19 Oct 2026 12:49:44 +0000 Subject: [PATCH] Stabilize daemon reconnect and Rosetta package startup tests (#55274) ## Why A replacement daemon PID can appear before the TUI observes the disconnect, allowing stale UI content to make the startup test advance too early. Cold Rosetta translation can also consume the startup deadlines for freshly extracted Intel macOS packages on Apple Silicon. ## What changed - Wait for the reconnect transcript clear before sending `/status` in the daemon startup test. - Warm both packaged CLI and app-server entrypoints with `--help` when testing `x86_64-apple-darwin` packages on `arm64` hosts. Give each warmup 180 seconds and fail fixture setup if either entrypoint cannot run. GitOrigin-RevId: ce75201a7773ebb55cc060ca04b09ec2d0ccf303 --- codex-rs/cli/tests/daemon_startup.rs | 6 ++++++ scripts/codex_package/smoke_tests/fixtures.py | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/codex-rs/cli/tests/daemon_startup.rs b/codex-rs/cli/tests/daemon_startup.rs index a78093e73a..85dea154cc 100644 --- a/codex-rs/cli/tests/daemon_startup.rs +++ b/codex-rs/cli/tests/daemon_startup.rs @@ -473,6 +473,12 @@ async fn daemon_startup(command: &str) -> Result<()> { continue; } } + // A replacement PID can appear before the TUI observes the disconnect. + // Wait for reconnect to clear/rebuild the transcript, so the old + // composer's command popup cannot make the status probe look ready. + if *input == b"/status" && !output.contains("\x1b[3J") { + continue; + } // The old header can linger while the daemon stops. Check both // the draft and its Enter against the replacement process and UI. if (*input == b"/status" || *input == b"\r") diff --git a/scripts/codex_package/smoke_tests/fixtures.py b/scripts/codex_package/smoke_tests/fixtures.py index b9e0c69b23..52e8838c46 100644 --- a/scripts/codex_package/smoke_tests/fixtures.py +++ b/scripts/codex_package/smoke_tests/fixtures.py @@ -1,6 +1,7 @@ import gzip import json import os +import platform import subprocess import tarfile from collections.abc import Iterator @@ -150,13 +151,28 @@ def package( capture_output=True, text=True, ) - return SmokePackage.from_archives( + package = SmokePackage.from_archives( directory, target, request.config.getoption("cli_archive"), request.config.getoption("app_server_archive"), compression, ) + if target == "x86_64-apple-darwin" and platform.machine() == "arm64": + # Freshly extracted Intel binaries need cold Rosetta translation before + # the command and SDK startup deadlines begin. Keep startup bounded and + # fail setup if either packaged entrypoint cannot run. + for executable in (package.cli, package.app_server): + subprocess.run( + [str(executable), "--help"], + cwd=package.directory, + env=package.environment, + check=True, + text=True, + capture_output=True, + timeout=180, + ) + return package @pytest.fixture