Skip to content

server : implement namespaced tools in responses API (rebase of #23235) - #31568

Open
CanadaOrNaw wants to merge 3 commits into
ggml-org:masterfrom
CanadaOrNaw:responses-namespaces-rebased
Open

CanadaOrNaw wants to merge 3 commits into
ggml-org:masterfrom
CanadaOrNaw:responses-namespaces-rebased

Conversation

@CanadaOrNaw

@CanadaOrNaw CanadaOrNaw commented Nov 3, 2026 •

Copy link
Copy Markdown

Overview

Supersedes #23235 (draft, stale since May; the original implementation commit by @aldehir is preserved as the first commit of this branch with authorship intact). Fixes #23229.

Two changes make the Responses API work with clients that group tools in namespaces (Codex CLI, Muse, MCP hosts):

  1. Namespaced tools (from server : implement namespaced tools in responses API #23235, rebased): type: "namespace" tools are flattened to ns_{namespace}___{tool_name} for the model, and the namespace field is restored on returned function_call items (non-streaming, streaming final, and streaming partial paths). Namespaced function_call input items flatten the same way.
  2. Streamed sequence_number: every streamed Responses SSE event now carries a monotonically increasing sequence_number, assigned at the stream writer so it stays monotonic across partial and final chunks. Strict Responses clients reject every streamed turn without it.

Follow-up commit on top of the original: malformed namespace entries (missing name, missing/non-array tools, missing inner name) now warn-and-skip like other non-function Responses tools instead of failing the request, matching the existing conversion tests on master.

Additional information

Tests:

  • test-chat: new cases for namespace flattening, namespaced function_call input items, and the flatten/split round-trip. All tests pass.
  • Live server test: namespace tool call returns a structured function_call with namespace restored (streaming and non-streaming); namespaced call history round-trips.
  • End-to-end: Muse 1.4.14 against this server completed a real tool-using turn (previously every turn failed with a provider decode error).

Credit: original implementation by @aldehir in #23235.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES - AI was used to steer the rebase, the follow-up changes, and the tests. The account holder has reviewed the diff and is responsible for every line.

aldehir and others added 3 commits November 2, 2026 18:14
…amespace tests

Master's existing conversion tests expect non-function Responses tools
(including a namespace without a tools array) to be skipped, not to
fail the request. Warn-and-skip instead of throwing, matching that
contract. Add test-chat coverage: namespace flattening, function_call
input items with a namespace, and the flatten/split round-trip.
OpenAI Responses SSE events carry a monotonically increasing
sequence_number. llama.cpp omitted it, and strict Responses clients
fail every streamed turn with a decode error. Assign numbers at the
stream writer, the one place every chunk of a streamed response
passes, so numbering is monotonic across partial and final results.
@github-actions github-actions Bot added testing Everything test related server labels Nov 3, 2026
@ggml-gh-bot

ggml-gh-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown

Hi @CanadaOrNaw, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@CanadaOrNaw
CanadaOrNaw marked this pull request as ready for review November 3, 2026 07:40
@CanadaOrNaw
CanadaOrNaw requested review from a team and pwilkin as code owners November 3, 2026 07:40

This branch has not been deployed

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

Labels

server testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tools[].type = "namespace" is silently dropped — MCP tools are unusable with Codex CLI

2 participants