From e8b35201fea375d3edb7cab9727de5d979c238cd Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Tue, 24 Mar 2026 23:47:18 -0700 Subject: [PATCH] fix --- codex-rs/Cargo.lock | 1 + codex-rs/core-skills/Cargo.toml | 1 + codex-rs/core-skills/src/skills/remote.rs | 16 +++++++-------- codex-rs/core/src/analytics_client.rs | 24 +++++++++++------------ codex-rs/core/src/plugins/manager.rs | 6 ++---- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/codex-rs/Cargo.lock b/codex-rs/Cargo.lock index 189ae1983a..eef8be97a3 100644 --- a/codex-rs/Cargo.lock +++ b/codex-rs/Cargo.lock @@ -1981,6 +1981,7 @@ dependencies = [ "anyhow", "codex-app-server-protocol", "codex-config", + "codex-login", "codex-otel", "codex-protocol", "codex-skills", diff --git a/codex-rs/core-skills/Cargo.toml b/codex-rs/core-skills/Cargo.toml index 7a7fbc3573..484ed7d2b5 100644 --- a/codex-rs/core-skills/Cargo.toml +++ b/codex-rs/core-skills/Cargo.toml @@ -16,6 +16,7 @@ workspace = true anyhow = { workspace = true } codex-app-server-protocol = { workspace = true } codex-config = { workspace = true } +codex-login = { workspace = true } codex-otel = { workspace = true } codex-protocol = { workspace = true } codex-skills = { workspace = true } diff --git a/codex-rs/core-skills/src/skills/remote.rs b/codex-rs/core-skills/src/skills/remote.rs index 165c450635..2dc620b864 100644 --- a/codex-rs/core-skills/src/skills/remote.rs +++ b/codex-rs/core-skills/src/skills/remote.rs @@ -6,9 +6,8 @@ use std::path::Path; use std::path::PathBuf; use std::time::Duration; -use crate::auth::CodexAuth; -use crate::config::Config; -use crate::default_client::build_reqwest_client; +use codex_login::CodexAuth; +use codex_login::default_client::build_reqwest_client; const REMOTE_SKILLS_API_TIMEOUT: Duration = Duration::from_secs(30); @@ -88,13 +87,13 @@ struct RemoteSkill { } pub async fn list_remote_skills( - config: &Config, + chatgpt_base_url: String, auth: Option<&CodexAuth>, scope: RemoteSkillScope, product_surface: RemoteSkillProductSurface, enabled: Option, ) -> Result> { - let base_url = config.chatgpt_base_url.trim_end_matches('/'); + let base_url = chatgpt_base_url.trim_end_matches('/'); let auth = ensure_chatgpt_auth(auth)?; let url = format!("{base_url}/hazelnuts"); @@ -146,14 +145,15 @@ pub async fn list_remote_skills( } pub async fn export_remote_skill( - config: &Config, + chatgpt_base_url: String, + codex_home: PathBuf, auth: Option<&CodexAuth>, skill_id: &str, ) -> Result { let auth = ensure_chatgpt_auth(auth)?; let client = build_reqwest_client(); - let base_url = config.chatgpt_base_url.trim_end_matches('/'); + let base_url = chatgpt_base_url.trim_end_matches('/'); let url = format!("{base_url}/hazelnuts/{skill_id}/export"); let mut request = client.get(&url).timeout(REMOTE_SKILLS_API_TIMEOUT); @@ -181,7 +181,7 @@ pub async fn export_remote_skill( anyhow::bail!("Downloaded remote skill payload is not a zip archive"); } - let output_dir = config.codex_home.join("skills").join(skill_id); + let output_dir = codex_home.join("skills").join(skill_id); tokio::fs::create_dir_all(&output_dir) .await .context("Failed to create downloaded skills directory")?; diff --git a/codex-rs/core/src/analytics_client.rs b/codex-rs/core/src/analytics_client.rs index cf4781a5c0..2506080878 100644 --- a/codex-rs/core/src/analytics_client.rs +++ b/codex-rs/core/src/analytics_client.rs @@ -186,7 +186,7 @@ impl AnalyticsEventsClient { } pub(crate) fn track_app_used(&self, tracking: TrackEventsContext, app: AppInvocation) { - track_app_used(&self.queue, Arc::clone(&self.config), Some(tracking), app); + track_app_used(&self.queue, self.analytics_enabled, Some(tracking), app); } pub(crate) fn track_plugin_used( @@ -196,7 +196,7 @@ impl AnalyticsEventsClient { ) { track_plugin_used( &self.queue, - Arc::clone(&self.config), + self.analytics_enabled, Some(tracking), plugin, ); @@ -205,7 +205,7 @@ impl AnalyticsEventsClient { pub fn track_plugin_installed(&self, plugin: PluginTelemetryMetadata) { track_plugin_management( &self.queue, - Arc::clone(&self.config), + self.analytics_enabled, PluginManagementEventType::Installed, plugin, ); @@ -214,7 +214,7 @@ impl AnalyticsEventsClient { pub fn track_plugin_uninstalled(&self, plugin: PluginTelemetryMetadata) { track_plugin_management( &self.queue, - Arc::clone(&self.config), + self.analytics_enabled, PluginManagementEventType::Uninstalled, plugin, ); @@ -223,7 +223,7 @@ impl AnalyticsEventsClient { pub fn track_plugin_enabled(&self, plugin: PluginTelemetryMetadata) { track_plugin_management( &self.queue, - Arc::clone(&self.config), + self.analytics_enabled, PluginManagementEventType::Enabled, plugin, ); @@ -232,7 +232,7 @@ impl AnalyticsEventsClient { pub fn track_plugin_disabled(&self, plugin: PluginTelemetryMetadata) { track_plugin_management( &self.queue, - Arc::clone(&self.config), + self.analytics_enabled, PluginManagementEventType::Disabled, plugin, ); @@ -430,11 +430,11 @@ pub(crate) fn track_app_mentioned( pub(crate) fn track_app_used( queue: &AnalyticsEventsQueue, - config: Arc, + analytics_enabled: Option, tracking: Option, app: AppInvocation, ) { - if config.analytics_enabled == Some(false) { + if analytics_enabled == Some(false) { return; } let Some(tracking) = tracking else { @@ -453,11 +453,11 @@ pub(crate) fn track_app_used( pub(crate) fn track_plugin_used( queue: &AnalyticsEventsQueue, - config: Arc, + analytics_enabled: Option, tracking: Option, plugin: PluginTelemetryMetadata, ) { - if config.analytics_enabled == Some(false) { + if analytics_enabled == Some(false) { return; } let Some(tracking) = tracking else { @@ -476,7 +476,7 @@ pub(crate) fn track_plugin_used( fn track_plugin_management( queue: &AnalyticsEventsQueue, - config: Arc, + analytics_enabled: Option, event_type: PluginManagementEventType, plugin: PluginTelemetryMetadata, ) { @@ -683,7 +683,7 @@ fn codex_plugin_used_metadata( async fn send_track_events( auth_manager: &AuthManager, - config: Arc, + analytics_enabled: Option, events: Vec, ) { if events.is_empty() { diff --git a/codex-rs/core/src/plugins/manager.rs b/codex-rs/core/src/plugins/manager.rs index 827cc8d61f..009760fe86 100644 --- a/codex-rs/core/src/plugins/manager.rs +++ b/codex-rs/core/src/plugins/manager.rs @@ -206,9 +206,7 @@ impl LoadedPlugin { } } -fn plugin_capability_summary_from_loaded( - plugin: &LoadedPlugin, -) -> Option { +fn plugin_capability_summary_from_loaded(plugin: &LoadedPlugin) -> Option { if !plugin.is_active() { return None; } @@ -285,7 +283,7 @@ impl PluginLoadOutcome { fn from_plugins(plugins: Vec) -> Self { let capability_summaries = plugins .iter() - .filter_map(PluginCapabilitySummary::from_plugin) + .filter_map(plugin_capability_summary_from_loaded) .collect::>(); Self { plugins,