Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Add spans to build_tool_router (#27094)

mchen-oai5ac640ac49ae
diff --git a/codex-rs/core/src/tools/spec_plan.rs b/codex-rs/core/src/tools/spec_plan.rs
index fed62a0ee1..19f4c9f897 100644
--- a/codex-rs/core/src/tools/spec_plan.rs
+++ b/codex-rs/core/src/tools/spec_plan.rs
@@ -86,6 +86,7 @@ use codex_tools::shell_type_for_model_and_features;
use std::collections::BTreeMap;
use std::collections::HashSet;
use std::sync::Arc;
+use tracing::instrument;
use tracing::warn;
const MULTI_AGENT_V2_NAMESPACE_DESCRIPTION: &str = "Tools for spawning and managing sub-agents.";
@@ -148,6 +149,7 @@ struct CoreToolPlanContext<'a> {
wait_agent_timeouts: WaitAgentTimeoutOptions,
}
+#[instrument(level = "trace", skip_all)]
pub(crate) fn build_tool_router(
turn_context: &TurnContext,
params: ToolRouterParams<'_>,
@@ -156,6 +158,7 @@ pub(crate) fn build_tool_router(
ToolRouter::from_parts(registry, model_visible_specs)
}
+#[instrument(level = "trace", skip_all)]
fn build_tool_specs_and_registry(
turn_context: &TurnContext,
params: ToolRouterParams<'_>,
@@ -186,6 +189,7 @@ fn build_tool_specs_and_registry(
build_model_visible_specs_and_registry(turn_context, planned_tools)
}
+#[instrument(level = "trace", skip_all)]
fn build_model_visible_specs_and_registry(
turn_context: &TurnContext,
planned_tools: PlannedTools,
@@ -557,6 +561,7 @@ fn code_mode_namespace_descriptions(
namespace_descriptions
}
+#[instrument(level = "trace", skip_all)]
fn add_tool_sources(context: &CoreToolPlanContext<'_>, planned_tools: &mut PlannedTools) {
add_shell_tools(context, planned_tools);
add_mcp_resource_tools(context, planned_tools);
@@ -837,6 +842,7 @@ fn add_extension_tools(context: &CoreToolPlanContext<'_>, planned_tools: &mut Pl
);
}
+#[instrument(level = "trace", skip_all)]
fn append_tool_search_executor(
context: &CoreToolPlanContext<'_>,
planned_tools: &mut PlannedTools,