Send plugin analytics with API key authentication (#33040)

## What changed

Allow API key sessions to send plugin-attributed `codex_plugin_used`,
`skill_invocation`, and `codex_mcp_tool_call_event` events. Continue to drop
events without a plugin ID and all other analytics events for these sessions.

## Testing

Add coverage that mixes plugin and non-plugin events and verifies that only the
three plugin-attributed event types are delivered without server-owned auth
fields.

GitOrigin-RevId: 1f47af5e9516723154f566ad032dba3ebd98abf9
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-07-14 11:21:25 +00:00
1 parent 4aa950d456
commit 5bed644799
3 files changed
+194 -4

No files matched your search

+7 -2
View File
@@ -555,7 +555,7 @@ impl AnalyticsEventsClient {
async fn send_track_events(
auth_manager: &AuthManager,
destination: &AnalyticsEventsDestination,
events: Vec<TrackEventRequest>,
mut events: Vec<TrackEventRequest>,
) {
if events.is_empty() {
return;
@@ -564,7 +564,12 @@ async fn send_track_events(
let Some(auth) = auth_manager.auth().await else {
return;
};
if !auth.uses_codex_backend() {
if auth.is_api_key_auth() {
events.retain(TrackEventRequest::can_send_with_api_key_auth);
} else if !auth.uses_codex_backend() {
return;
}
if events.is_empty() {
return;
}