mirror of
https://github.com/openai/codex.git
synced 2026-11-23 15:18:14 +00:00
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:
1 parent
88ec932e96
commit
6219b7c40f
10 files changed
+365
-17
No files matched your search
@@ -29,6 +29,7 @@ use crate::facts::TurnCodexErrorFact;
|
||||
use crate::facts::TurnProfileFact;
|
||||
use crate::facts::TurnResolvedConfigFact;
|
||||
use crate::facts::TurnTokenUsageFact;
|
||||
use crate::now_unix_millis;
|
||||
use crate::reducer::AnalyticsReducer;
|
||||
use codex_app_server_protocol::ClientRequest;
|
||||
use codex_app_server_protocol::ClientResponsePayload;
|
||||
@@ -312,6 +313,18 @@ impl AnalyticsEventsClient {
|
||||
request_id: RequestId,
|
||||
request: &ClientRequest,
|
||||
) {
|
||||
if let ClientRequest::TurnInterrupt { params, .. } = request {
|
||||
if params.turn_id.is_empty() {
|
||||
return;
|
||||
}
|
||||
self.record_fact(AnalyticsFact::ExplicitClientInterruptRequest {
|
||||
connection_id,
|
||||
request_id,
|
||||
turn_id: params.turn_id.clone(),
|
||||
requested_at_ms: now_unix_millis(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
if !matches!(
|
||||
request,
|
||||
ClientRequest::TurnStart { .. } | ClientRequest::TurnSteer { .. }
|
||||
@@ -519,6 +532,7 @@ impl AnalyticsEventsClient {
|
||||
| ClientResponsePayload::ThreadFork(_)
|
||||
| ClientResponsePayload::TurnStart(_)
|
||||
| ClientResponsePayload::TurnSteer(_)
|
||||
| ClientResponsePayload::TurnInterrupt(_)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user