Skip to content

fix: remove dead error event code in _streaming.py#3455

Open
C1-BA-B1-F3 wants to merge 1 commit into
openai:mainfrom
C1-BA-B1-F3:fix/remove-dead-error-code
Open

fix: remove dead error event code in _streaming.py#3455
C1-BA-B1-F3 wants to merge 1 commit into
openai:mainfrom
C1-BA-B1-F3:fix/remove-dead-error-code

Conversation

@C1-BA-B1-F3

Copy link
Copy Markdown

Summary

Removes unreachable error event handling code in both Stream.__stream__ and AsyncStream.__stream__.

What was dead

Inside the Assistants thread. event branch (if sse.event.startswith("thread.")), there was a check for sse.event == "error". Since "error" never starts with "thread.", this branch could never execute — it was dead code.

The correct error handling for non-thread events already exists in the else branch.

Changes

  • Remove 28 lines of dead code (sync + async versions)
  • No behavioral changes

The error event handling inside the Assistants thread. event branch is
unreachable because 'error' doesn't start with 'thread.'.

The helper already handles this case correctly in the else branch.
@C1-BA-B1-F3 C1-BA-B1-F3 requested a review from a team as a code owner June 29, 2026 18:35

@nomiveritas nomiveritas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The removed sse.event == "error" check was unreachable because it was nested under sse.event.startswith("thread."). Error events are already handled in the non-thread branch, so this is a pure dead-code cleanup with no behavioral change.

Respectfully Nomiveritas

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.

2 participants