[codex] Record exec-server lifecycle metrics - #27467
Merged
Merged
Conversation
This was referenced Jun 10, 2026
richardopenai
marked this pull request as ready for review
June 10, 2026 21:12
Contributor
Codex Cloud Agents (CCA) couldn't complete this review. The original Codex Review is unaffected. |
Contributor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6b943d92c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
richardopenai
force-pushed
the
codex/exec-server-connection-metrics
branch
from
June 16, 2026 19:21
d6b943d to
7a28c0a
Compare
richardopenai
force-pushed
the
codex/exec-server-rpc-tracing
branch
from
June 16, 2026 19:21
e06c4e5 to
f3958b2
Compare
richardopenai
force-pushed
the
codex/exec-server-rpc-tracing
branch
from
June 18, 2026 18:09
f3958b2 to
1ef0691
Compare
richardopenai
force-pushed
the
codex/exec-server-connection-metrics
branch
2 times, most recently
from
June 18, 2026 22:39
5a94cf1 to
1128e27
Compare
richardopenai
force-pushed
the
codex/exec-server-rpc-tracing
branch
from
June 19, 2026 00:15
1ef0691 to
eb4572e
Compare
richardopenai
force-pushed
the
codex/exec-server-connection-metrics
branch
from
June 19, 2026 00:15
1128e27 to
2d7885f
Compare
…-tracing # Conflicts: # codex-rs/exec-server/src/server/processor.rs
…onnection-metrics # Conflicts: # codex-rs/exec-server/src/local_process.rs # codex-rs/exec-server/src/server/process_handler.rs # codex-rs/exec-server/src/server/session_registry.rs
…onnection-metrics
anp-oai
reviewed
Jun 23, 2026
richardopenai
force-pushed
the
codex/exec-server-rpc-tracing
branch
from
June 24, 2026 04:40
eb0a36c to
a37f8f3
Compare
richardopenai
added a commit
that referenced
this pull request
Jun 24, 2026
## Why Exec-server JSON-RPC calls can cross local and remote transports, but trace context stopped at the RPC boundary. That made client and server work difficult to correlate when diagnosing latency or failures. ## What changed - Propagate the current W3C trace context on outbound JSON-RPC requests. - Parent inbound request spans from received trace context. - Record the received JSON-RPC method on server spans and keep each span open through response enqueue. - Add only the OTEL dependencies required by the exec-server crate. ## Stack Review and land this stack in order: 1. #27466 — trace exec-server JSON-RPC requests **(this PR)** 2. #27467 — record bounded connection, request, and process lifecycle metrics 3. #27470 — observe remote registration and Noise rendezvous lifecycle ## Validation - `just test -p codex-exec-server --lib` (153 passed) - `just bazel-lock-check` - `just fix -p codex-exec-server`
anp-oai
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wiremockdependency.Root cause
Process exit and session shutdown previously used cloned completion state. That avoided duplicate emission, but it duplicated lifecycle ownership and made the ordering harder to reason about. The process registry mutex already defines the lifecycle ordering, so the final implementation stores the metric guard and termination flag directly on the process entry. Whichever path claims the entry first owns the completion result.
Production metric export uses delta temporality. Event-only synchronous gauge recordings disappear after the next collection when no count changes, so active counts now use observable callbacks that report current state on every collection.
The cleanup also removes the constant
result="accepted"connection tag, redundant route and response assertions, a custom HTTP collector, and fallback initialization machinery that did not add behavior.Stack
Review and land this stack in order:
Validation
just test -p codex-exec-server --lib(158 passed)just test -p codex-cli --test exec_server(3 passed)just test -p codex-otel observable_gauge_is_collected_on_every_delta_snapshot(1 passed)CARGO_BUILD_JOBS=1 just fix -p codex-otel -p codex-exec-serverjust fmtgit diff --check