From f158b31db59c2f9f11178d06a2a5c49707e8689b Mon Sep 17 00:00:00 2001 From: "Adam Perry @ OpenAI" Date: Tue, 7 Jul 2026 11:21:56 -0700 Subject: [PATCH] test: generalize exec-server fixture (#31422) ## Why Remote-executor integration tests need one host-agnostic exec-server fixture target instead of a Windows-only wrapper. ## What - rename the testing binary target to exec-server - make the fixture source and target host-agnostic - update Windows remote-executor test wiring to use the shared target ## Validation - bazel build //codex-rs/exec-server/testing:exec-server - bazel cquery --config=ci-windows-cross 'set(//codex-rs/exec-server/testing:exec-server //codex-rs/core/tests/remote_env_windows:smoke-test)' ## Stack 1. [#31422 test: generalize exec-server fixture](https://github.com/openai/codex/pull/31422) 2. [#31425 test: add TestAppServer builder](https://github.com/openai/codex/pull/31425) 3. [#31427 test: add delayed exec-server transport](https://github.com/openai/codex/pull/31427) 4. [#31295 bench: add cold skill load macrobenchmark](https://github.com/openai/codex/pull/31295) 5. [#31428 bench: add e2e benchmark entrypoints](https://github.com/openai/codex/pull/31428) 6. [#31429 ci: smoke Bazel e2e benchmarks](https://github.com/openai/codex/pull/31429) --- .../core/tests/remote_env_windows/BUILD.bazel | 2 +- codex-rs/exec-server/testing/BUILD.bazel | 10 ++++------ codex-rs/exec-server/testing/exec_server.rs | 14 ++++++++++++++ .../exec-server/testing/windows_exec_server.rs | 18 ------------------ defs.bzl | 2 +- 5 files changed, 20 insertions(+), 26 deletions(-) create mode 100644 codex-rs/exec-server/testing/exec_server.rs delete mode 100644 codex-rs/exec-server/testing/windows_exec_server.rs diff --git a/codex-rs/core/tests/remote_env_windows/BUILD.bazel b/codex-rs/core/tests/remote_env_windows/BUILD.bazel index 1f2465ffcb..6ad412da2b 100644 --- a/codex-rs/core/tests/remote_env_windows/BUILD.bazel +++ b/codex-rs/core/tests/remote_env_windows/BUILD.bazel @@ -7,7 +7,7 @@ wine_rust_test( crate_name = "remote_env_windows_test", crate_root = "remote_env_windows_test.rs", windows_binaries = { - "wine-windows-exec-server": "//codex-rs/exec-server/testing:windows-exec-server", + "wine-windows-exec-server": "//codex-rs/exec-server/testing:exec-server", }, deps = [ "//codex-rs/core/tests/common", diff --git a/codex-rs/exec-server/testing/BUILD.bazel b/codex-rs/exec-server/testing/BUILD.bazel index ac4818f55e..2e2cc220d4 100644 --- a/codex-rs/exec-server/testing/BUILD.bazel +++ b/codex-rs/exec-server/testing/BUILD.bazel @@ -32,13 +32,11 @@ rust_binary( ) rust_binary( - name = "windows-exec-server", + name = "exec-server", testonly = True, - srcs = ["windows_exec_server.rs"], - crate_name = "windows_exec_server", - crate_root = "windows_exec_server.rs", - tags = ["manual"], - target_compatible_with = ["@platforms//os:windows"], + srcs = ["exec_server.rs"], + crate_name = "exec_server", + crate_root = "exec_server.rs", visibility = ["//visibility:public"], deps = [ "//codex-rs/exec-server", diff --git a/codex-rs/exec-server/testing/exec_server.rs b/codex-rs/exec-server/testing/exec_server.rs new file mode 100644 index 0000000000..dbef4a4899 --- /dev/null +++ b/codex-rs/exec-server/testing/exec_server.rs @@ -0,0 +1,14 @@ +//! Minimal exec-server fixture for Bazel-only integration tests. +//! +//! Linking only exec-server avoids depending on the full Codex CLI binary +//! when a test only needs a WebSocket executor endpoint. + +use codex_exec_server::ExecServerRuntimePaths; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let current_exe = std::env::current_exe()?; + let runtime_paths = + ExecServerRuntimePaths::new(current_exe, /*codex_linux_sandbox_exe*/ None)?; + codex_exec_server::run_main("ws://127.0.0.1:0", runtime_paths).await +} diff --git a/codex-rs/exec-server/testing/windows_exec_server.rs b/codex-rs/exec-server/testing/windows_exec_server.rs deleted file mode 100644 index 9efc5286fc..0000000000 --- a/codex-rs/exec-server/testing/windows_exec_server.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! Minimal Windows exec-server fixture for cross-platform tests. -//! -//! Keeping this wrapper separate avoids depending on the full Codex binary's -//! Windows cross-build, which is not yet supported by the Bazel graph. Linking -//! only the exec-server also makes the Wine test substantially faster to -//! iterate on. - -use codex_exec_server::ExecServerRuntimePaths; - -#[tokio::main] -async fn main() -> Result<(), Box> { - let current_exe = std::env::current_exe()?; - // This fixture is always a Windows executable, so it neither invokes nor - // needs the separate Linux sandbox binary. - let runtime_paths = - ExecServerRuntimePaths::new(current_exe, /*codex_linux_sandbox_exe*/ None)?; - codex_exec_server::run_main("ws://127.0.0.1:0", runtime_paths).await -} diff --git a/defs.bzl b/defs.bzl index c8fd35e039..8532a223eb 100644 --- a/defs.bzl +++ b/defs.bzl @@ -538,7 +538,7 @@ def codex_rust_crate( wine_exec_server = wine_test_name + "-windows-exec-server" foreign_platform_binary( name = wine_exec_server, - binary = "//codex-rs/exec-server/testing:windows-exec-server", + binary = "//codex-rs/exec-server/testing:exec-server", extra_rustc_flags = WINDOWS_GNULLVM_RUSTC_LINK_FLAGS, platform = "//:windows_x86_64_gnullvm", tags = ["manual"],