Stabilize exec-server filesystem tests in CI

Move the arg0-based test-binary dispatch bootstrap into a shared test-only crate so core and exec-server can reuse the same current_exe-based harness without keeping exec-server-specific helper logic in codex-arg0.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
starr-openai
2026-04-13 11:48:59 -07:00
parent d25a9822a7
commit b5bee4c008
16 changed files with 675 additions and 111 deletions

View File

@@ -1,5 +1,6 @@
#![allow(dead_code)]
use std::path::PathBuf;
use std::process::Stdio;
use std::time::Duration;
@@ -8,7 +9,6 @@ use codex_app_server_protocol::JSONRPCMessage;
use codex_app_server_protocol::JSONRPCNotification;
use codex_app_server_protocol::JSONRPCRequest;
use codex_app_server_protocol::RequestId;
use codex_utils_cargo_bin::cargo_bin;
use futures::SinkExt;
use futures::StreamExt;
use tempfile::TempDir;
@@ -28,6 +28,7 @@ const EVENT_TIMEOUT: Duration = Duration::from_secs(5);
pub(crate) struct ExecServerHarness {
_codex_home: TempDir,
_helper_paths: TestCodexHelperPaths,
child: Child,
websocket_url: String,
websocket: tokio_tungstenite::WebSocketStream<
@@ -42,10 +43,23 @@ impl Drop for ExecServerHarness {
}
}
pub(crate) struct TestCodexHelperPaths {
pub(crate) codex_exe: PathBuf,
pub(crate) codex_linux_sandbox_exe: Option<PathBuf>,
}
pub(crate) fn test_codex_helper_paths() -> anyhow::Result<TestCodexHelperPaths> {
let (helper_binary, codex_linux_sandbox_exe) = super::current_test_binary_helper_paths()?;
Ok(TestCodexHelperPaths {
codex_exe: helper_binary,
codex_linux_sandbox_exe,
})
}
pub(crate) async fn exec_server() -> anyhow::Result<ExecServerHarness> {
let binary = cargo_bin("codex")?;
let helper_paths = test_codex_helper_paths()?;
let codex_home = TempDir::new()?;
let mut child = Command::new(binary);
let mut child = Command::new(&helper_paths.codex_exe);
child.args(["exec-server", "--listen", "ws://127.0.0.1:0"]);
child.stdin(Stdio::null());
child.stdout(Stdio::piped());
@@ -58,6 +72,7 @@ pub(crate) async fn exec_server() -> anyhow::Result<ExecServerHarness> {
let (websocket, _) = connect_websocket_when_ready(&websocket_url).await?;
Ok(ExecServerHarness {
_codex_home: codex_home,
_helper_paths: helper_paths,
child,
websocket_url,
websocket,