Repository navigation
fix(stream): alias tool_search on the generate wire for Responses models - #170
Closed
farhantawfeeq56 wants to merge 1 commit into
Closed
farhantawfeeq56 wants to merge 1 commit into
farhantawfeeq56 wants to merge 1 commit into
Conversation
Command Code's /alpha/generate backend rebuilds OpenAI Responses items for Responses-backed models. It special-cases a tool literally named `tool_search` and drops the required `arguments` from that item, so every follow-up turn fails with `400 Missing required parameter: 'input[N].arguments'` (reported on gpt-6-luna). Send the tool as `search_tools` in the generate payload (tool list, tool calls, and tool results) and map the model's `search_tools` call back to `tool_search` before handing it to the host. The alias is enabled only for models served by the Responses wire, so Chat Completions (DeepSeek) and Anthropic models keep their existing names and behavior.
farhantawfeeq56
requested review from
karaaslanz,
patlux and
pierreraby
as code owners
October 20, 2026 07:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Using
gpt-6-luna(and likely other Responses-backed models) on a plan without Provider API access routes every request through the/alpha/generatefallback. After the model callstool_search, every follow-up turn fails with:The session cannot recover. I reproduced it with a minimal generate request:
tool_search+ its resultMissing required parameter: 'input[2].arguments'bashsearch_toolstool_searchcall withdeepseek/deepseek-v4.1-flashSo the backend special-cases a tool literally named
tool_searchwhen it rebuilds OpenAI Responses items and drops the requiredarguments. The provider sends valid tool-call input; the bug only affects the generate wire and Responses-backed models.Summary
tool_search→search_toolsin the/alpha/generatepayload (tool declarations, replayed calls, and tool results) for models served by the OpenAI Responses wire.search_toolscall back totool_searchbefore emitting it to the host, so the call still runs the real tool.isResponsesModelcore dependency wired from the registered model catalog. Chat Completions (DeepSeek) and Anthropic models are untouched.Files changed
src/core.tsTOOL_SEARCH_*constants andwireToolName()/hostToolName()helpers.messagesToCC()andtoolsToJson().search_toolsback totool_search.src/converters.tstoolsToJson()accepts an optionaltoolNameAlias.messagesToCC()acceptstoolNameAliasand applies it to tool calls and tool results. Default behavior is unchanged.src/types.tsCoreDependencies.isResponsesModel.index.tsmodelApismap abovecreateStreamCommandCode()and passedisResponsesModel, resolved from the catalog.tests/test-pure-functions.tstoolsToJson()andmessagesToCC().tests/test-stream.tssearch_tools, response is mapped back totool_search.tool_search.CHANGELOG.mdVerification
npm run typecheckpasses.tests/test-pure-functions.ts,tests/test-stream.ts; 118 tests).gpt-6-luna: previously400 input[70].arguments, now completes normally.npm testpasses excepttests/test-release.mjs, which fails identically on a cleanmaincheckout in this Windows environment (pre-existing CRLF/fixture issue, unrelated to this change).After merge
tool_searchcall recover on the next turn.argumentsfor calls namedtool_search.