Repository navigation
fix(codex): keep the tool name on streamed tool calls - #402
Merged
caigee-cmd merged 2 commits intoOct 26, 2026
Merged
Conversation
The Responses stream carries a function call's name on response.output_item.added, while the function_call_arguments events that follow carry only the item id. The relay parsed the item for type and status only, so the chunk announcing the call went out with an empty name: clients could not dispatch it, and a client that replayed that empty name in history had every later request rejected with "Invalid 'input[n].name': empty string". Record the name and call_id from the item and use them when the call is announced. Non-tool items are skipped so a reasoning item neither consumes a tool-call index nor emits a chunk.
caigee-cmd
approved these changes
Oct 26, 2026
caigee-cmd
left a comment
Owner
There was a problem hiding this comment.
The empty function.name on streamed Codex tool calls is a real client-breaking bug: the name lives on response.output_item.added, and the argument events that follow only carry item_id. Recording name / call_id there, skipping non-tool items so a reasoning item cannot steal index 0, and covering both with tests is the right fix.
Changelog fragment is bilingual. Approving.
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.
Summary
function.name. The Responses stream puts the name onresponse.output_item.added'sitem; thefunction_call_arguments.*events that follow carry onlyitem_id.sse.goparsed the item fortype/statusonly, so the chunk that announces the call sentname: "".unknown tool ""), and once that empty name is replayed in the request history the upstream rejects every later turn withInvalid 'input[6].name': empty string. Expected a string with minimum length 1, but got an empty string instead.item.name/item.call_idperoutput_indexwhen the item is afunction_call(orcustom_tool_call), and use them when the call is announced. Non-tool items are skipped, so a reasoning item neither takes a tool-call index nor emits a chunk.Reproduction
Same request, one field differs:
stream: false{"id":"call_…","type":"function","function":{"name":"get_weather","arguments":"{\"city\":\"Tokyo\"}"}}stream: true{"index":0,"id":"fc_…","type":"function","function":{"name":"","arguments":"{\"city\":\"Tokyo\"}"}}Test plan
go test ./internal/providers/codex/ -count=1— greengo vet ./...— greengo test ./...— not green in this environment, onorigin/mainas well:internal/api,internal/executor,internal/providers/qoder,internal/runtime,internal/storefail on a cleanf16d802worktree (Windows path handling and a missingqodercliinPATH).internal/providers/codexpasses both before and after this diff.cd worker && npm test— no worker changes in this diffcd frontend && npm run build && npm run lint— no frontend changes in this diffchangelog/unreleased/codex-stream-tool-name.mdNew tests in
internal/providers/codex/sse_test.go:TestRewriteStreamKeepsToolNameFromOutputItem— fails before the change with"name":""in the announcing chunk, passes after.TestRewriteStreamIgnoresNonToolOutputItems— areasoningitem must not consume tool-call index 0 or emit a chunk.