mirror of
https://github.com/openai/codex.git
synced 2026-12-04 00:51:02 +00:00
Instrument environment and plugin resolution paths (#33223)
## What changed Add named tracing spans around step environment snapshots, capability and executor plugin resolution, `AGENTS.md` refreshes, and MCP runtime projection and refresh operations. Skip recording function arguments to keep these spans focused on timing and execution flow. GitOrigin-RevId: 73a452ef1b5da6f7f2b00d24421a815c5d514eaf
This commit is contained in:
committed by
copyberry
parent
3f74f00295
commit
35b33e4304
Generated
+1
@@ -2628,6 +2628,7 @@ dependencies = [
|
||||
"codex-utils-path-uri",
|
||||
"serde_json",
|
||||
"thiserror 2.0.18",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -105,6 +105,7 @@ impl ExecutorPluginProvider {
|
||||
}
|
||||
|
||||
/// Resolves a plugin and retains the exact filesystem used for package access.
|
||||
#[tracing::instrument(name = "plugins.executor.package.resolve", skip_all)]
|
||||
pub async fn resolve_bound(
|
||||
&self,
|
||||
selected_root: &SelectedCapabilityRoot,
|
||||
|
||||
@@ -28,6 +28,7 @@ impl AgentsMdManager {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "agents_md.refresh", skip_all)]
|
||||
pub(crate) async fn refresh(&self, config: &Config, environments: &TurnEnvironmentSnapshot) {
|
||||
let selections = environments.to_selections();
|
||||
if self.cache.lock().await.selections.as_ref() == Some(&selections) {
|
||||
|
||||
@@ -195,6 +195,7 @@ impl ThreadEnvironments {
|
||||
.boxed()
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "environments.snapshot", skip_all)]
|
||||
pub(crate) async fn snapshot(&self) -> TurnEnvironmentSnapshot {
|
||||
let current = self.environments.load_full();
|
||||
let mut turn_environments = Vec::with_capacity(current.len());
|
||||
|
||||
@@ -100,6 +100,7 @@ impl McpManager {
|
||||
.config
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "mcp.runtime_config.project_for_step", skip_all)]
|
||||
pub(crate) async fn runtime_config_for_step(
|
||||
&self,
|
||||
config: &Config,
|
||||
|
||||
@@ -109,6 +109,7 @@ impl Session {
|
||||
clippy::await_holding_invalid_type,
|
||||
reason = "MCP runtime comparison and publication must remain serialized"
|
||||
)]
|
||||
#[tracing::instrument(name = "mcp.runtime.resolve_for_step", skip_all)]
|
||||
pub(crate) async fn mcp_runtime_for_step(
|
||||
self: &Arc<Self>,
|
||||
turn_context: &TurnContext,
|
||||
@@ -319,6 +320,7 @@ impl Session {
|
||||
.await
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "mcp.runtime.refresh", skip_all)]
|
||||
async fn refresh_mcp_servers_inner(
|
||||
&self,
|
||||
turn_context: &TurnContext,
|
||||
|
||||
@@ -118,6 +118,7 @@ impl EnvironmentManager {
|
||||
/// environment captured for the step carries its exact process-local handle so readiness and
|
||||
/// execution cannot come from different registry snapshots. Missing, starting, or failed
|
||||
/// environments are omitted. A lazy environment is started for a later step.
|
||||
#[tracing::instrument(name = "capability_roots.resolve", skip_all)]
|
||||
pub async fn resolve_selected_capability_roots(
|
||||
&self,
|
||||
selected_roots: &[SelectedCapabilityRoot],
|
||||
|
||||
@@ -20,3 +20,4 @@ codex-plugin = { workspace = true }
|
||||
codex-utils-path-uri = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
||||
@@ -31,6 +31,7 @@ pub enum ExecutorPluginConnectorProviderError {
|
||||
|
||||
impl ExecutorPluginConnectorProvider {
|
||||
/// Returns the connector declarations contributed by `plugin`.
|
||||
#[tracing::instrument(name = "connectors.executor_plugin.declarations.load", skip_all)]
|
||||
pub async fn load(
|
||||
&self,
|
||||
plugin: &ResolvedExecutorPlugin,
|
||||
|
||||
@@ -58,6 +58,7 @@ impl SelectedExecutorPluginMcpContributor {
|
||||
/// Successful resolution, including a root that is not a plugin or declares no capabilities,
|
||||
/// is cached until the thread state is dropped. Environment availability never invalidates
|
||||
/// this cache; it only controls whether the cached metadata is projected into a model step.
|
||||
#[tracing::instrument(name = "mcp.executor_plugin.metadata.load", skip_all)]
|
||||
async fn metadata_for_root(
|
||||
&self,
|
||||
state: &SelectedExecutorPluginMcpState,
|
||||
|
||||
@@ -48,6 +48,7 @@ pub(super) enum ExecutorPluginMcpProviderError {
|
||||
|
||||
impl ExecutorPluginMcpProvider {
|
||||
/// Returns MCP servers declared by `plugin`, bound to its environment.
|
||||
#[tracing::instrument(name = "mcp.executor_plugin.servers.load", skip_all)]
|
||||
pub(super) async fn load(
|
||||
&self,
|
||||
plugin: &ResolvedExecutorPlugin,
|
||||
|
||||
Reference in New Issue
Block a user