Remove zombie tools spec module (#22820)

## Summary

- move tool_user_shell_type out of the old tools::spec module and call
it from tools directly
- attach the remaining spec planning model tests under spec_plan
- delete core/src/tools/spec.rs

## Tests

- just fmt
- cargo test -p codex-core tools::spec_plan

Note: a broader cargo test -p codex-core run on the earlier PR-head
worktree still hit the pre-existing stack overflow in
agent::control::tests::spawn_agent_fork_last_n_turns_keeps_only_recent_turns.
This commit is contained in:
jif-oai authored and GitHub committed 2026-05-15 13:44:58 +02:00
1 parent 6f1a01fbdd
commit c03cea4ca2
6 files changed
+18 -22

No files matched your search

+1 -1
View File
@@ -46,7 +46,7 @@ pub(super) async fn spawn_review_thread(
.with_image_generation_capability(provider_capabilities.image_generation) .with_image_generation_capability(provider_capabilities.image_generation)
.with_web_search_capability(provider_capabilities.web_search) .with_web_search_capability(provider_capabilities.web_search)
.with_unified_exec_shell_mode_for_session( .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.shell_zsh_path.as_ref(),
sess.services.main_execve_wrapper_exe.as_ref(), sess.services.main_execve_wrapper_exe.as_ref(),
) )
+1 -1
View File
@@ -527,7 +527,7 @@ impl Session {
.with_image_generation_capability(provider_capabilities.image_generation) .with_image_generation_capability(provider_capabilities.image_generation)
.with_web_search_capability(provider_capabilities.web_search) .with_web_search_capability(provider_capabilities.web_search)
.with_unified_exec_shell_mode_for_session( .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, shell_zsh_path,
main_execve_wrapper_exe, main_execve_wrapper_exe,
) )
+12 -1
View File
@@ -11,7 +11,6 @@ pub(crate) mod registry;
pub(crate) mod router; pub(crate) mod router;
pub(crate) mod runtimes; pub(crate) mod runtimes;
pub(crate) mod sandboxing; pub(crate) mod sandboxing;
pub(crate) mod spec;
pub(crate) mod spec_plan; pub(crate) mod spec_plan;
pub(crate) mod tool_dispatch_trace; pub(crate) mod tool_dispatch_trace;
pub(crate) mod tool_search_entry; 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. /// Format the combined exec output for sending back to the model.
/// Includes exit code and duration metadata; truncates large bodies safely. /// Includes exit code and duration metadata; truncates large bodies safely.
pub fn format_exec_output_for_model_structured( pub fn format_exec_output_for_model_structured(
-17
View File
@@ -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;
+3
View File
@@ -621,6 +621,9 @@ fn code_mode_namespace_name<'a>(
.map(|namespace_description| namespace_description.name.as_str()) .map(|namespace_description| namespace_description.name.as_str())
} }
#[cfg(test)]
#[path = "spec_plan_model_tests.rs"]
mod model_tests;
#[cfg(test)] #[cfg(test)]
#[path = "spec_plan_tests.rs"] #[path = "spec_plan_tests.rs"]
mod tests; mod tests;
@@ -4,6 +4,7 @@ use crate::shell::ShellType;
use crate::test_support::construct_model_info_offline; use crate::test_support::construct_model_info_offline;
use crate::tools::ToolRouter; use crate::tools::ToolRouter;
use crate::tools::router::ToolRouterParams; use crate::tools::router::ToolRouterParams;
use crate::tools::tool_user_shell_type;
use codex_app_server_protocol::AppInfo; use codex_app_server_protocol::AppInfo;
use codex_features::Feature; use codex_features::Feature;
use codex_features::Features; use codex_features::Features;
@@ -40,8 +41,6 @@ use std::collections::BTreeMap;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use super::*;
fn mcp_tool(name: &str, description: &str, input_schema: serde_json::Value) -> rmcp::model::Tool { fn mcp_tool(name: &str, description: &str, input_schema: serde_json::Value) -> rmcp::model::Tool {
rmcp::model::Tool { rmcp::model::Tool {
name: name.to_string().into(), name: name.to_string().into(),