Track WebSocket continuation modes and full-input send reasons (#46051)

## Why

Per-socket metrics label resends after reconnect as initial requests, obscuring why full input was sent. Client telemetry can preserve that reason across reconnect failures and turn boundaries.

## What changed

- Add `codex.websocket.continuation` to count `response.create` send attempts, including failed sends, with `mode`, `reason`, and `phase` tags.
- Distinguish incremental continuations, fresh requests, restored history, closed connections, and other full-input sends. Track warmup and generation separately.
- Preserve the first continuation reset reason until the next send and identify resumed or forked history.
- Allow session telemetry to use a `MetricsClient` supplied through thread extensions and document the counter's semantics.

## Testing

Add metric assertions for incremental reuse, warmup, changed requests, account switches, reconnects, and resumed or forked history. Add a unit test for preserving reset reasons across repeated resets and turn boundaries.

GitOrigin-RevId: 29324f5e9d5677e0c6068f89b2256a92a5a0d157
This commit is contained in:
vkg-oai authored and copyberry committed 2026-09-16 22:43:57 +00:00
1 parent 821ad43f9d
commit c56dda711c
7 files changed
+295 -70

No files matched your search

@@ -1,6 +1,6 @@
---
source: tui/src/app/tests/approvals_reviewer_error_tests.rs
assertion_line: 34
assertion_line: 36
expression: rendered
---
■ Failed to save approvals reviewer: config/batchWrite failed in TUI: config/batchWrite failed: failed to load configuration: <CODEX_HOME>/config.toml:1:24: unclosed array, expected `]` (code -32603)
■ Failed to save approvals reviewer: config/batchWrite failed in TUI: config/batchWrite failed: failed to load configuration: <CODEX_HOME>/config.toml:1:23: unclosed array, expected `]` (code -32603)