Conversation
This was referenced Jun 27, 2026
5e37371 to
e9a26a3
Compare
This was referenced Jun 28, 2026
This was referenced Jun 29, 2026
f530914 to
39af213
Compare
e3f0531 to
04de4bb
Compare
26ac654 to
38d7926
Compare
npancha-openai
approved these changes
Jul 2, 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.
Why
App-server deployments can consume structured JSON logs for operational measurements without requiring an OTEL exporter. Existing tool-result telemetry reports the handler outcome, but it does not separate time spent waiting to dispatch from time spent executing the handler.
A compact completion event for the outer, direct tool call lets consumers measure those phases and correlate them with a conversation and turn. Code-mode calls are intentionally excluded so nested runtime calls do not create overlapping events that are easy to double-count.
What changed
ToolCallTimingGuardaround direct tool calls. Event-only strings and timing state are captured only when thecodex_core::tools::parallelINFOtarget is enabled.codex.tool_callcompletion event with conversation, turn, tool, call, trace, dispatch, handler, and total timing fields.ToolCallSource::Direct; unit coverage verifies code-mode calls are ignored.JsonLogCapturesupport, a JSON-logging-specificTestAppServerconstructor, and an end-to-end app-server test that drives a directexec_commandthrough the public v2 JSON-RPC API and validates the emitted JSON event.Exec-server-specific request and process timing remains in the stacked PR #30901.
Suggested logging filter
LOG_FORMAT=json \ RUST_LOG='warn,codex_core::tools::parallel=info' \ codex app-serverEvent example
Identifier and timing values are illustrative.
codex.tool_call{ "timestamp": "2026-06-27T03:45:20.443Z", "level": "INFO", "fields": { "message": "tool call completed", "event.name": "codex.tool_call", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736", "conversation.id": "67e55044-10b1-426f-9247-bb680e5fe0c8", "turn_id": "019f04f8-6ac2-78f1-8625-f04a6d35af18", "tool_name": "exec_command", "call_id": "call_7b8483", "tool_source": "direct", "execution_started": true, "dispatch_duration_ms": 12, "handler_duration_ms": 431, "total_duration_ms": 443 }, "target": "codex_core::tools::parallel" }If execution never starts,
execution_startedisfalse,handler_duration_msis0, anddispatch_duration_mscovers the full observed lifetime.If a duration cannot be represented as an unsigned 64-bit millisecond value, all three duration fields are omitted rather than populated with a sentinel that could corrupt downstream calculations.
Test plan
just test -p codex-core tool_call_timing_guard_ignores_code_mode_sourcejust test -p codex-core cancellation_before_dispatch_admission_logs_dispatch_only_timingjust test -p codex-app-server app_server_emits_structured_tool_call_timing_eventStack created with Sapling. Best reviewed with ReviewStack.