mirror of
https://github.com/openai/codex.git
synced 2026-12-04 00:51:02 +00:00
Trace capability discovery and cloud catalog refresh (#64917)
## What changed Add tracing spans for per-step plugin selection, host skill discovery, and V2 capability-root snapshots. The snapshot span records whether skill discovery was requested. Trace cloud catalog refresh and discovery, and time the step's wait for the catalog lock separately from preparation under the lock. GitOrigin-RevId: 12eeb6333a8d2b335e92112dc7dccae6e7ed266d
This commit is contained in:
@@ -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>,
|
||||
|
||||
@@ -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<Self>) -> anyhow::Result<()> {
|
||||
self.cloud_catalog_preparation
|
||||
.refresh_pending
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<'_>,
|
||||
|
||||
Reference in New Issue
Block a user