log plugin MCP server names (#26002)

## Summary
- emit the plugin capability summary's exact MCP server names in
`codex_plugin_used`

## Test
- `just test -p codex-analytics`
- `just test -p codex-core
explicit_plugin_mentions_track_plugin_used_analytics`
- `just fix -p codex-analytics`
This commit is contained in:
Chris Dong authored and GitHub committed 2026-06-03 16:06:52 -07:00
1 parent 0ed2735d19
commit 4d4837c495
3 files changed
+11

No files matched your search

@@ -2828,6 +2828,7 @@ fn plugin_used_event_serializes_expected_shape() {
"mcp_server_count": 2, "mcp_server_count": 2,
"connector_ids": ["calendar", "drive"], "connector_ids": ["calendar", "drive"],
"product_client_id": originator().value, "product_client_id": originator().value,
"mcp_server_names": ["mcp-1", "mcp-2"],
"thread_id": "thread-3", "thread_id": "thread-3",
"turn_id": "turn-3", "turn_id": "turn-3",
"model_slug": "gpt-5" "model_slug": "gpt-5"
+6
View File
@@ -865,6 +865,7 @@ pub(crate) struct CodexPluginMetadata {
pub(crate) struct CodexPluginUsedMetadata { pub(crate) struct CodexPluginUsedMetadata {
#[serde(flatten)] #[serde(flatten)]
pub(crate) plugin: CodexPluginMetadata, pub(crate) plugin: CodexPluginMetadata,
pub(crate) mcp_server_names: Option<Vec<String>>,
pub(crate) thread_id: Option<String>, pub(crate) thread_id: Option<String>,
pub(crate) turn_id: Option<String>, pub(crate) turn_id: Option<String>,
pub(crate) model_slug: Option<String>, pub(crate) model_slug: Option<String>,
@@ -971,8 +972,13 @@ pub(crate) fn codex_plugin_used_metadata(
tracking: &TrackEventsContext, tracking: &TrackEventsContext,
plugin: PluginTelemetryMetadata, plugin: PluginTelemetryMetadata,
) -> CodexPluginUsedMetadata { ) -> CodexPluginUsedMetadata {
let mcp_server_names = plugin
.capability_summary
.as_ref()
.map(|summary| summary.mcp_server_names.clone());
CodexPluginUsedMetadata { CodexPluginUsedMetadata {
plugin: codex_plugin_metadata(plugin), plugin: codex_plugin_metadata(plugin),
mcp_server_names,
thread_id: Some(tracking.thread_id.clone()), thread_id: Some(tracking.thread_id.clone()),
turn_id: Some(tracking.turn_id.clone()), turn_id: Some(tracking.turn_id.clone()),
model_slug: Some(tracking.model_slug.clone()), model_slug: Some(tracking.model_slug.clone()),
+4
View File
@@ -388,6 +388,10 @@ async fn explicit_plugin_mentions_track_plugin_used_analytics() -> Result<()> {
assert_eq!(event["event_params"]["marketplace_name"], "test"); assert_eq!(event["event_params"]["marketplace_name"], "test");
assert_eq!(event["event_params"]["has_skills"], true); assert_eq!(event["event_params"]["has_skills"], true);
assert_eq!(event["event_params"]["mcp_server_count"], 0); assert_eq!(event["event_params"]["mcp_server_count"], 0);
assert_eq!(
event["event_params"]["mcp_server_names"],
serde_json::json!([])
);
assert_eq!( assert_eq!(
event["event_params"]["connector_ids"], event["event_params"]["connector_ids"],
serde_json::json!([]) serde_json::json!([])