mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
feat: disable capabilities by model provider (#19442)
## Why Unsupported features must fail closed and Codex must not expose OpenAI-hosted fallback paths when the active provider cannot support them. In practice, Bedrock should not surface app connectors, MCP servers, tool search/suggestions, image generation, web search, or JS REPL until those paths are explicitly supported for that provider. This PR moves that decision into provider-owned capability metadata instead of scattering Bedrock-specific checks across callers. ## What changed - Adds `ProviderCapabilities` to `codex-model-provider`, with default support for existing providers and a Bedrock override that disables unsupported launch surfaces. - Adds `ToolCapabilityBounds` to `codex-tools` so provider capability limits can clamp otherwise-enabled tool config. - Applies capability bounds when building session and review-thread tool config. - Routes MCP/app connector configuration through `McpManager::mcp_config`, which filters configured MCP servers and app connectors based on the active provider. - Updates app-server MCP list/read paths to use the filtered MCP config. - Adds coverage for default provider capabilities, Bedrock disabled capabilities, and optional tool-surface clamping. ## Testing built locally and verified that bedrock responses api now return without errors calling unsupported tools.
This commit is contained in:
1 parent
cb8b1bbcd6
commit
f8fe96d548
12 files changed
+390
-8
No files matched your search
@@ -94,6 +94,7 @@ pub struct ToolsConfig {
|
||||
pub web_search_tool_type: WebSearchToolType,
|
||||
pub image_gen_tool: bool,
|
||||
pub search_tool: bool,
|
||||
pub namespace_tools: bool,
|
||||
pub tool_suggest: bool,
|
||||
pub exec_permission_approvals_enabled: bool,
|
||||
pub request_permissions_tool_enabled: bool,
|
||||
@@ -214,6 +215,7 @@ impl ToolsConfig {
|
||||
web_search_tool_type: model_info.web_search_tool_type,
|
||||
image_gen_tool: include_image_gen_tool,
|
||||
search_tool: include_search_tool,
|
||||
namespace_tools: true,
|
||||
tool_suggest: include_tool_suggest,
|
||||
exec_permission_approvals_enabled,
|
||||
request_permissions_tool_enabled,
|
||||
@@ -241,6 +243,27 @@ impl ToolsConfig {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_namespace_tools_capability(mut self, namespace_tools: bool) -> Self {
|
||||
if !namespace_tools {
|
||||
self.namespace_tools = false;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_image_generation_capability(mut self, image_generation: bool) -> Self {
|
||||
if !image_generation {
|
||||
self.image_gen_tool = false;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_web_search_capability(mut self, web_search: bool) -> Self {
|
||||
if !web_search {
|
||||
self.web_search_mode = None;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_spawn_agent_usage_hint(mut self, spawn_agent_usage_hint: bool) -> Self {
|
||||
self.spawn_agent_usage_hint = spawn_agent_usage_hint;
|
||||
self
|
||||
|
||||
Reference in new issue
Block a user