diff --git a/codex-rs/core/src/mcp.rs b/codex-rs/core/src/mcp.rs index 7b5a692fbf..32d1003117 100644 --- a/codex-rs/core/src/mcp.rs +++ b/codex-rs/core/src/mcp.rs @@ -260,6 +260,7 @@ impl McpManager { } /// Resolves only plugins from this step's ready roots, independent of shared MCP refresh. + #[tracing::instrument(name = "plugins.select_for_step", skip_all)] pub(crate) async fn selected_plugins_for_step<'a>( &self, context: McpServerContributionContext<'a, Config>, diff --git a/codex-rs/core/src/session/cloud_plugins.rs b/codex-rs/core/src/session/cloud_plugins.rs index b3c6a90780..ed5f6c6ddb 100644 --- a/codex-rs/core/src/session/cloud_plugins.rs +++ b/codex-rs/core/src/session/cloud_plugins.rs @@ -8,6 +8,7 @@ use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering; use tokio::sync::Mutex; use tokio::sync::MutexGuard; +use tracing::Instrument; #[derive(Default)] pub(super) struct CloudCatalogPreparation { @@ -47,11 +48,17 @@ impl Session { } pub(crate) async fn lock_cloud_catalogs(&self) -> MutexGuard<'_, CatalogRefreshState> { - let mut guard = self.cloud_catalog_preparation.refresh_lock.lock().await; + let mut guard = self + .cloud_catalog_preparation + .refresh_lock + .lock() + .instrument(tracing::info_span!("cloud_catalog.step.acquire_lock")) + .await; self.prepare_locked_catalogs(&mut guard); guard } + #[tracing::instrument(name = "cloud_catalog.prepare_locked", skip_all)] fn prepare_locked_catalogs(&self, catalogs: &mut CatalogRefreshState) { self.finish_catalog_startup(catalogs); if self @@ -67,6 +74,7 @@ impl Session { clippy::await_holding_invalid_type, reason = "catalog publication must remain serialized with step preparation" )] + #[tracing::instrument(name = "cloud_catalog.refresh", skip_all)] pub(crate) async fn refresh_cloud_plugins(self: &Arc) -> anyhow::Result<()> { self.cloud_catalog_preparation .refresh_pending diff --git a/codex-rs/core/src/session/executor_discovery.rs b/codex-rs/core/src/session/executor_discovery.rs index f951bd1f87..6efda22f30 100644 --- a/codex-rs/core/src/session/executor_discovery.rs +++ b/codex-rs/core/src/session/executor_discovery.rs @@ -85,6 +85,11 @@ impl Session { } /// Acquires V2 inventories and reports changes without scheduling an MCP refresh. + #[tracing::instrument( + name = "capability_roots.snapshot_for_step_v2", + skip_all, + fields(for_skills = skill_turn.is_some()) + )] pub(super) async fn executor_capability_discovery_for_step_v2( &self, config: &Config, diff --git a/codex-rs/core/src/skills.rs b/codex-rs/core/src/skills.rs index 5be89463e2..9e138b1935 100644 --- a/codex-rs/core/src/skills.rs +++ b/codex-rs/core/src/skills.rs @@ -88,6 +88,7 @@ pub(crate) struct HostSkillDiscovery { } impl Session { + #[tracing::instrument(name = "skills.host.snapshot_for_step", skip_all)] pub(crate) async fn host_skills_for_step( &self, turn: &TurnContext, diff --git a/codex-rs/ext/mcp/src/cloud_plugin.rs b/codex-rs/ext/mcp/src/cloud_plugin.rs index 20431aa59e..972ebf39a7 100644 --- a/codex-rs/ext/mcp/src/cloud_plugin.rs +++ b/codex-rs/ext/mcp/src/cloud_plugin.rs @@ -50,6 +50,7 @@ fn cloud_catalog_query( impl PluginContributor { /// Returns whether publishing or clearing a catalog requires MCP reprojection. + #[tracing::instrument(name = "plugins.cloud.refresh_cloud_catalog", level = "info", skip_all)] async fn discover_cloud_catalog( &self, state: &PluginsThreadState, diff --git a/codex-rs/ext/skills/src/preparation.rs b/codex-rs/ext/skills/src/preparation.rs index 564e202f66..efadad2dd4 100644 --- a/codex-rs/ext/skills/src/preparation.rs +++ b/codex-rs/ext/skills/src/preparation.rs @@ -82,6 +82,7 @@ async fn discover_executor_catalog( .await } +#[tracing::instrument(name = "skills.host.discover_catalog", skip_all)] async fn discover_host_catalog( providers: &SkillProviders, input: &StepPreparationInput<'_>,