mirror of
https://github.com/openai/codex.git
synced 2026-11-25 15:24:26 +00:00
Track Guardian reviewer turn and tool analytics (#41023)
## Why Trusted Guardian reviewer sessions can emit events without an app-server listener, leaving their turns and tool usage absent from analytics. ## What changed - Translate Guardian session lifecycle and canonical tool item events into analytics notifications while excluding messages, reasoning, and review content. - Preserve Guardian lineage during prewarming even when inherited client metadata is not yet available, without emitting an incomplete thread initialization event. - Limit direct session tracking to trusted Guardian children so resumed threads that have an app-server listener do not report duplicate events. ## Testing - Cover completed, failed, and interrupted Guardian turns, tool counts and timing, lineage, content exclusion, prewarmed lineage, and resumed-thread deduplication. GitOrigin-RevId: 70ace5f7ed30a7e3b6a9d6097c8b2a6a326dc4f7
This commit is contained in:
1 parent
81e180044d
commit
307ce6cda9
10 files changed
+467
-28
No files matched your search
@@ -1091,9 +1091,13 @@ impl AnalyticsReducer {
|
||||
if thread_state.connection_id.is_none() {
|
||||
thread_state.connection_id = parent_connection_id;
|
||||
}
|
||||
out.push(TrackEventRequest::ThreadInitialized(
|
||||
subagent_thread_started_event_request(input),
|
||||
));
|
||||
// Guardian prewarm can register lineage before parent client metadata is set.
|
||||
// Keep the existing completeness requirement for the initialization event.
|
||||
if input.client_name.is_some() && input.client_version.is_some() {
|
||||
out.push(TrackEventRequest::ThreadInitialized(
|
||||
subagent_thread_started_event_request(input),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
fn ingest_guardian_review(
|
||||
@@ -2427,7 +2431,7 @@ fn warn_missing_analytics_context(
|
||||
);
|
||||
}
|
||||
|
||||
fn tracked_tool_item_id(item: &ThreadItem) -> Option<&str> {
|
||||
pub(crate) fn tracked_tool_item_id(item: &ThreadItem) -> Option<&str> {
|
||||
match item {
|
||||
ThreadItem::CommandExecution { id, .. }
|
||||
| ThreadItem::FileChange { id, .. }
|
||||
|
||||
Reference in new issue
Block a user