Remove the provider capability gate for tool namespaces (#50447)

## What changed

- Remove `namespace_tools` from `ProviderCapabilities` and `namespaceTools` from `ModelProviderCapabilitiesReadResponse`, updating generated schemas and SDK types.
- Preserve tool namespaces and configured collaboration tool namespaces without a provider capability check, and always use Responses Lite tool serialization for Responses Lite requests.
- Gate tool search on `supports_search_tool` and retain the existing image generation and web search checks without requiring a namespace capability.

GitOrigin-RevId: ae1843563736765a40e03a02c41ff5e470018a93
This commit is contained in:
pakrym-oai
2026-10-02 22:55:08 +00:00
committed by copyberry
parent 9b0a676d5d
commit fd75aa116c
15 changed files with 12 additions and 64 deletions
@@ -15676,16 +15676,12 @@
"imageGeneration": {
"type": "boolean"
},
"namespaceTools": {
"type": "boolean"
},
"webSearch": {
"type": "boolean"
}
},
"required": [
"imageGeneration",
"namespaceTools",
"webSearch"
],
"title": "ModelProviderCapabilitiesReadResponse",
@@ -11688,16 +11688,12 @@
"imageGeneration": {
"type": "boolean"
},
"namespaceTools": {
"type": "boolean"
},
"webSearch": {
"type": "boolean"
}
},
"required": [
"imageGeneration",
"namespaceTools",
"webSearch"
],
"title": "ModelProviderCapabilitiesReadResponse",
@@ -4,16 +4,12 @@
"imageGeneration": {
"type": "boolean"
},
"namespaceTools": {
"type": "boolean"
},
"webSearch": {
"type": "boolean"
}
},
"required": [
"imageGeneration",
"namespaceTools",
"webSearch"
],
"title": "ModelProviderCapabilitiesReadResponse",
@@ -2,4 +2,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ModelProviderCapabilitiesReadResponse = { namespaceTools: boolean, imageGeneration: boolean, webSearch: boolean, };
export type ModelProviderCapabilitiesReadResponse = { imageGeneration: boolean, webSearch: boolean, };
@@ -44,7 +44,6 @@ pub struct ModelProviderCapabilitiesReadParams {}
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ModelProviderCapabilitiesReadResponse {
pub namespace_tools: bool,
pub image_generation: bool,
pub web_search: bool,
}
@@ -208,7 +208,6 @@ impl ConfigRequestProcessor {
let provider = create_model_provider(config.model_provider, /*auth_manager*/ None);
let capabilities = provider.capabilities();
Ok(ModelProviderCapabilitiesReadResponse {
namespace_tools: capabilities.namespace_tools,
image_generation: capabilities.image_generation,
web_search: capabilities.web_search,
})
@@ -26,7 +26,6 @@ async fn read_default_provider_capabilities() -> Result<()> {
timeout(DEFAULT_TIMEOUT, mcp.read_response(request_id)).await??;
let expected = ModelProviderCapabilitiesReadResponse {
namespace_tools: true,
image_generation: true,
web_search: true,
};
@@ -55,7 +54,6 @@ async fn read_amazon_bedrock_provider_capabilities() -> Result<()> {
timeout(DEFAULT_TIMEOUT, mcp.read_response(request_id)).await??;
let expected = ModelProviderCapabilitiesReadResponse {
namespace_tools: true,
image_generation: false,
web_search: true,
};
@@ -85,7 +83,6 @@ async fn read_amazon_bedrock_runtime_provider_capabilities() -> Result<()> {
assert_eq!(
received,
ModelProviderCapabilitiesReadResponse {
namespace_tools: true,
image_generation: false,
web_search: false,
}
+1 -6
View File
@@ -99,7 +99,6 @@ use codex_protocol::protocol::SubAgentSource;
use codex_protocol::protocol::W3cTraceContext;
use codex_rollout_trace::InferenceTraceAttempt;
use codex_rollout_trace::InferenceTraceContext;
use codex_tools::create_tools_json_for_responses_api;
use codex_tools::create_tools_json_for_responses_lite;
use codex_tools::create_tools_raw_json_for_responses_api;
use eventsource_stream::Event;
@@ -912,11 +911,7 @@ impl ModelClient {
&Uuid::NAMESPACE_OID,
self.state.thread_id.to_string().as_bytes(),
);
let tools = if self.state.provider.capabilities().namespace_tools {
create_tools_json_for_responses_lite(&prompt.tools)?
} else {
create_tools_json_for_responses_api(&prompt.tools)?
};
let tools = create_tools_json_for_responses_lite(&prompt.tools)?;
let mut prefix = vec![ResponseItem::AdditionalTools {
id: Some(ResponseItemId::with_suffix(
"at",
+1 -6
View File
@@ -340,12 +340,7 @@ impl Session {
.expose_spawn_agent_model_overrides
.then(|| {
ToolName::new(
turn_context
.provider
.capabilities()
.namespace_tools
.then(|| turn_context.config.multi_agent_v2.tool_namespace.clone())
.flatten(),
turn_context.config.multi_agent_v2.tool_namespace.clone(),
"spawn_agent",
)
}),
+9 -28
View File
@@ -155,7 +155,7 @@ pub(crate) fn build_tool_router(
&turn_context.config,
apps_enabled,
&mcp.config().mcp_server_catalog,
search_tool_enabled(turn_context, model_info),
model_info.supports_search_tool,
&mut registry,
);
apply_mcp_tool_exposure_policy(
@@ -243,7 +243,7 @@ fn apply_mcp_tool_exposure_policy(
exposures = exposures.difference(ToolExposures::DEFERRED | ToolExposures::CODE_MODE);
}
exposures = if search_tool_enabled(turn_context, model_info)
exposures = if model_info.supports_search_tool
&& exposures.contains(ToolExposures::DEFERRED)
&& (effective_tool_mode(turn_context, model_info) != ToolMode::CodeModeOnly
|| exposures.contains(ToolExposures::CODE_MODE))
@@ -368,7 +368,7 @@ pub(crate) fn finalize_tool_router(
}
}
let tool_search_name = ToolName::plain(TOOL_SEARCH_TOOL_NAME);
if search_tool_enabled(turn_context, model_info)
if model_info.supports_search_tool
&& registry.entries().any(|tool| {
tool.runtime.tool_name() != tool_search_name
&& tool.exposure.is_deferred()
@@ -583,11 +583,6 @@ fn build_model_visible_specs(
specs.extend(hosted_specs);
merge_into_namespaces(specs)
.into_iter()
.filter(|spec| {
namespace_tools_enabled(turn_context) || !matches!(spec, ToolSpec::Namespace(_))
})
.collect()
}
fn spec_for_model_request(
@@ -650,10 +645,6 @@ fn hosted_model_tool_specs(
specs
}
pub(crate) fn search_tool_enabled(turn_context: &TurnContext, model_info: &ModelInfo) -> bool {
model_info.supports_search_tool && namespace_tools_enabled(turn_context)
}
pub(crate) fn tool_suggest_enabled(turn_context: &TurnContext) -> bool {
let features = turn_context.config.features.get();
features.enabled(Feature::ToolSuggest)
@@ -661,10 +652,6 @@ pub(crate) fn tool_suggest_enabled(turn_context: &TurnContext) -> bool {
&& features.enabled(Feature::Plugins)
}
fn namespace_tools_enabled(turn_context: &TurnContext) -> bool {
turn_context.provider.capabilities().namespace_tools
}
fn multi_agent_v2_enabled(turn_context: &TurnContext) -> bool {
turn_context.multi_agent_version == MultiAgentVersion::V2
}
@@ -698,9 +685,7 @@ fn required_child_management_tool_names(
&["send_input", "wait_agent", "resume_agent", "close_agent"],
),
MultiAgentVersion::V2 => (
namespace_tools_enabled(turn_context)
.then_some(turn_context.config.multi_agent_v2.tool_namespace.as_deref())
.flatten(),
turn_context.config.multi_agent_v2.tool_namespace.as_deref(),
if turn_context.config.multi_agent_v2.disable_direct_message {
&["interrupt_agent", "list_agents"]
} else {
@@ -744,8 +729,7 @@ fn image_generation_available(turn_context: &TurnContext, model_info: &ModelInfo
return false;
}
let capabilities = turn_context.provider.capabilities();
if !capabilities.image_generation || !capabilities.namespace_tools {
if !turn_context.provider.capabilities().image_generation {
return false;
}
@@ -832,7 +816,7 @@ fn register_code_mode_executors(
let mut exec_prompt_tool_specs = Vec::new();
let mut deferred_exec_prompt_tool_specs = Vec::new();
let mut included_deferred_mcp_output_schema = false;
let deferred_tools_guidance_enabled = search_tool_enabled(turn_context, model_info);
let deferred_tools_guidance_enabled = model_info.supports_search_tool;
for tool in registry.entries() {
let exposure = tool.exposure;
if !exposure.is_available_in_code_mode() {
@@ -1036,8 +1020,7 @@ fn add_core_tool_sources(context: &CoreToolPlanContext<'_>, registry: &mut ToolR
}
fn standalone_web_search_enabled(turn_context: &TurnContext, model_info: &ModelInfo) -> bool {
namespace_tools_enabled(turn_context)
&& turn_context.provider.capabilities().web_search
turn_context.provider.capabilities().web_search
&& (model_info.use_responses_lite
|| turn_context
.config
@@ -1308,9 +1291,7 @@ fn add_collaboration_tools(context: &CoreToolPlanContext<'_>, registry: &mut Too
} else {
ToolExposure::Direct
};
let tool_namespace = namespace_tools_enabled(turn_context)
.then_some(turn_context.config.multi_agent_v2.tool_namespace.as_deref())
.flatten();
let tool_namespace = turn_context.config.multi_agent_v2.tool_namespace.as_deref();
let agent_type_description =
agent_type_description(turn_context, context.default_agent_type_description);
let hide_spawn_agent_metadata =
@@ -1400,7 +1381,7 @@ fn add_collaboration_tools(context: &CoreToolPlanContext<'_>, registry: &mut Too
} else {
let agent_type_description =
agent_type_description(turn_context, context.default_agent_type_description);
let exposure = if search_tool_enabled(turn_context, context.model_info) {
let exposure = if context.model_info.supports_search_tool {
ToolExposure::Deferred
} else {
ToolExposure::Direct
@@ -279,7 +279,6 @@ impl ModelProvider for AmazonBedrockModelProvider {
fn capabilities(&self) -> ProviderCapabilities {
ProviderCapabilities {
namespace_tools: true,
image_generation: false,
web_search: self.endpoint == BedrockEndpoint::Mantle,
external_web_access: false,
@@ -695,7 +694,6 @@ mod tests {
assert_eq!(
provider.capabilities(),
ProviderCapabilities {
namespace_tools: true,
image_generation: false,
web_search: true,
external_web_access: false,
@@ -714,7 +712,6 @@ mod tests {
assert_eq!(
provider.capabilities(),
ProviderCapabilities {
namespace_tools: true,
image_generation: false,
web_search: false,
external_web_access: false,
-2
View File
@@ -50,7 +50,6 @@ pub enum RemoteCompactionSupport {
/// that the active provider marks unsupported here.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ProviderCapabilities {
pub namespace_tools: bool,
pub image_generation: bool,
pub web_search: bool,
pub external_web_access: bool,
@@ -60,7 +59,6 @@ pub struct ProviderCapabilities {
impl Default for ProviderCapabilities {
fn default() -> Self {
Self {
namespace_tools: true,
image_generation: true,
web_search: true,
external_web_access: true,
@@ -2817,7 +2817,6 @@ class ModelProviderCapabilitiesReadResponse(BaseModel):
populate_by_name=True,
)
image_generation: Annotated[bool, Field(alias="imageGeneration")]
namespace_tools: Annotated[bool, Field(alias="namespaceTools")]
web_search: Annotated[bool, Field(alias="webSearch")]