Report code mode host request durations (#41452)

## Why

Code mode wall time should measure the host operation itself, without including
client-side response delays or idle time between requests.

## What changed

- Measure each execute, wait, and terminate request in the code mode host.
- Carry the duration through the stdio and gRPC protocols and use it for
  model-visible wall time.
- Emit a structured `codex.code_mode.host_timing` event correlated with the
  conversation, turn, tool call, and cell.

## Testing

- Cover successful and failed execution timing, delayed response reads,
  repeated waits, termination, and missing cells across stdio and gRPC.
- Verify timing survives protocol serialization and is reflected in app-server
  model output and structured telemetry.

GitOrigin-RevId: d24af30c3fc5820521b4beba1f9970714dad6482
This commit is contained in:
Adam Perry @ OpenAI
2026-08-29 02:52:58 +00:00
committed by copyberry
parent 75388bf321
commit 48e22a5fa0
34 changed files with 1398 additions and 259 deletions
@@ -198,6 +198,12 @@ message ExecutionOutcome {
string cell_id = 1;
repeated ContentItem content_items = 2;
// Elapsed monotonic time from receipt of this Execute, Wait, or Terminate
// request until its outcome is ready, before serialization and delivery.
// Includes nested tool waits, but not background time between requests.
// Always supplied by the host; zero is a valid measurement.
uint64 code_mode_host_duration_ns = 6;
oneof outcome {
ExecutionYielded yielded = 3;
ExecutionTerminated terminated = 4;