mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
## Why The exec server can wait up to 20 ms for sandbox denial output even when all output streams have already closed. If the last stream closes during that wait, the close alone does not wake the exit watcher. ## What changed Skip the wait when all streams are closed and wake the exit watcher when the last stream closes. Register for notifications under the process lock so the exit watcher can observe stream closure and `process/read` can observe the exit as soon as it is published. ## Testing Add paused-clock regression tests for streams closing before exit, the final stream closing during the wait, and denial output arriving after the first stream closes. GitOrigin-RevId: 22715a0fbe4e582d82abcba8eab4802c42353f69
80 lines
2.4 KiB
Python
80 lines
2.4 KiB
Python
load("@rules_rust//rust:defs.bzl", "rust_binary")
|
|
load("//:defs.bzl", "codex_rust_crate")
|
|
load("//bazel/rules/testing/compat:exec_server_compat_test.bzl", "exec_server_compat_test")
|
|
|
|
exports_files(
|
|
["src/proto/codex.exec_server.relay.v1.rs"],
|
|
visibility = ["//codex-rs/exec-server/tests/support:__pkg__"],
|
|
)
|
|
|
|
codex_rust_crate(
|
|
name = "exec-server",
|
|
crate_name = "codex_exec_server",
|
|
crate_srcs = glob([
|
|
"src/**/*.rs",
|
|
"tests/unit/**/*.rs",
|
|
]),
|
|
extra_binaries = [
|
|
"//codex-rs/bwrap:bwrap",
|
|
"//codex-rs/windows-sandbox-rs:codex-command-runner",
|
|
"//codex-rs/windows-sandbox-rs:codex-windows-sandbox-setup",
|
|
],
|
|
integration_compile_data_extra = [
|
|
"src/proto/codex.exec_server.relay.v1.rs",
|
|
],
|
|
# Keep the crate's tests single-threaded under Bazel because they install
|
|
# process-global test-binary dispatch state, and the remote exec-server
|
|
# cases already rely on serialization around the full CLI path.
|
|
integration_test_args = ["--test-threads=1"],
|
|
test_data_extra = [":musl-test-helper"],
|
|
test_tags = ["no-sandbox"],
|
|
unit_test_args = ["--test-threads=1"],
|
|
unit_test_srcs = ["src/local_process/tests/output_close_tests.rs"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "musl-test-helper",
|
|
testonly = True,
|
|
srcs = select({
|
|
"@llvm//constraints/libc:musl": [":exec-server-test-helper"],
|
|
"//conditions:default": [],
|
|
}),
|
|
)
|
|
|
|
rust_binary(
|
|
name = "exec-server-test-helper",
|
|
testonly = True,
|
|
srcs = ["tests/common/mod.rs"],
|
|
crate_root = "tests/common/mod.rs",
|
|
edition = "2024",
|
|
tags = ["manual"],
|
|
target_compatible_with = ["@llvm//constraints/libc:musl"],
|
|
deps = [
|
|
":exec-server",
|
|
"//codex-rs/build-info",
|
|
"//codex-rs/http-client",
|
|
"//codex-rs/sandboxing",
|
|
"//codex-rs/test-binary-support",
|
|
"//codex-rs/websocket-auth",
|
|
"@crates//tokio",
|
|
"@crates//tracing-subscriber",
|
|
],
|
|
)
|
|
|
|
exec_server_compat_test(
|
|
name = "exec-server-current-version-test",
|
|
comparison_binary = "//codex-rs/cli:codex",
|
|
current_binary = "//codex-rs/cli:codex",
|
|
)
|
|
|
|
# Preparation selects both releases; the normal Bazel test invocation runs them.
|
|
exec_server_compat_test(
|
|
name = "exec-server-stable-release-test",
|
|
release = "@codex_release_latest_stable",
|
|
)
|
|
|
|
exec_server_compat_test(
|
|
name = "exec-server-historical-release-test",
|
|
release = "@codex_release_historical_stable",
|
|
)
|