mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4621] [Engine] Responses API: run Codex's client-side tool_search, finds declared where the search answered #5116
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5116
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4621
Author: @Krischan-Klug
Created: 10/29/2026
Status: 🔄 Open
Base:
main← Head:feat/responses-tool-search📝 Commits (1)
9b436daserve: Codex's client-side tool_search, its finds declared where the search answered (#1917)📊 Changes
4 files changed (+253 additions, -42 deletions)
View changed files
📝
docs/DETAILS.md(+14 -2)📝
serve/responses.py(+130 -39)📝
serve/server.py(+6 -0)📝
serve/test_responses.py(+103 -1)📄 Description
Problem and result
With
"supports_search_tool": truein its model catalog, Codex (CLI and Desktop, Responses wire API) keeps its MCP toolsout of the request and declares its own tool discovery instead:
{"type": "tool_search", "execution": "client", ...}.serve/responses.pyliststool_searchinHOSTED_TOOLS, so the declaration is dropped (left out the hosted tools tool_search): the model can never reach the tools the client keeps in reserve (#1917).With this change the model gets
tool_searchas a plain function and its call goes back as atool_search_callthatCodex runs. The tools Codex finds (
tool_search_output) are declared in that search's tool result, not in the tool listat the top of the prompt, so the prompt before the search stays the same and the conversation cache holds across the
load.
Related discussion
#1917 (closed in the 0.2.0 tracker reset: "Closed here does not mean rejected"; this PR carries the re-test). It starts
from #1918 by @msola-ht, which its author closed before review; that behaviour was rebuilt by hand on current
mainand @msola-ht is co-author of the commit. There is no maintainer agreement on scope yet: happy to change the approach
or split it.
Approach
tool_searchwithexecution: "client"is declared to the model as the functiontool_search(once). One withoutit stays left out like the other hosted tools: OpenAI's plain
{"type": "tool_search"}is the server-side variant.tool_search_calloutput item:execution: "client",argumentsas an object, noargument deltas,
incompletewhen the turn is cut off inside it.input, atool_search_callis replayed as thattool_searchcall. Atool_search_outputbecomes the call'stool result and holds the found tools in the template's
<tools>form (one JSON object per line). The found tools areadded to the parser's tools and the response's names, so a
namespace.namecall comes back with itsnamespace,but never to the prompt's tool list: it is at the top of the prompt, and adding to it would change the prompt's
start, and drop the cache, with every search.
request's own tool list keeps its per-tool form), and a tool an earlier search already declared is only named
(
Already available: ...). Both follow the order the model reads the results (after_order_tool_results), so aresult's text never depends on later items.
request_tools' declaration code moved to_declare/_declare_tools, so the request's tools and the found toolsare declared by the same code.
additional_tools(#782): no config key, no default changed. Arequest without a client-side
tool_searchrenders byte-identically; the existing tests pass unchanged.Validation
Passed:
python -m unittest serve.test_responseson this branch (base46c152a1): 48 tests OK, 5 of them new: thedeclaration and the hosted variant; the replay with the finds declared in place; a namespace described once and a
tool found again only named, with the results sent back in either order; the prompt start unchanged on the real
template; and an HTTP round trip (search, then a call of a found namespace tool) whose second prompt starts with the
first prompt plus the model's search call.
python -m unittest discover -s serve -p "test_*.py" -t .: 1,221 tests, one error (see Failed).(
codex execwith the Desktop app's codex.exe): the model calledtool_search("node_repl js execute javascript"),Codex returned
mcp__node_repl(js_reset,js,js_add_node_module_dir), the model calledmcp__node_repl.jsand answered. First prompt 10,374 tokens with tool search, 10,716 without; the request after the search reused
10,464 tokens (everything up to and including the search call) and read about 600 new ones.
real threads, re-rendered from their
tool_search_outputitems and counted with the pack's tokenizer, take 3,768and 4,449 tokens. Declaring every find in full with its namespace text before each tool takes 36,003 and 8,036 for
the same items (the first thread found Blender MCP's 12 tools twice, in two parallel searches).
Failed:
serve.test_winjob.TestWinJob.test_children_end_with_a_killed_server:TypeError: argument of type 'NoneType' is not iterablein the test'srunning()helper. It fails the same way on this machine with this change stashed (mainat46c152a1).Not run:
Limits
defer_loading. Codex's own tools and theDesktop app's tools stay inline (about 14,500 of the Desktop's 23,500-token first prompt here).
search_*_docstools.defer_loadingon tools in the request's owntoolsarray (hosted-style deferral) is not handled: those tools aredeclared in full, as before.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.