Add spans to run_turn (#27107)

## Why
Codex app-server latency traces do not granularly cover turn
orchestration, sampling-request preparation, and tool-loading work.
These spans help separate local coordination/setup costs from model
streaming and tool execution.

## What changed
- Add `run_turn.*` spans around sampling-request input preparation and
post-sampling state collection
- Add function-level trace spans around turn setup, hook execution,
compaction, prompt construction, and MCP tool exposure
- Add `built_tools.*` spans around plugin loading and discoverable-tool
loading

## Verification
Trigger Codex rollout and observe new spans are included
This commit is contained in:
mchen-oai authored and GitHub committed 2026-06-10 04:41:06 +00:00
1 parent e0cb4ede4e
commit 00a25e1e0c
4 files changed
+62 -34

No files matched your search

+2
View File
@@ -4,6 +4,7 @@ use codex_features::Feature;
use codex_mcp::CODEX_APPS_MCP_SERVER_NAME;
use codex_mcp::ToolInfo as McpToolInfo;
use codex_mcp::tool_is_model_visible;
use tracing::instrument;
use crate::config::Config;
use crate::connectors;
@@ -15,6 +16,7 @@ pub(crate) struct McpToolExposure {
pub(crate) deferred_tools: Option<Vec<McpToolInfo>>,
}
#[instrument(level = "trace", skip_all)]
pub(crate) fn build_mcp_tool_exposure(
all_mcp_tools: &[McpToolInfo],
connectors: Option<&[connectors::AppInfo]>,