[codex] Initialize exec-server OpenTelemetry at startup (#25019)

## Summary

- Initialize stderr tracing and the configured OpenTelemetry provider
for local and remote `codex exec-server` startup.
- Instrument the local and remote server entrypoints with a root runtime
span.
- Keep raw Noise environment, registration, and stream identifiers out
of exported spans while preserving them in local debug events.
- Keep telemetry setup in a focused CLI module instead of growing the
top-level command entrypoint.

## Stack

- Previous: none (`#27058` has merged)
- Next: #27466

## Validation

- `just test -p codex-exec-server --lib` (139 passed)
- `just test -p codex-cli --test exec_server` (3 passed)
- `just bazel-lock-check`
- `just fix -p codex-exec-server -p codex-cli`
- `just fmt`

---------

Co-authored-by: Richard Lee <richardlee@openai.com>
This commit is contained in:
starr-openaiandRichard Lee authored and GitHub committed 2026-06-18 11:03:42 -07:00
1 parent e8dd1b45cb
commit 4c7228e423
7 files changed
+88 -21

No files matched your search

+5 -9
View File
@@ -440,15 +440,7 @@ pub(crate) trait HarnessKeyValidator: Send + Sync {
///
/// Parsing the first Noise message authenticates the harness key. Only a
/// successful registry check turns that pending handshake into a virtual stream.
#[tracing::instrument(
level = "debug",
skip_all,
fields(
noise_side = "executor",
environment_id = %environment_id,
executor_registration_id = %executor_registration_id,
)
)]
#[tracing::instrument(level = "debug", skip_all, fields(noise_side = "executor"))]
pub(crate) async fn run_multiplexed_environment<S, V>(
stream: WebSocketStream<S>,
processor: ConnectionProcessor,
@@ -460,6 +452,10 @@ pub(crate) async fn run_multiplexed_environment<S, V>(
S: AsyncRead + AsyncWrite + Unpin + Send + 'static,
V: HarnessKeyValidator + Clone + 'static,
{
debug!(
environment_id,
executor_registration_id, "Noise executor relay details"
);
let (mut websocket_sink, mut websocket_stream) = stream.split();
let (physical_outgoing_tx, mut physical_outgoing_rx) =
mpsc::channel::<Vec<u8>>(CHANNEL_CAPACITY);