[PR #1241] [CLOSED] serve: the Responses API reads Codex's additional_tools input items as tools (#782) #3330

Closed
opened 2026-11-07 14:40:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1241
Author: @BGonnermann
Created: 10/6/2026
Status: ❌ Closed

Base: main ← Head: serve/responses-additional-tools-782


📝 Commits (2)

  • b02abc3 serve: the Responses API reads Codex's additional_tools input items as tools (#782)
  • 75d3c31 Merge branch 'main' into serve/responses-additional-tools-782

📊 Changes

3 files changed (+86 additions, -178 deletions)

View changed files

📝 docs/DETAILS.md (+2 -2)
📝 serve/responses.py (+24 -8)
📝 serve/test_responses.py (+60 -168)

📄 Description

Fixes #782.

The problem

Codex (0.160.0 in the report, and Xcode's bundled Codex agent in the comment) can send its tools inside input:

{"type": "additional_tools", "role": "developer", "tools": [ ... ]}

input_messages() refused the item with a 400 (input items of type 'additional_tools' are not supported), so the
request never ran and the client fell back to shell commands.

What the item is

The issue has only a second-hand description, so I read it in openai/codex:

  • codex-rs/app-server-protocol/schema/typescript/ResponseItem.ts: { "type": "additional_tools", id?, role: string, tools: unknown[] }.
  • codex-rs/core/tests/suite/responses_lite.rs: in this mode the request has no tools and no instructions;
    input[0] is the additional_tools item and its tools are compared with what tools holds in the standard mode
    (the same format: function, namespace, hosted tools).
  • codex-rs/core/tests/suite/scenarios_incremental_tools.rs: when the tools change, another item is appended. Its
    namespace's description is the text "This is an incremental namespace update. Previously declared tools remain
    available ... If a tool is redefined here, its latest definition replaces the earlier one." A removed tool is
    announced by a developer message, not by an item.

The change

Where Change
input_messages() An additional_tools item makes no message. Without a tools array it is a 400 naming input[i].tools.
request_tools() The tools are tools, then those of the additional_tools items, in order. So the same tools give the same prompt as the old request form. Errors name input[i].tools[j].
request_tools() A tool defined again replaces the earlier definition in its place.
request_tools() A namespace keeps the description it was first declared with, so Codex's update note is not shown to the model as the description of the tools.
docs/DETAILS.md Two rows of the Responses table.

Things to know

  • Replacing in place also applies to a name that appears twice in tools. Before, both definitions went into the
    prompt. Say so if you want that left as it was.
  • Nothing removes a tool: Codex's removal notice is a developer message, and the model reads it as text.
  • The tools are at the start of the prompt. When Codex appends an update item, the next request reads the whole prompt
    again instead of continuing from the conversation cache. I did not measure how often Codex does that.

Tests

python -m unittest serve.test_responses: 23 pass (21 before, 2 new), Windows 11, Python 3.14.7, mock engine.

  • test_additional_tools_items: the item is not a message; its tools equal the ones tools would give; an update
    item replaces one member and adds a tool; the namespace description is kept; tools come first; tool_choice: none;
    three malformed items.
  • AdditionalTools.test_a_request_with_its_tools_in_the_input: Codex's request form over HTTP, plain and streamed:
    200, a function_call comes back, and the prompt the engine got holds the tool and the developer text.

Not tested with a real Codex or a real model: I do not have the setup of the report. @Anivie and @hys17, a run on your
side would settle it.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1241 **Author:** [@BGonnermann](https://github.com/BGonnermann) **Created:** 10/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `serve/responses-additional-tools-782` --- ### 📝 Commits (2) - [`b02abc3`](https://github.com/Niko1221/Strata/commit/b02abc3ec73c81ab48548083fc17599101f630f4) serve: the Responses API reads Codex's additional_tools input items as tools (#782) - [`75d3c31`](https://github.com/Niko1221/Strata/commit/75d3c316548612a2bdb48313e2293353d356c09a) Merge branch 'main' into serve/responses-additional-tools-782 ### 📊 Changes **3 files changed** (+86 additions, -178 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+2 -2) 📝 `serve/responses.py` (+24 -8) 📝 `serve/test_responses.py` (+60 -168) </details> ### 📄 Description Fixes #782. ## The problem Codex (0.160.0 in the report, and Xcode's bundled Codex agent in the comment) can send its tools inside `input`: ```json {"type": "additional_tools", "role": "developer", "tools": [ ... ]} ``` `input_messages()` refused the item with a 400 (`input items of type 'additional_tools' are not supported`), so the request never ran and the client fell back to shell commands. ## What the item is The issue has only a second-hand description, so I read it in openai/codex: - `codex-rs/app-server-protocol/schema/typescript/ResponseItem.ts`: `{ "type": "additional_tools", id?, role: string, tools: unknown[] }`. - `codex-rs/core/tests/suite/responses_lite.rs`: in this mode the request has no `tools` and no `instructions`; `input[0]` is the `additional_tools` item and its `tools` are compared with what `tools` holds in the standard mode (the same format: `function`, `namespace`, hosted tools). - `codex-rs/core/tests/suite/scenarios_incremental_tools.rs`: when the tools change, another item is appended. Its namespace's `description` is the text "This is an incremental namespace update. Previously declared tools remain available ... If a tool is redefined here, its latest definition replaces the earlier one." A removed tool is announced by a developer message, not by an item. ## The change | Where | Change | |---|---| | `input_messages()` | An `additional_tools` item makes no message. Without a `tools` array it is a 400 naming `input[i].tools`. | | `request_tools()` | The tools are `tools`, then those of the `additional_tools` items, in order. So the same tools give the same prompt as the old request form. Errors name `input[i].tools[j]`. | | `request_tools()` | A tool defined again replaces the earlier definition in its place. | | `request_tools()` | A namespace keeps the description it was first declared with, so Codex's update note is not shown to the model as the description of the tools. | | `docs/DETAILS.md` | Two rows of the Responses table. | ## Things to know - Replacing in place also applies to a name that appears twice in `tools`. Before, both definitions went into the prompt. Say so if you want that left as it was. - Nothing removes a tool: Codex's removal notice is a developer message, and the model reads it as text. - The tools are at the start of the prompt. When Codex appends an update item, the next request reads the whole prompt again instead of continuing from the conversation cache. I did not measure how often Codex does that. ## Tests `python -m unittest serve.test_responses`: 23 pass (21 before, 2 new), Windows 11, Python 3.14.7, mock engine. - `test_additional_tools_items`: the item is not a message; its tools equal the ones `tools` would give; an update item replaces one member and adds a tool; the namespace description is kept; `tools` come first; `tool_choice: none`; three malformed items. - `AdditionalTools.test_a_request_with_its_tools_in_the_input`: Codex's request form over HTTP, plain and streamed: 200, a `function_call` comes back, and the prompt the engine got holds the tool and the developer text. Not tested with a real Codex or a real model: I do not have the setup of the report. @Anivie and @hys17, a run on your side would settle it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:40:42 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3330
No description provided.