Skip to content

Flatten namespace tools for providers without wrappers - #29602

Closed
kotakem-openai wants to merge 3 commits into
mainfrom
kotakem/issue-26234-namespace-tools-wire-capability
Closed

kotakem-openai wants to merge 3 commits into
mainfrom
kotakem/issue-26234-namespace-tools-wire-capability

Conversation

@kotakem-openai

@kotakem-openai kotakem-openai commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Resolves #26234.

Codex uses the OpenAI Responses API type: "namespace" wrapper to serialize namespaced tools. Support for that wire format is not universal among third-party Responses-compatible endpoints: some reject it, while others may not preserve its namespace semantics. On endpoints that only support plain function tools, this can prevent MCP tools, deferred tool_search results, and standalone extension tools from being exposed or called correctly.

This change adds a Codex-side compatibility fallback rather than requiring those endpoints to implement namespace wrappers. Codex keeps its logical namespaced tool model internally, but serializes model-visible tools based on the provider's namespace_tools configuration/default: preserve namespace wrappers when enabled, or emit canonical flattened function names when disabled. Flat calls are resolved back to the original namespaced runtime, preserving logical tool identity.

What Changed

  • Added optional namespace_tools provider capability/config plumbing. Explicit config wins; OpenAI-auth and Azure Responses providers preserve wrappers by default; configured non-OpenAI Responses providers flatten by default; Amazon Bedrock keeps wrappers by default but can opt out with namespace_tools = false.
  • Centralized model-visible namespace serialization: preserve type: "namespace" when supported, otherwise emit canonical <namespace>__<tool> function names for direct tools and deferred tool_search results.
  • Kept flat calls executable by registering flat aliases back to namespaced runtimes while preserving logical tool identity.
  • Kept generic PreToolUse and PostToolUse hook matching compatible with model-visible flat names via matcher-only aliases, while preserving the existing canonical hook name in hook stdin.
  • Kept tool discovery and standalone extension tools available independently from namespace wrapper support, including flattened deferred MCP specs and Responses Lite web.run / image_gen.imagegen.
  • Validated canonical flat names before exposure: app-server rejects duplicate or overlong flattened dynamic-tool names, MCP normalization disambiguates canonical-flat collisions, and core fails fast only when a collision can reach the model or tool_search. Hidden/unreachable-only collisions keep their logical runtimes while warning and suppressing the ambiguous flat alias.
  • Propagated namespace_tools through remote thread config and regenerated the config schema.
  • Added regression coverage for provider defaults/Bedrock opt-out, app-server dynamic validation, MCP normalization, flat registry dispatch, reachable/discoverable collision fail-fast, hidden-only alias suppression, deferred MCP discovery, Responses Lite standalone tools, and flattened hook aliases.

Test Plan

  • just write-config-schema
  • just test -p codex-tools
  • just test -p codex-protocol tool_name
  • just test -p codex-model-provider
  • just test -p codex-config thread_config
  • just test -p codex-mcp
  • just test -p codex-core mcp_and_tool_search_follow_direct_and_deferred_tool_exposure search_results_flatten_mcp_namespaces_without_namespace_tools handler_resolves_flat_aliases_when_namespace_specs_are_flattened responses_lite_flattens_standalone_tools_without_namespace_tools
  • Targeted codex-core regressions for model-reachable/discoverable canonical-flat collisions, hidden-only alias suppression, flat registry dispatch, and flattened PreToolUse / PostToolUse hook matcher aliases.
  • just test -p codex-protocol -p codex-config -p codex-model-provider-info -p codex-login
  • just test -p codex-app-server
  • Manual issue Flatten MCP namespace tools for non-OpenAI Responses API providers (Ollama, LM Studio, OpenRouter) #26234 repro against the locally built codex binary and a local Ollama Responses API endpoint: observed PASS: Codex flattened the MCP tool for the custom Responses backend.

Documentation

  • Document model_providers.<id>.namespace_tools and its provider defaults in the Codex model provider/configuration documentation on developers.openai.com.

@kotakem-openai
kotakem-openai requested a review from a team June 23, 2026 09:26
@kotakem-openai
kotakem-openai marked this pull request as ready for review June 24, 2026 08:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42961ed49b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/core/src/tools/registry.rs Resolved
Comment thread codex-rs/core/src/tools/registry.rs Resolved
Comment thread codex-rs/core/src/tools/spec_plan.rs Resolved
@madarkadonk

Copy link
Copy Markdown

Any movement on this? I'd love to see this fix in main

@Davy-Jessi

Copy link
Copy Markdown

why not resolving this critical issue up to now?

@kotakem-openai
kotakem-openai force-pushed the kotakem/issue-26234-namespace-tools-wire-capability branch from eee2c72 to 05d99c8 Compare July 1, 2026 09:13
@kotakem-openai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 82e61bd90e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@madarkadonk

Copy link
Copy Markdown

Is there a new PR which resolves this? Curious why it was closed.

@will-zdu

will-zdu commented Jul 8, 2026 •

Copy link
Copy Markdown

Why was this PR closed?

@oddm643

oddm643 commented Jul 14, 2026

Copy link
Copy Markdown

Hey, any info why this was closed? Does this mean OpenAI's officially saying they are not interested in allowing other models to be used on the ChatGPT/Codex app? Tibo has just tweeted about a method to use GPT models on the Claude Code app. https://x.com/thsottiaux/status/2076119366647894371?s=20 so OpenAI is sharing how to do something on someone else’s app that they don’t want you to do on their own now?

xuechenwang-cienet added a commit to xuechenwang-cienet/claude_agent_sdk_test that referenced this pull request Jul 21, 2026
…vider

codex 0.144.x 走自定义 Responses API provider 时,model 发起
mcp__<server>__<tool> 形式的 function_call 后,codex 内部 tool
dispatcher 直接返回 'unsupported call',不会转发给 MCP server。

- MCP server 加载正常 (ListToolsRequest 成功)
- tools 数组里 [namespace] mcp__<server> 正确暴露给模型
- 模型正确发起 namespace 格式 function_call
- codex 返回 unsupported call,MCP server 日志无 CallToolRequest
- 手动 mcpServer/tool/call JSON-RPC 正常
- 试过 config_overrides / ~/.codex/config.toml / non_prefixed_mcp_tool_names
  / model_catalog_json 都不能修复

临时 workaround:不传 mcp_servers config,demo tools 走 AGENTS.md 的
bash 方案。清理掉不再使用的 _DEMO_MCP_SCRIPT / _PYTHON_BIN 死代码。

Refs: openai/codex#22970 (comment)
      openai/codex#25139 openai/codex#26977 openai/codex#30902
      openai/codex#31354 openai/codex#29602
EmilLindfors added a commit to Fraktal-Norge-AS/fraktal-codex that referenced this pull request Aug 3, 2026
Checked before filing: the namespace_tools defect is already reported
upstream as openai#26234 (open since 2026-06-03, `bug`, 29 comments, reference
branch attached) and openai#33263. Two fix PRs, openai#28271 and openai#29602, were
authored by an OpenAI engineer and both closed unmerged without
explanation.

So this is not a transitional patch awaiting an upstream fix — plan to
carry it. Records the evidence, and notes that openai#26234's per-provider
`namespace_tools` config (defaulting to `requires_openai_auth`) is a
better shape than our global feature flag if we revisit it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flatten MCP namespace tools for non-OpenAI Responses API providers (Ollama, LM Studio, OpenRouter)

5 participants