Lightweight coding agent that runs in your terminal
Rust
Propagate tracing subscribers to exec start tasks (#32135)
jif54c44b9ed4c7
diff --git a/codex-rs/exec-server/BUILD.bazel b/codex-rs/exec-server/BUILD.bazelindex e3c5c05b93..edd3380811 100644--- a/codex-rs/exec-server/BUILD.bazel+++ b/codex-rs/exec-server/BUILD.bazel@@ -14,9 +14,10 @@ codex_rust_crate(integration_compile_data_extra = ["src/proto/codex.exec_server.relay.v1.rs",],- # Keep the crate's integration 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.+ # 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_tags = ["no-sandbox"],+ unit_test_args = ["--test-threads=1"],)diff --git a/codex-rs/exec-server/src/client.rs b/codex-rs/exec-server/src/client.rsindex 6b8e22b7b2..ae601c5dda 100644--- a/codex-rs/exec-server/src/client.rs+++ b/codex-rs/exec-server/src/client.rs@@ -23,6 +23,7 @@ use tokio_util::task::AbortOnDropHandle;use tokio::time::timeout;use tracing::Instrument;use tracing::debug;+use tracing::instrument::WithSubscriber;use crate::ProcessId;use crate::client::http_client::response_body_stream::MAX_QUEUED_HTTP_BODY_BYTES;@@ -781,7 +782,11 @@ impl ExecServerClient {}}};- tokio::spawn(process_start_task.in_current_span());+ tokio::spawn(+ process_start_task+ .in_current_span()+ .with_current_subscriber(),+ );return result_rx.await.map_err(|_| {ExecServerError::Protocol("process start task stopped unexpectedly".to_string())})?;@@ -1479,7 +1484,7 @@ mod tests {.expect("json-rpc line should write");}- #[tokio::test(flavor = "current_thread")]+ #[tokio::test(flavor = "multi_thread", worker_threads = 1)]async fn process_start_propagates_caller_trace_context_across_background_task() {let (client_stdin, server_reader) = duplex(1 << 20);let (mut server_writer, client_stdout) = duplex(1 << 20);