mirror of
https://github.com/openai/codex.git
synced 2026-11-22 07:13:50 +00:00
Improve plugin install failure analytics (#37645)
## Why Plugin install failures need stable, low-cardinality details that distinguish actionable causes without relying on error messages. ## What changed - Add HTTP status subtypes for remote catalog, mutation, and bundle download failures, including specific common statuses and a general `http_5xx` bucket. - Emit failure analytics when a remote plugin is disabled by an administrator or unavailable under its install policy. - Preserve marketplace I/O, configuration, and task failure subtypes, including failures that occur before a plugin ID can be resolved. ## Testing Add app-server coverage for catalog and install HTTP failures, unavailable remote plugins, unreadable marketplace files, and oversized bundle error responses. GitOrigin-RevId: 71a4888c492d1806bf4ff92bebc48f40cfb89300
This commit is contained in:
1 parent
a875dd6b22
commit
94937de51b
8 files changed
+294
-12
No files matched your search
@@ -66,6 +66,7 @@ use crate::startup_sync::sync_openai_plugins_repo;
|
||||
use crate::store::PluginInstallResult as StorePluginInstallResult;
|
||||
use crate::store::PluginStore;
|
||||
use crate::store::PluginStoreError;
|
||||
use crate::store::error_context_sub_error_type;
|
||||
use crate::tool_suggest_metadata::ToolSuggestMetadataCache;
|
||||
use codex_analytics::AnalyticsEventsClient;
|
||||
use codex_analytics::PluginInstallSource;
|
||||
@@ -1555,6 +1556,7 @@ impl PluginsManager {
|
||||
}
|
||||
|
||||
fn track_plugin_install_resolution_failed(&self, err: &MarketplaceError) {
|
||||
let sub_error_type = marketplace_error_sub_error_type(err);
|
||||
let plugin_id = match err {
|
||||
MarketplaceError::PluginNotFound {
|
||||
plugin_name,
|
||||
@@ -1574,15 +1576,25 @@ impl PluginsManager {
|
||||
self.track_plugin_install_failed(
|
||||
&plugin_id,
|
||||
marketplace_error_type(err),
|
||||
/*sub_error_type*/ None,
|
||||
sub_error_type,
|
||||
err.to_string(),
|
||||
);
|
||||
} else {
|
||||
tracing::warn!(
|
||||
error_type = %marketplace_error_type(err),
|
||||
sub_error_type = sub_error_type.as_deref(),
|
||||
error = %err,
|
||||
"plugin install failed while resolving marketplace plugin"
|
||||
);
|
||||
self.emit_plugin_install_failed(
|
||||
PluginTelemetryMetadata {
|
||||
plugin_id: None,
|
||||
remote_plugin_id: None,
|
||||
capability_summary: None,
|
||||
},
|
||||
marketplace_error_type(err),
|
||||
sub_error_type,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1600,13 +1612,26 @@ impl PluginsManager {
|
||||
error = %error_message,
|
||||
"plugin install failed"
|
||||
);
|
||||
self.emit_plugin_install_failed(
|
||||
self.telemetry_metadata_for_plugin_id(plugin_id),
|
||||
error_type,
|
||||
sub_error_type,
|
||||
);
|
||||
}
|
||||
|
||||
fn emit_plugin_install_failed(
|
||||
&self,
|
||||
plugin: PluginTelemetryMetadata,
|
||||
error_type: &'static str,
|
||||
sub_error_type: Option<String>,
|
||||
) {
|
||||
let analytics_events_client = match self.analytics_events_client.read() {
|
||||
Ok(client) => client.clone(),
|
||||
Err(err) => err.into_inner().clone(),
|
||||
};
|
||||
if let Some(analytics_events_client) = analytics_events_client {
|
||||
analytics_events_client.track_plugin_install_failed(
|
||||
self.telemetry_metadata_for_plugin_id(plugin_id),
|
||||
plugin,
|
||||
self.plugin_install_source,
|
||||
error_type.to_string(),
|
||||
sub_error_type,
|
||||
@@ -3053,8 +3078,11 @@ impl PluginInstallError {
|
||||
|
||||
pub fn sub_error_type(&self) -> Option<String> {
|
||||
match self {
|
||||
Self::Marketplace(err) => marketplace_error_sub_error_type(err),
|
||||
Self::Remote(err) => err.sub_error_type(),
|
||||
Self::Store(err) => err.sub_error_type(),
|
||||
Self::Marketplace(_) | Self::Remote(_) | Self::Config(_) | Self::Join(_) => None,
|
||||
Self::Config(_) => Some("failed_to_enable_plugin".to_string()),
|
||||
Self::Join(_) => Some("plugin_install_task_failed".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3081,6 +3109,18 @@ fn marketplace_error_type(err: &MarketplaceError) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
fn marketplace_error_sub_error_type(err: &MarketplaceError) -> Option<String> {
|
||||
match err {
|
||||
MarketplaceError::Io { context, .. } => Some(error_context_sub_error_type(context)),
|
||||
MarketplaceError::MarketplaceNotFound { .. }
|
||||
| MarketplaceError::InvalidMarketplaceFile { .. }
|
||||
| MarketplaceError::PluginNotFound { .. }
|
||||
| MarketplaceError::PluginNotAvailable { .. }
|
||||
| MarketplaceError::PluginsDisabled
|
||||
| MarketplaceError::InvalidPlugin(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn remote_plugin_mutation_error_type(err: &RemotePluginMutationError) -> &'static str {
|
||||
match err {
|
||||
RemotePluginMutationError::AuthRequired => "remote_mutation_auth_required",
|
||||
|
||||
Reference in new issue
Block a user