Files
Free Wortley df3ecee6f0 Launch Linux pipe processes through a fresh setup helper (#47612)
## Why

Linux pipe launches need session, parent-death signal, and descriptor setup. Move this work into a fresh, single-threaded executable image to avoid forking the app-server for child setup.

## What changed

- Register an early setup helper and launch it through `posix_spawn` for Linux pipe processes.
- Start the helper with an empty environment, then transfer the target environment over a control socket so loader settings cannot interfere with helper startup.
- Await target execution asynchronously, propagate setup and execution errors, and kill incomplete launches on cancellation.
- Preserve direct spawning as a fallback when the helper is unavailable or fails before target execution.

## Testing

Add coverage for launch semantics, avoiding fork, loader environment isolation, early argument dispatch, closed standard descriptors, and fallback under bootstrap failure or descriptor pressure. Add an app-server regression test that reuses a process handle after an execution failure.

GitOrigin-RevId: 079c673f0f22ebd531f8c57e5338095cc98acfdc
2026-09-23 18:25:07 +00:00

48 lines
1.3 KiB
Python

load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library")
rust_library(
name = "wine-exec-server-test-support",
testonly = True,
srcs = ["wine_exec_server.rs"],
crate_name = "wine_exec_server_test_support",
crate_root = "wine_exec_server.rs",
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//codex-rs/core/tests/remote_env_windows:__pkg__"],
deps = [
"//bazel/rules/testing/wine:wine_test_support",
"//codex-rs/utils/cargo-bin",
"@crates//:anyhow",
"@crates//:tokio",
],
)
rust_binary(
name = "wine-exec-test-runner",
testonly = True,
srcs = ["wine_remote_test_runner.rs"],
crate_name = "wine_exec_test_runner",
crate_root = "wine_remote_test_runner.rs",
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
":wine-exec-server-test-support",
"@crates//:anyhow",
"@crates//:tokio",
],
)
rust_binary(
name = "exec-server",
testonly = True,
srcs = ["exec_server.rs"],
crate_name = "exec_server",
crate_root = "exec_server.rs",
visibility = ["//visibility:public"],
deps = [
"//codex-rs/exec-server",
"//codex-rs/http-client",
"//codex-rs/utils/pty",
"@crates//:tokio",
],
)