Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

fix: move some test utilities out of codex-rs/core/src/tools/spec.rs (#16524)

Michael Boline846fed2b175
diff --git a/codex-rs/core/src/tools/spec.rs b/codex-rs/core/src/tools/spec.rs
index 86f4840a43..341db24767 100644
--- a/codex-rs/core/src/tools/spec.rs
+++ b/codex-rs/core/src/tools/spec.rs
@@ -19,9 +19,6 @@ use codex_tools::build_tool_registry_plan;
use std::collections::HashMap;
use std::sync::Arc;
-#[cfg(test)]
-pub(crate) use codex_tools::mcp_call_tool_result_output_schema;
-
pub(crate) fn tool_user_shell_type(user_shell: &Shell) -> ToolUserShellType {
match user_shell.shell_type {
ShellType::Zsh => ToolUserShellType::Zsh,
@@ -32,23 +29,6 @@ pub(crate) fn tool_user_shell_type(user_shell: &Shell) -> ToolUserShellType {
}
}
-/// Builds the tool registry builder while collecting tool specs for later serialization.
-#[cfg(test)]
-pub(crate) fn build_specs(
- config: &ToolsConfig,
- mcp_tools: Option<HashMap<String, rmcp::model::Tool>>,
- app_tools: Option<HashMap<String, ToolInfo>>,
- dynamic_tools: &[DynamicToolSpec],
-) -> ToolRegistryBuilder {
- build_specs_with_discoverable_tools(
- config,
- mcp_tools,
- app_tools,
- /*discoverable_tools*/ None,
- dynamic_tools,
- )
-}
-
pub(crate) fn build_specs_with_discoverable_tools(
config: &ToolsConfig,
mcp_tools: Option<HashMap<String, rmcp::model::Tool>>,
diff --git a/codex-rs/core/src/tools/spec_tests.rs b/codex-rs/core/src/tools/spec_tests.rs
index 61cb494679..4e73be3502 100644
--- a/codex-rs/core/src/tools/spec_tests.rs
+++ b/codex-rs/core/src/tools/spec_tests.rs
@@ -29,6 +29,7 @@ use codex_tools::ToolsConfig;
use codex_tools::ToolsConfigParams;
use codex_tools::UnifiedExecShellMode;
use codex_tools::ZshForkConfig;
+use codex_tools::mcp_call_tool_result_output_schema;
use codex_tools::mcp_tool_to_deferred_responses_api_tool;
use codex_utils_absolute_path::AbsolutePathBuf;
use pretty_assertions::assert_eq;
@@ -170,6 +171,22 @@ fn model_info_from_models_json(slug: &str) -> ModelInfo {
with_config_overrides(model, &config)
}
+/// Builds the tool registry builder while collecting tool specs for later serialization.
+fn build_specs(
+ config: &ToolsConfig,
+ mcp_tools: Option<HashMap<String, rmcp::model::Tool>>,
+ app_tools: Option<HashMap<String, ToolInfo>>,
+ dynamic_tools: &[DynamicToolSpec],
+) -> ToolRegistryBuilder {
+ build_specs_with_discoverable_tools(
+ config,
+ mcp_tools,
+ app_tools,
+ /*discoverable_tools*/ None,
+ dynamic_tools,
+ )
+}
+
#[test]
fn model_provided_unified_exec_is_blocked_for_windows_sandboxed_policies() {
let mut model_info = model_info_from_models_json("gpt-5-codex");