Commit Graph
3 Commits
Author SHA1 Message Date
npancha-openai 38006a282e [codex] telemetry: narrow structured tool call timing (#30911)
## Summary

- restore the existing `codex.tool_result` behavior and remove the added
`codex.inference` event
- emit `codex.tool_call` timing events only for direct tool calls
- snapshot the execution-start marker once when emitting
`codex.tool_call` so a concurrent dispatch start cannot produce
internally inconsistent timing fields

## Why

This keeps the stacked change focused on direct tool-call timing without
expanding result or inference telemetry. The timing-marker fix addresses
repeated reads of the marker during event emission, which could
otherwise observe different states if dispatch begins concurrently.

## Validation

- `just fmt`
- `git diff --check HEAD~3..HEAD`
- `just test -p codex-core
tool_call_timing_guard_ignores_code_mode_source`
- `just test -p codex-app-server
app_server_emits_structured_tool_call_timing_event`
- `just test -p codex-otel
otel_export_routing_policy_routes_tool_result_log_and_trace_events`

I also attempted `just test -p codex-core -p codex-otel -p
codex-app-server`; that broader run was not completed after multiple
app-server tests timed out.
2026-07-02 10:55:05 -07:00
Michael Bolin 1adf6c71b0 telemetry: log structured tool and inference timing events 2026-07-02 10:55:05 -07:00
Michael Bolin 4f1b5a4b73 app-server: structure and test JSON shutdown logs (#30314)
## Why

`LOG_FORMAT=json` and `RUST_LOG` are supported by app-server, but the
behavior was only covered indirectly. We should verify the actual JSONL
written by both user-facing entry points: `codex app-server` and the
standalone `codex-app-server` binary.

The existing processor shutdown message also always said the channel
closed, even though the processor can exit for several different
reasons. Structured fields make that event more accurate and useful to
log consumers.

## What changed

- Record the processor `exit_reason`, remaining connection count, and
forced-shutdown state as structured tracing fields.
- Add a shared process-test helper that enables JSON logging, validates
every stderr line as JSON, and verifies the top-level timestamp is RFC
3339.
- Cover both `codex app-server` and `codex-app-server`, asserting the
stable `level`, `fields`, and `target` payload.

## Test plan

- `just test -p codex-app-server
standalone_app_server_emits_json_info_events`
- `just test -p codex-cli app_server_emits_json_info_events`
2026-06-26 18:19:56 -07:00