Repository navigation
fix(OpenAI): stream every output item a non-streamed response parses - #833
Merged
iBotPeaches merged 2 commits intoNov 9, 2026
Merged
Conversation
Streaming\OutputItem had its own copy of the item type match from OutputObjects, and the copy fell behind: a custom_tool_call or local_shell_call item threw UnhandledMatchError and ended the stream, while create() parsed the same items. OutputItem now uses OutputObjects::parse(), so both stay in sync, and an unknown item type throws the same UnexpectedValueException as in create(). Also adds the response.custom_tool_call_input.delta and .done events. Without them, a custom tool stream still failed with UnknownEventException.
iBotPeaches
approved these changes
Nov 9, 2026
iBotPeaches
left a comment
Collaborator
There was a problem hiding this comment.
This makes sense to me. I vaguely thought the shapes were different for streaming, but all those entities look to be calling same non-streaming obj.
skybleak333
added a commit
to skybleak333/skybleak333
that referenced
this pull request
Nov 9, 2026
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.
What:
Description:
Streaming a response that calls a custom tool (
{"type": "custom"}) ends withUnhandledMatchError: Unhandled match case 'custom_tool_call'on itsresponse.output_item.addedevent. Alocal_shell_callitem does the same.create()parses both, becauseOutputObjects::parse()knows them, butStreaming\OutputItemhas its own copy of thatmatchand the copy fell behind. #787 and #789 fixed the same gap for one type each.OutputItemnow usesOutputObjects::parse(), so a new output type only has to be added in one place. An unknown item type in a stream now throws the sameUnexpectedValueExceptionascreate()instead ofUnhandledMatchError.The custom tool input also streams in its own events,
response.custom_tool_call_input.deltaand.done(delta, done in openai-python), so they are added too: without them the stream failed one event later withUnknownEventException. I left outobfuscation, since openai-python only declares it onshell_call_command.delta.I also ran it through Guzzle against a local server that sends the events as SSE. On main the stream stops right after the reasoning item, with this branch every event arrives, up to
response.completed.