From c6b0cf680bede0db0a0aef6844262b1d68496dc3 Mon Sep 17 00:00:00 2001 From: ashwinnathan-openai Date: Thu, 19 Mar 2026 20:32:40 -0700 Subject: [PATCH] changes --- codex-rs/core/src/config/mod.rs | 25 +++++++++++------------ codex-rs/core/src/tools/registry.rs | 31 ++++++++++++++++++++--------- codex-rs/core/src/tools/spec.rs | 6 +++--- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/codex-rs/core/src/config/mod.rs b/codex-rs/core/src/config/mod.rs index 85dfc005eb..c8599464cc 100644 --- a/codex-rs/core/src/config/mod.rs +++ b/codex-rs/core/src/config/mod.rs @@ -2118,22 +2118,21 @@ fn resolve_web_search_mode( features: &Features, tool_feature_overrides: &ToolFeatureOverrides, ) -> Option { - let explicit_mode = || config_profile.web_search.or(config_toml.web_search); - let feature_default_mode = || { - if features.enabled(Feature::WebSearchCached) { - Some(WebSearchMode::Cached) - } else if features.enabled(Feature::WebSearchRequest) { - Some(WebSearchMode::Live) - } else { - None - } - }; - match tool_feature_overrides.web_search { - Some(true) => explicit_mode().or_else(feature_default_mode), Some(false) => Some(WebSearchMode::Disabled), None if tool_feature_overrides.disable_defaults => Some(WebSearchMode::Disabled), - None => explicit_mode().or_else(feature_default_mode), + None | Some(true) => config_profile + .web_search + .or(config_toml.web_search) + .or_else(|| { + if features.enabled(Feature::WebSearchCached) { + Some(WebSearchMode::Cached) + } else if features.enabled(Feature::WebSearchRequest) { + Some(WebSearchMode::Live) + } else { + None + } + }), } } diff --git a/codex-rs/core/src/tools/registry.rs b/codex-rs/core/src/tools/registry.rs index af89f521c7..f784403c1f 100644 --- a/codex-rs/core/src/tools/registry.rs +++ b/codex-rs/core/src/tools/registry.rs @@ -40,6 +40,7 @@ pub(crate) enum BuiltinToolKey { Artifacts, CloseAgent, CodeMode, + ContainerExec, ExecCommand, GrepFiles, ImageGeneration, @@ -48,6 +49,7 @@ pub(crate) enum BuiltinToolKey { ListDir, ListMcpResources, ListMcpResourceTemplates, + LocalShell, ReadFile, ReadMcpResource, RequestPermissions, @@ -56,6 +58,8 @@ pub(crate) enum BuiltinToolKey { ResumeAgent, SearchToolBm25, SendInput, + Shell, + ShellCommand, SpawnAgent, SpawnAgentsOnCsv, TestSyncTool, @@ -82,11 +86,12 @@ pub(crate) enum ToolFeatureKey { } impl BuiltinToolKey { - pub(crate) const ALL: [Self; 28] = [ + pub(crate) const ALL: [Self; 32] = [ Self::ApplyPatch, Self::Artifacts, Self::CloseAgent, Self::CodeMode, + Self::ContainerExec, Self::ExecCommand, Self::GrepFiles, Self::ImageGeneration, @@ -95,6 +100,7 @@ impl BuiltinToolKey { Self::ListDir, Self::ListMcpResources, Self::ListMcpResourceTemplates, + Self::LocalShell, Self::ReadFile, Self::ReadMcpResource, Self::RequestPermissions, @@ -103,6 +109,8 @@ impl BuiltinToolKey { Self::ResumeAgent, Self::SearchToolBm25, Self::SendInput, + Self::Shell, + Self::ShellCommand, Self::SpawnAgent, Self::SpawnAgentsOnCsv, Self::TestSyncTool, @@ -120,13 +128,11 @@ impl BuiltinToolKey { pub(crate) const fn invocation_names(self) -> &'static [&'static str] { match self { Self::CodeMode => &[PUBLIC_TOOL_NAME], - Self::ExecCommand => &[ - SHELL_TOOL_NAME, - EXEC_COMMAND_TOOL_NAME, - CONTAINER_EXEC_TOOL_NAME, - LOCAL_SHELL_TOOL_NAME, - SHELL_COMMAND_TOOL_NAME, - ], + Self::ContainerExec => &[CONTAINER_EXEC_TOOL_NAME], + Self::ExecCommand => &[EXEC_COMMAND_TOOL_NAME], + Self::LocalShell => &[LOCAL_SHELL_TOOL_NAME], + Self::Shell => &[SHELL_TOOL_NAME], + Self::ShellCommand => &[SHELL_COMMAND_TOOL_NAME], Self::WriteStdin => &[WRITE_STDIN_TOOL_NAME], Self::ListMcpResources => &["list_mcp_resources"], Self::ListMcpResourceTemplates => &["list_mcp_resource_templates"], @@ -177,7 +183,14 @@ impl ToolFeatureKey { pub(crate) const fn builtin_tool_keys(self) -> &'static [BuiltinToolKey] { match self { - Self::Shell => &[BuiltinToolKey::ExecCommand, BuiltinToolKey::WriteStdin], + Self::Shell => &[ + BuiltinToolKey::ContainerExec, + BuiltinToolKey::ExecCommand, + BuiltinToolKey::LocalShell, + BuiltinToolKey::Shell, + BuiltinToolKey::ShellCommand, + BuiltinToolKey::WriteStdin, + ], Self::Filesystem => &[ BuiltinToolKey::ApplyPatch, BuiltinToolKey::GrepFiles, diff --git a/codex-rs/core/src/tools/spec.rs b/codex-rs/core/src/tools/spec.rs index f66a8d1805..f5b11e7bb5 100644 --- a/codex-rs/core/src/tools/spec.rs +++ b/codex-rs/core/src/tools/spec.rs @@ -545,10 +545,10 @@ impl ToolsConfig { } if self.tool_feature_overrides.disable_defaults { - return false; + false + } else { + self.is_tool_feature_enabled_by_default(feature) } - - self.is_tool_feature_enabled_by_default(feature) } fn is_tool_feature_enabled_by_default(&self, feature: ToolFeatureKey) -> bool {