Skip to content

fix: Handle more events#1164

Merged
BenjaminMichaelis merged 4 commits into
mainfrom
benjaminmichaelis/fix-streaming-textdone-events
Jun 1, 2026
Merged

fix: Handle more events#1164
BenjaminMichaelis merged 4 commits into
mainfrom
benjaminmichaelis/fix-streaming-textdone-events

Conversation

@BenjaminMichaelis
Copy link
Copy Markdown
Member

Description

Describe your changes here.

Fixes #Issue_Number (if available)

Ensure that your pull request has followed all the steps below:

  • Code compilation
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary

…eamingAsync

The OpenAI SDK requires StreamingEnabled to be set to true on
CreateResponseOptions when calling CreateResponseStreamingAsync.
Also propagate StreamingEnabled in CloneOptionsWithPreviousResponseId
so tool-call continuation legs behave consistently.
Handle StreamingResponseOutputTextDoneUpdate in the streaming loop.
Some SDK/server combinations emit completed text parts without delta events,
which previously produced only responseId + [DONE] on the SSE endpoint.
Add per-part delta tracking to avoid duplicate text when both delta and done
updates are present.
Handle StreamingResponseRefusalDeltaUpdate and
StreamingResponseRefusalDoneUpdate in the streaming loop.
This prevents empty SSE responses when the model returns refusal
content via refusal events instead of output-text deltas.
Capture StreamingResponseErrorUpdate, StreamingResponseFailedUpdate,
and StreamingResponseIncompleteUpdate so terminal stream failures are not
silently treated as successful [DONE] completions.
@BenjaminMichaelis BenjaminMichaelis marked this pull request as ready for review June 1, 2026 21:05
@BenjaminMichaelis BenjaminMichaelis merged commit ab3484b into main Jun 1, 2026
8 checks passed
@BenjaminMichaelis BenjaminMichaelis deleted the benjaminmichaelis/fix-streaming-textdone-events branch June 1, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant