Pull requests / #1918
#1918 serve: run Codex's client-side tool_search
closed · @msola-ht · 0 コメント · GitHub で見る
本文
Fixes #1917.
Codex (CLI and Desktop, Responses wire API) declares its deferred tool discovery as
`{"type": "tool_search", "execution": "client"}` with no `name`. `serve/responses.py` listed `tool_search` in
`HOSTED_TOOLS`, so the declaration was dropped and the model never saw it: a Responses client could not reach the
tools it keeps in reserve, and the search that same client runs itself had no way to start.
## What this changes
- `tool_search` is declared to the model as the ordinary function `tool_search`. The model can only call it, the
client runs the search and answers, and the call goes back as a `tool_search_call` item (`execution: "client"`,
`arguments` as an object, no `name`, no argument deltas, `incomplete` if the turn runs out of tokens).
- `tool_search_call` and `tool_search_output` are read back from `input`: the call is replayed as the `tool_search`
call it was, and the tools the search found are declared for that prompt the same way an `additional_tools` item is
read (#782) - a `namespace` of found tools included.
- A `tool_search` a client marks for some other host to run is still left out, like the other hosted tools.
## What it leaves alone
Web search and the other hosted tools are still left out (this server cannot run them) and `tool_choice` still cannot
force a tool. Nothing changes for a request that does not declare `tool_search`: no new config key and no new
default - the client's own declaration is the opt-in, as it is for `additional_tools` (#782) and the
`namespace__name` mapping (#812).
## How I checked
- `python -m unittest serve.test_responses`: 40 tests, 1 skipped, no failures.
- Every new path observed through the Responses API: the declaration, both input items, a search result whose tool
is then called, `execution: "server"` still dropped, and a request with a repeated tool declaration unchanged.
- End to end against a real Codex 0.160 client and an engine: `tool_search_call` -> `tool_search_output` -> the model
calling a tool that only the search had returned.
Not covered: the suite has no test for `tool_search`, and the wire shapes come from measured Codex traffic rather
than a published specification.
関連リンク
インストール・モデル・リリースへの站内リンク。