Skip to content

fix: #3109 stabilize chat completions stream output indexes - #3176

Merged
seratch merged 1 commit into
mainfrom
fix/chat-completions-stream-output-indexes
May 7, 2026
Merged

seratch merged 1 commit into
mainfrom
fix/chat-completions-stream-output-indexes

Conversation

@seratch

@seratch seratch commented May 7, 2026

Copy link
Copy Markdown
Member

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_index values 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 final response.completed.response.output order stays aligned with the emitted stream indexes.

It also removes the boolean output_index path 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.

@seratch seratch added this to the 0.16.x milestone May 7, 2026
@github-actions github-actions Bot added bug Something isn't working feature:chat-completions labels May 7, 2026
@seratch
seratch merged commit 170ee73 into main May 7, 2026
10 checks passed
@seratch
seratch deleted the fix/chat-completions-stream-output-indexes branch May 7, 2026 06:18
RudrenduPaul pushed a commit to RudrenduPaul/openai-agents-python that referenced this pull request Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:chat-completions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat Completions streaming computes assistant output_index with a bool expression

1 participant