mirror of
https://github.com/openai/codex.git
synced 2026-11-23 15:18:14 +00:00
Track multi-agent v2 spawn calls in analytics (#39722)
## What changed - Emit started and completed collaboration tool events for multi-agent v2 `spawn_agent` calls, including failed invocations. - Record execution duration and successful child-agent configuration metadata without including the spawn prompt. - Deduplicate collaboration and subagent activity items by call ID when calculating per-turn subagent tool counts. ## Testing - Extend the app-server multi-agent v2 integration test to cover successful and failed spawn telemetry, duration, prompt omission, and turn counts. GitOrigin-RevId: c1c2fb9cc2a1a9b0f63ef68509ad36d11a92d1e5
This commit is contained in:
1 parent
1674b0a130
commit
9894a14c81
4 files changed
+182
-11
No files matched your search
@@ -41,6 +41,8 @@ use crate::reducer::valid_plugin_measurement_row;
|
||||
use codex_app_server_protocol::ClientRequest;
|
||||
use codex_app_server_protocol::ClientResponsePayload;
|
||||
use codex_app_server_protocol::InitializeParams;
|
||||
use codex_app_server_protocol::ItemCompletedNotification;
|
||||
use codex_app_server_protocol::ItemStartedNotification;
|
||||
use codex_app_server_protocol::JSONRPCErrorError;
|
||||
use codex_app_server_protocol::RequestId;
|
||||
use codex_app_server_protocol::ServerNotification;
|
||||
@@ -51,6 +53,9 @@ use codex_login::CodexAuth;
|
||||
use codex_login::default_client::create_client;
|
||||
use codex_plugin::PluginId;
|
||||
use codex_plugin::PluginTelemetryMetadata;
|
||||
use codex_protocol::items::CollabAgentToolCallItem;
|
||||
use codex_protocol::items::CollabAgentToolCallStatus;
|
||||
use codex_protocol::items::TurnItem;
|
||||
use codex_protocol::request_permissions::RequestPermissionsResponse;
|
||||
use std::collections::HashSet;
|
||||
use std::path::PathBuf;
|
||||
@@ -330,6 +335,33 @@ impl AnalyticsEventsClient {
|
||||
));
|
||||
}
|
||||
|
||||
pub fn track_collab_tool_call(
|
||||
&self,
|
||||
turn_id: String,
|
||||
mut item: CollabAgentToolCallItem,
|
||||
started_at_ms: i64,
|
||||
completed_at_ms: i64,
|
||||
) {
|
||||
let thread_id = item.sender_thread_id.to_string();
|
||||
let completed_item = TurnItem::CollabAgentToolCall(item.clone()).into();
|
||||
item.status = CollabAgentToolCallStatus::InProgress;
|
||||
|
||||
self.track_notification(&ServerNotification::ItemStarted(ItemStartedNotification {
|
||||
item: TurnItem::CollabAgentToolCall(item).into(),
|
||||
thread_id: thread_id.clone(),
|
||||
turn_id: turn_id.clone(),
|
||||
started_at_ms,
|
||||
}));
|
||||
self.track_notification(&ServerNotification::ItemCompleted(
|
||||
ItemCompletedNotification {
|
||||
item: completed_item,
|
||||
thread_id,
|
||||
turn_id,
|
||||
completed_at_ms,
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
pub fn track_code_mode_tool_call(&self, input: crate::facts::CodeModeToolCallFact) {
|
||||
self.record_fact(AnalyticsFact::Custom(
|
||||
CustomAnalyticsFact::CodeModeToolCall(input),
|
||||
|
||||
Reference in new issue
Block a user