Correlate image requests and explicit interrupts with turns (#36092)

## What changed

- Send the active turn ID in the `x-codex-image-turn-id` header for image generation and edit requests.
- Add `explicit_client_interrupt_requested_at_ms` to turn analytics. Record the earliest explicit interrupt request that receives a successful response, while excluding rejected requests.
- Track errors returned by `turn/interrupt` so pending analytics state is cleaned up correctly.

## Testing

- Cover turn ID headers for image generation and editing.
- Cover accepted, retried, and rejected explicit interrupt requests in analytics tests.

GitOrigin-RevId: 80fe996a161b4952b79c5c38238f75b7661b92af
This commit is contained in:
alicec-oai authored and copyberry committed 2026-07-30 05:53:21 +00:00
1 parent 88ec932e96
commit 6219b7c40f
10 files changed
+365 -17

No files matched your search

+3
View File
@@ -897,6 +897,9 @@ pub(crate) struct CodexTurnEventParams {
pub(crate) num_input_images: usize,
pub(crate) is_first_turn: bool,
pub(crate) status: Option<TurnStatus>,
/// Client wall-clock time for the first non-startup turn/interrupt request
/// that later received a successful response.
pub(crate) explicit_client_interrupt_requested_at_ms: Option<u64>,
pub(crate) turn_error: Option<CodexErrorInfo>,
pub(crate) codex_error_kind: Option<CodexErrKind>,
pub(crate) codex_error_http_status_code: Option<u16>,