Skip to content

amazon-bedrock provider: namespace_tools capability breaks Bedrock Mantle (validation_error) #25034

Description

@kingdoooo

Bug

The built-in amazon-bedrock provider sets namespace_tools: true in its capabilities (mod.rs:60). This causes Codex to serialize tools using the {"type": "namespace", ...} wrapper format. However, Bedrock Mantle's Responses API schema validator only accepts "function" and "mcp" tool types, rejecting "namespace" with:

{"error":{"code":"validation_error","message":"Failed to deserialize the JSON body into the target type: ?[13]: Invalid 'tools': unknown variant `namespace`, expected `function` or `mcp` at line 1 column 107773","param":null,"type":"invalid_request_error"}}

This is a separate issue from the URL path bug (#23650 / #21352). Even after fixing the /openai/v1 → /v1 path, users with any meaningful number of tools (MCP servers, built-in shell/apply_patch, etc.) will hit this error because namespace_tools: true wraps all tool definitions in the unsupported format.

Reproduction

  1. Fix the Mantle URL path (per Built-in amazon-bedrock provider uses outdated Mantle endpoint path (/openai/v1/responses) #23650) so requests actually reach the server
  2. Use the amazon-bedrock provider with default config (any registered MCP servers or built-in tools)
  3. Run codex exec "hello" → HTTP 400 validation_error about namespace

With a minimal config (no MCP, features like code_mode/multi_agent_v2 off), the namespace wrapping doesn't fire for the few remaining tools, so it works. But any real-world config triggers it.

Root Cause

// codex-rs/model-provider/src/amazon_bedrock/mod.rs:58-62
fn capabilities(&self) -> ProviderCapabilities {
    ProviderCapabilities {
        namespace_tools: true,   // ← Mantle doesn't support this
        image_generation: false,
        web_search: false,
    }
}

When namespace_tools is true, core/src/tools/spec_plan.rs:876 wraps Function tools into Namespace:

ToolSpec::Function(tool) => ToolSpec::Namespace(ResponsesApiNamespace { ... })

The "namespace" tool type is an OpenAI-proprietary extension that Bedrock Mantle has not implemented.

Suggested Fix

fn capabilities(&self) -> ProviderCapabilities {
    ProviderCapabilities {
        namespace_tools: false,  // Mantle only accepts "function" and "mcp"
        image_generation: false,
        web_search: false,
    }
}

Environment

  • Codex CLI v0.135.0
  • Bedrock Mantle all regions (us-east-1, us-west-2, etc.)
  • AWS Account with openai.gpt-oss-120b model access
  • Tested 2026-05-29

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentIssues related to the core agent loopbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions