Skip to content

Skip empty SSE control events - #3836

Closed
seanxuu wants to merge 1 commit into
openai:mainfrom
seanxuu:fix/issue-3833-ignore-empty-sse-events
Closed

Skip empty SSE control events#3836
seanxuu wants to merge 1 commit into
openai:mainfrom
seanxuu:fix/issue-3833-ignore-empty-sse-events

Conversation

@seanxuu

@seanxuu seanxuu commented Sep 10, 2026

Copy link
Copy Markdown

Fixes #3833

Changes being requested

  • I understand that this repository is auto-generated and my pull request may not be merged

Ignore SSE records that contain control metadata but no data before attempting JSON decoding. This keeps Stream and AsyncStream moving to the next valid event while leaving the decoder metadata behavior unchanged.

Additional context & links

The regression test covers both synchronous and asynchronous streams with id/retry control fields followed by a valid JSON event.

Validation

  • uvx --from uv==0.12.1 uv run --locked pytest tests/test_streaming.py -q (22 passed)
  • uvx --from uv==0.12.1 uv run --locked ruff check src/openai/_streaming.py tests/test_streaming.py
  • uvx --from uv==0.12.1 uv run --locked ruff format --check src/openai/_streaming.py tests/test_streaming.py

Ignore empty-data SSE control records before JSON decoding so streams can continue to the next valid event. Add synchronous and asynchronous regression coverage.

Fixes openai#3833

Signed-off-by: Sean <seanxu@connect.hku.hk>
@seanxuu seanxuu closed this Sep 10, 2026
@seanxuu
seanxuu deleted the fix/issue-3833-ignore-empty-sse-events branch September 10, 2026 02:19
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.

Streaming fails on SSE control-only events with empty data

1 participant