[plugins] Track plugin install requests by ID (#29684)

Summary
- Emit `codex_plugin_install_requested` when a validated plugin install
request is made, before the user accepts or declines the elicitation.
- Record the exact model-visible plugin ID, remote plugin ID, required
connector IDs, stable suggestion ID, and `endpoint_recommendation` vs
`legacy_discovery` source.
- Keep `suggest_reason` out of telemetry and leave connector-only
install requests unchanged.

Rollout
- Backend/schema dependency:
https://github.com/openai/openai/pull/1065270
- Land the backend PR before this producer starts sending the event.

Validation
- `just test -p codex-analytics` (83 passed)
- `just test -p codex-core request_plugin_install` (17 passed)
- `just fix -p codex-analytics`
- `just fix -p codex-core`
- `just fmt`
- `git diff --check`
This commit is contained in:
Alex Daley authored and GitHub committed 2026-06-24 21:29:11 +00:00
1 parent df1ee09ec5
commit 24423f5712
8 files changed
+266 -2

No files matched your search

+28
View File
@@ -508,6 +508,7 @@ pub(crate) enum CustomAnalyticsFact {
AppUsed(AppUsedInput),
HookRun(HookRunInput),
PluginUsed(PluginUsedInput),
PluginInstallRequested(PluginInstallRequestedInput),
PluginStateChanged(PluginStateChangedInput),
PluginInstallFailed(PluginInstallFailedInput),
ExternalAgentConfigImportCompleted(ExternalAgentConfigImportCompletedInput),
@@ -545,6 +546,33 @@ pub(crate) struct PluginUsedInput {
pub plugin: PluginTelemetryMetadata,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum PluginInstallRequestSource {
EndpointRecommendation,
LegacyDiscovery,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PluginInstallRequested {
pub suggestion_id: String,
pub plugins: Vec<PluginInstallRequestedPlugin>,
pub source: PluginInstallRequestSource,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PluginInstallRequestedPlugin {
pub plugin_id: String,
pub remote_plugin_id: Option<String>,
pub plugin_name: String,
pub connector_ids: Vec<String>,
}
pub(crate) struct PluginInstallRequestedInput {
pub tracking: TrackEventsContext,
pub request: PluginInstallRequested,
}
pub(crate) struct PluginStateChangedInput {
pub plugin: PluginTelemetryMetadata,
pub state: PluginState,