Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Remove zombie tools spec module (#22820)

jif-oaic03cea4ca2a8
diff --git a/codex-rs/core/src/session/review.rs b/codex-rs/core/src/session/review.rs
index acb4adb945..497cddd912 100644
--- a/codex-rs/core/src/session/review.rs
+++ b/codex-rs/core/src/session/review.rs
@@ -46,7 +46,7 @@ pub(super) async fn spawn_review_thread(
.with_image_generation_capability(provider_capabilities.image_generation)
.with_web_search_capability(provider_capabilities.web_search)
.with_unified_exec_shell_mode_for_session(
- crate::tools::spec::tool_user_shell_type(sess.services.user_shell.as_ref()),
+ crate::tools::tool_user_shell_type(sess.services.user_shell.as_ref()),
sess.services.shell_zsh_path.as_ref(),
sess.services.main_execve_wrapper_exe.as_ref(),
)
diff --git a/codex-rs/core/src/session/turn_context.rs b/codex-rs/core/src/session/turn_context.rs
index cab18b8561..92c7893d5e 100644
--- a/codex-rs/core/src/session/turn_context.rs
+++ b/codex-rs/core/src/session/turn_context.rs
@@ -527,7 +527,7 @@ impl Session {
.with_image_generation_capability(provider_capabilities.image_generation)
.with_web_search_capability(provider_capabilities.web_search)
.with_unified_exec_shell_mode_for_session(
- crate::tools::spec::tool_user_shell_type(user_shell),
+ crate::tools::tool_user_shell_type(user_shell),
shell_zsh_path,
main_execve_wrapper_exe,
)
diff --git a/codex-rs/core/src/tools/mod.rs b/codex-rs/core/src/tools/mod.rs
index 1effab52c3..5cd943e199 100644
--- a/codex-rs/core/src/tools/mod.rs
+++ b/codex-rs/core/src/tools/mod.rs
@@ -11,7 +11,6 @@ pub(crate) mod registry;
pub(crate) mod router;
pub(crate) mod runtimes;
pub(crate) mod sandboxing;
-pub(crate) mod spec;
pub(crate) mod spec_plan;
pub(crate) mod tool_dispatch_trace;
pub(crate) mod tool_search_entry;
@@ -47,6 +46,18 @@ pub(crate) fn flat_tool_name(tool_name: &ToolName) -> Cow<'_, str> {
}
}
+pub(crate) fn tool_user_shell_type(
+ user_shell: &crate::shell::Shell,
+) -> codex_tools::ToolUserShellType {
+ match user_shell.shell_type {
+ crate::shell::ShellType::Zsh => codex_tools::ToolUserShellType::Zsh,
+ crate::shell::ShellType::Bash => codex_tools::ToolUserShellType::Bash,
+ crate::shell::ShellType::PowerShell => codex_tools::ToolUserShellType::PowerShell,
+ crate::shell::ShellType::Sh => codex_tools::ToolUserShellType::Sh,
+ crate::shell::ShellType::Cmd => codex_tools::ToolUserShellType::Cmd,
+ }
+}
+
/// Format the combined exec output for sending back to the model.
/// Includes exit code and duration metadata; truncates large bodies safely.
pub fn format_exec_output_for_model_structured(
diff --git a/codex-rs/core/src/tools/spec.rs b/codex-rs/core/src/tools/spec.rs
deleted file mode 100644
index 7ee05c540b..0000000000
--- a/codex-rs/core/src/tools/spec.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-use crate::shell::Shell;
-use crate::shell::ShellType;
-use codex_tools::ToolUserShellType;
-
-pub(crate) fn tool_user_shell_type(user_shell: &Shell) -> ToolUserShellType {
- match user_shell.shell_type {
- ShellType::Zsh => ToolUserShellType::Zsh,
- ShellType::Bash => ToolUserShellType::Bash,
- ShellType::PowerShell => ToolUserShellType::PowerShell,
- ShellType::Sh => ToolUserShellType::Sh,
- ShellType::Cmd => ToolUserShellType::Cmd,
- }
-}
-
-#[cfg(test)]
-#[path = "spec_tests.rs"]
-mod tests;
diff --git a/codex-rs/core/src/tools/spec_plan.rs b/codex-rs/core/src/tools/spec_plan.rs
index 679772f4c7..be5e6741d4 100644
--- a/codex-rs/core/src/tools/spec_plan.rs
+++ b/codex-rs/core/src/tools/spec_plan.rs
@@ -621,6 +621,9 @@ fn code_mode_namespace_name<'a>(
.map(|namespace_description| namespace_description.name.as_str())
}
+#[cfg(test)]
+#[path = "spec_plan_model_tests.rs"]
+mod model_tests;
#[cfg(test)]
#[path = "spec_plan_tests.rs"]
mod tests;
diff --git a/codex-rs/core/src/tools/spec_tests.rs b/codex-rs/core/src/tools/spec_plan_model_tests.rs
similarity index 99%
rename from codex-rs/core/src/tools/spec_tests.rs
rename to codex-rs/core/src/tools/spec_plan_model_tests.rs
index c74a795793..dcc1be30ed 100644
--- a/codex-rs/core/src/tools/spec_tests.rs
+++ b/codex-rs/core/src/tools/spec_plan_model_tests.rs
@@ -4,6 +4,7 @@ use crate::shell::ShellType;
use crate::test_support::construct_model_info_offline;
use crate::tools::ToolRouter;
use crate::tools::router::ToolRouterParams;
+use crate::tools::tool_user_shell_type;
use codex_app_server_protocol::AppInfo;
use codex_features::Feature;
use codex_features::Features;
@@ -40,8 +41,6 @@ use std::collections::BTreeMap;
use std::path::PathBuf;
use std::sync::Arc;
-use super::*;
-
fn mcp_tool(name: &str, description: &str, input_schema: serde_json::Value) -> rmcp::model::Tool {
rmcp::model::Tool {
name: name.to_string().into(),