Repository navigation
Description
Checked against aimock v1.44.0 (latest, f5e17a6) used as the model behind Codex CLI rust-v0.161.0.
aimock can script ordinary Responses API function calls, but not calls to MCP tools, sub-agent tools or apply_patch. Codex needs two output items for those that aimock doesn't emit yet.
What's missing
1. namespace on function_call items
The Responses API can group tools under a namespace tool ({"type": "namespace", "name": "...", "tools": [...]}). A call to a tool in a group carries namespace next to name. See the function calling guide's Defining namespaces, and NamespaceToolParam and FunctionToolCall.namespace in the OpenAPI spec.
In aimock:
- the
ToolCallfixture has onlyname,argumentsandid(src/types.ts L316-L320); - the Responses builders emit
function_callitems withoutnamespace: src/responses.ts L374-L411, L839-L880 and L1113-L1122; - WebSocket reuses the same builders (src/ws-responses.ts L11-L19).
2. custom_tool_call items
A custom tool ({"type": "custom", ...}, optionally with a Lark or regex grammar) is answered with a custom_tool_call item carrying a free-text input. It streams as response.custom_tool_call_input.delta and response.custom_tool_call_input.done. See the guide's Custom tools, and CustomToolCall, ResponseCustomToolCallInputDeltaEvent and ResponseCustomToolCallInputDoneEvent in the spec. aimock has no fixture shape or builder for this item.
Why Codex needs them
All links are to rust-v0.161.0.
MCP tools. Codex wraps each MCP server's tools in one namespace tool (handlers/mcp.rs L498-L531). It routes a returned call by its exact (namespace, name) (router.rs L248-L299, registry.rs L490-L494). A plain function_call named after an MCP tool doesn't reach it.
Sub-agent tools live in the collaboration namespace by default (config/mod.rs L261). features.multi_agent_v2.tool_namespace can rename it but not remove it: an empty value is rejected (L3157-L3180).
No setting turns namespaces off.
ProviderCapabilities::namespace_toolsdefaults to true, and the configured provider keeps that default (model-provider/src/provider.rs L52-L69, L461-L474).- No
[model_providers.<id>]key changes it. - Plain-function tools for other backends have been requested in Flatten MCP namespace tools for non-OpenAI Responses API providers (Ollama, LM Studio, OpenRouter) openai/codex#26234, #36942 and #48847. The proposed flatten PRs, Flatten MCP namespace tools for unsupported providers openai/codex#28271 and #29602, were closed without merging.
apply_patch is a freeform custom tool with a Lark grammar (handlers/apply_patch_spec.rs L9-L30). ApplyPatchToolType has only Freeform (protocol/src/openai_models.rs L321-L325), and every model in the bundled catalog uses it.
So a test that drives Codex with aimock can't yet exercise an MCP tool call, a sub-agent or a file edit.
Possible shape
A suggestion only; whatever fits aimock's fixture model is fine.
- An optional
namespaceonToolCall, emitted on the Responsesfunction_callitem over HTTP (streaming and non-streaming) and WebSocket. - A custom tool call fixture, e.g.
{ "type": "custom", "name": "apply_patch", "input": "..." }, emitted as acustom_tool_callitem and streamed withresponse.custom_tool_call_input.deltaand.done.
Related, on the request side: toolName matching only sees top-level function tools. responsesToolsToCompletionsTools drops namespace and custom tools (src/responses.ts L230-L240, src/router.ts L501-L504), so a fixture can't match on a tool offered inside a namespace or as a custom tool.
Related, on recording: collapseOpenAISSE keeps call_id, name and arguments from a Responses function_call (src/stream-collapse.ts L523-L538), so a recorded namespaced call loses its namespace.
Activity
chore: merge main (#509) into #505 branch
feat: namespaced function calls and custom tool calls on the Response…
feat(record): keep Responses namespace and custom tool calls in recor…
fix: restore 1.44.0 default behavior; make new Responses/misbehavior/…
jpr5 commentedon Oct 10, 2026
Shipped in 1.45.0 (npm @copilotkit/aimock, PyPI aimock-pytest 0.7.0).
Responses API fixtures can now carry namespaced function calls (
function_call.namespace) and custom tool calls (customToolCalls, emitted ascustom_tool_callitems withresponse.custom_tool_call_input.delta/.doneevents). Recording captures both. Matching onmatch.toolNamespaceis supported.This is opt-in, so existing setups behave exactly as in 1.44.0. Turn it on with
responsesTools: "extended"(option),--responses-tools extended(CLI) orllm.responsesTools: "extended"(config). From pytest, useAIMockServer(responses_tools="extended").Implemented in #511 and #513, made opt-in in #518. Verified against Codex CLI 0.161.0.
feat: emit namespaced function calls and custom tool calls on the Res…
docs(changelog): record namespaced and custom Responses tool calls
feat(record): keep Responses namespace and custom tool calls in recor…
docs(record-replay): document recording of Responses namespaced and c…
chore: merge CopilotKit#505 branch (with CopilotKit#509) into recordi…
docs: describe customToolCalls, responsesBlocks and the responsesTool…