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

+9
View File
@@ -95,6 +95,15 @@ impl TrackEventRequest {
pub(crate) fn should_send_in_isolated_request(&self) -> bool {
matches!(self, Self::AcceptedLineFingerprints(_))
}
pub(crate) fn can_send_with_api_key_auth(&self) -> bool {
match self {
Self::PluginUsed(event) => event.event_params.plugin.plugin_id.is_some(),
Self::SkillInvocation(event) => event.event_params.plugin_id.is_some(),
Self::McpToolCall(event) => event.event_params.plugin_id.is_some(),
_ => false,
}
}
}
#[derive(Serialize)]