[codex-analytics] add protocol-native turn timestamps

This commit is contained in:
rhan-oai
2026-04-06 13:50:42 -07:00
parent 9bb813353e
commit bab096c2b1
58 changed files with 1177 additions and 61 deletions
@@ -6611,6 +6611,9 @@ impl CodexMessageProcessor {
items: vec![],
error: None,
status: TurnStatus::InProgress,
started_at: None,
completed_at: None,
duration_ms: None,
};
let response = TurnStartResponse { turn };
@@ -6947,6 +6950,9 @@ impl CodexMessageProcessor {
items,
error: None,
status: TurnStatus::InProgress,
started_at: None,
completed_at: None,
duration_ms: None,
}
}
@@ -7365,10 +7371,10 @@ impl CodexMessageProcessor {
// Track the event before emitting any typed
// translations so thread-local state such as raw event
// opt-in stays synchronized with the conversation.
let raw_events_enabled = {
let (raw_events_enabled, completed_turn) = {
let mut thread_state = thread_state.lock().await;
thread_state.track_current_turn_event(&event.msg);
thread_state.experimental_raw_events
let completed_turn = thread_state.track_current_turn_event(&event.msg);
(thread_state.experimental_raw_events, completed_turn)
};
let subscribed_connection_ids = thread_state_manager
.subscribed_connection_ids(conversation_id)
@@ -7384,6 +7390,7 @@ impl CodexMessageProcessor {
);
apply_bespoke_event_handling(
event.clone(),
completed_turn,
conversation_id,
conversation.clone(),
thread_manager.clone(),
@@ -9596,6 +9603,7 @@ mod tests {
state.track_current_turn_event(&EventMsg::TurnStarted(
codex_protocol::protocol::TurnStartedEvent {
turn_id: "turn-1".to_string(),
started_at: None,
model_context_window: None,
collaboration_mode_kind: Default::default(),
},