Repository navigation
fix(providers): Responses API tool call args dropped when delta uses output_index - #942
Merged
Merged
Conversation
…allback (#940) The handleFuncArgsDelta handler only matched delta events by item_id or call_id. When the OpenAI Responses API sends delta events with only output_index (no item_id/call_id), the lookup silently failed and tool call arguments stayed empty — causing the tool validator to fail with EOF. Fix: handleOutputAdded now also stores output_index in the idMap, and handleFuncArgsDelta falls back to output_index when item_id and call_id lookups both miss. Closes #940
|
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
output_indexinstead ofitem_id/call_idoutput_indexas a third fallback key in the delta-to-tool-call mappingRoot Cause
handleFuncArgsDeltamatched delta events to tool calls using onlyitem_idandcall_id. The OpenAI Responses API can sendresponse.function_call_arguments.deltaevents with onlyoutput_index— when this happens, the ID lookup fails silently, args stay asjson.RawMessage("")(serializes tonull), and the tool validator fails with EOF.Fix
handleOutputAddednow storesoutput_index(as"idx:N") in theidMapalongsideitem.idanditem.call_idhandleFuncArgsDeltafalls back tooutput_indexwhen bothitem_idandcall_idlookups missTest plan
TestHandleFuncArgsDelta_OutputIndexOnly— reproduces the exact openai responses API: tool call arguments not accumulated during streaming #940 failure: delta with only output_index, no item_id/call_idTestHandleFuncArgsDelta_IDMatching— verifies all three ID types are stored in idMapTestHandleFuncArgsDelta_CallIDFallback— call_id-only deltaTestStreamResponsesResponse_ToolCallAccumulation— end-to-end SSE stream with full tool call lifecycleCloses #940