Repository navigation
fix: #3109 stabilize chat completions stream output indexes - #3176
Merged
Merged
Conversation
Co-authored-by: Aphroq <37263590+Aphroq@users.noreply.github.com>
This was referenced May 7, 2026
RudrenduPaul
pushed a commit
to RudrenduPaul/openai-agents-python
that referenced
this pull request
Jun 21, 2026
…enai#3176) Co-authored-by: Aphroq <37263590+Aphroq@users.noreply.github.com>
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.
This pull request fixes #3109 Chat Completions streaming output index allocation for fallback and streamed function calls.
The Chat Completions streaming adapter could reuse or misalign
output_indexvalues when function calls arrived before assistant text, or when reasoning output preceded assistant message events. The fix centralizes stream output slot allocation in a small internal layout helper so streamed function-call events keep their real-time behavior while finalresponse.completed.response.outputorder stays aligned with the emitted stream indexes.It also removes the boolean
output_indexpath for assistant message events after reasoning output and adds regression coverage for fallback-only, streamed, mixed function-call, late-text, and reasoning-before-text cases.