aKode fase 2c: eliminato il codice di invio dati (crate analytics, otel-trace-websocket, sentry, esportatori OTLP); /feedback salva solo in locale; chiavi legacy [analytics]/[otel] accettate e ignorate; test di analytics/OTLP/upload rimossi
Some checks failed
blocking-ci / rust-ci (push) Has been cancelled
blocking-ci / sdk (push) Has been cancelled
blocking-ci / CI required (push) Has been cancelled
blocking-ci / Bazel (push) Has been cancelled
blocking-ci / Blob size policy (push) Has been cancelled
blocking-ci / cargo-deny (push) Has been cancelled
blocking-ci / Codespell (push) Has been cancelled
blocking-ci / repo-checks (push) Has been cancelled
postmerge-ci / rust-ci-full (push) Has been cancelled
postmerge-ci / v8-canary (push) Has been cancelled
postmerge-ci / Postmerge CI results (push) Has been cancelled

This commit is contained in:
Andrea
2026-11-09 18:45:41 +01:00
parent 981745ccc8
commit 60532b6337
509 changed files with 2043 additions and 46606 deletions

View File

@@ -91,8 +91,6 @@ use crate::store::PluginInstallResult as StorePluginInstallResult;
use crate::store::PluginStore;
use crate::store::PluginStoreError;
use crate::tool_suggest_metadata::ToolSuggestMetadataCache;
use codex_analytics::AnalyticsEventsClient;
use codex_analytics::PluginInstallSource;
use codex_config::ConfigLayerStack;
use codex_config::SkillConfigRules;
use codex_config::clear_user_plugin;
@@ -322,7 +320,7 @@ enum RemoteInstalledPluginsCachePublication {
/// remote plugin mutations.
///
/// Callers should keep this guard only while mutating the remote plugin cache and backend
/// installed state, then release it before unrelated analytics, OAuth, or runtime refresh work.
/// installed state, then release it before unrelated OAuth or runtime refresh work.
struct RemoteInstalledPluginSyncGuard {
_permit: OwnedSemaphorePermit,
}
@@ -595,8 +593,6 @@ pub struct PluginsManager {
restriction_product: Option<Product>,
auth_manager: Arc<AuthManager>,
runtime_auth: RuntimeAuthSlot,
analytics_events_client: RwLock<Option<AnalyticsEventsClient>>,
plugin_install_source: PluginInstallSource,
}
#[derive(Clone)]
@@ -737,7 +733,6 @@ impl PluginsManager {
runtime_auth,
Arc::clone(&self.skill_root_loader),
)
.with_plugin_install_source(self.plugin_install_source)
}
pub fn new(
@@ -803,16 +798,9 @@ impl PluginsManager {
restriction_product,
auth_manager,
runtime_auth,
analytics_events_client: RwLock::new(None),
plugin_install_source: PluginInstallSource::Manual,
}
}
pub fn with_plugin_install_source(mut self, source: PluginInstallSource) -> Self {
self.plugin_install_source = source;
self
}
pub fn auth_mode(&self) -> Option<AuthMode> {
self.auth_manager.get_api_auth_mode()
}
@@ -821,14 +809,6 @@ impl PluginsManager {
config.remote_plugin_enabled && self.auth_mode().is_some_and(AuthMode::uses_codex_backend)
}
pub fn set_analytics_events_client(&self, analytics_events_client: AnalyticsEventsClient) {
let mut stored_client = match self.analytics_events_client.write() {
Ok(client_guard) => client_guard,
Err(err) => err.into_inner(),
};
*stored_client = Some(analytics_events_client);
}
fn restriction_product_matches(&self, products: Option<&[Product]>) -> bool {
match products {
None => true,
@@ -2293,15 +2273,6 @@ impl PluginsManager {
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,
);
}
}
@@ -2319,31 +2290,6 @@ 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(
plugin,
self.plugin_install_source,
error_type.to_string(),
sub_error_type,
);
}
}
async fn install_resolved_plugin(
@@ -2404,17 +2350,6 @@ impl PluginsManager {
.await
.map_err(anyhow::Error::from)?;
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_installed(
self.telemetry_metadata_for_installed_plugin(&result.plugin_id)
.await,
);
}
Ok(PluginInstallOutcome {
plugin_id: result.plugin_id,
plugin_version: result.plugin_version,
@@ -2450,14 +2385,6 @@ impl PluginsManager {
}
async fn uninstall_plugin_id(&self, plugin_id: PluginId) -> Result<(), PluginUninstallError> {
let plugin_telemetry = if self.store.active_plugin_root(&plugin_id).is_some() {
Some(
self.telemetry_metadata_for_installed_plugin(&plugin_id)
.await,
)
} else {
None
};
let store = self.store.clone();
let plugin_id_for_store = plugin_id.clone();
tokio::task::spawn_blocking(move || store.uninstall(&plugin_id_for_store))
@@ -2468,16 +2395,6 @@ impl PluginsManager {
.await
.map_err(anyhow::Error::from)?;
let analytics_events_client = match self.analytics_events_client.read() {
Ok(client) => client.clone(),
Err(err) => err.into_inner().clone(),
};
if let Some(plugin_telemetry) = plugin_telemetry
&& let Some(analytics_events_client) = analytics_events_client
{
analytics_events_client.track_plugin_uninstalled(plugin_telemetry);
}
Ok(())
}