Skip to content

fix: skip empty events in audio streams - #304

Open
Ricardo-M-L wants to merge 1 commit into
MiniMax-AI:mainfrom
Ricardo-M-L:codex/skip-empty-audio-sse-20261109
Open

Ricardo-M-L wants to merge 1 commit into
MiniMax-AI:mainfrom
Ricardo-M-L:codex/skip-empty-audio-sse-20261109

Conversation

@Ricardo-M-L

@Ricardo-M-L Ricardo-M-L commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem

An empty data: SSE event is currently treated as the end of an audio stream. In an offline synthetic stream, an empty event before audio raises a missing-audio error; an empty event between two chunks returns only the first chunk as a successful result. The parser already emits empty-data events, and other stream consumers skip them.

Skip empty events while continuing to stop at [DONE] and terminal audio status. Tests also cover an API error after an empty event. The reproduction uses synthetic SSE, so it does not establish how frequently the provider sends empty events.

Relationship to #266

#266 addresses streams that end without a completion marker. This change addresses an empty event being mistaken for completion. Both modify the same condition, so they may conflict and should be coordinated rather than treated as unrelated patches. In a temporary checkout of #266 at 2ace327, changing its empty-event branch from break to continue preserved its terminal-marker check: its audio tests plus the tests from this patch and an additional audio → empty event → EOF regression passed (17 tests). This is a local compatibility experiment, not a claim that either PR has merged or that Git will resolve the conflict automatically.

Validation

  • New tests reproduced the missing-audio error and silent truncation on base 38aba5f, and pass with the patch.
  • bun test test/utils/audio-stream.test.ts test/client/stream.test.ts test/commands/speech/synthesize.test.ts: 49 passed.
  • bun run typecheck: passed.
  • bun run lint: passed with one existing no-explicit-any warning in test/sdk/speech.test.ts:117.
  • git diff --check: passed.
  • Two independent agent reviewers checked the final diff and each ran the 24 audio/parser tests successfully. No human or maintainer approval is implied.

Implemented and tested with AI assistance. No live provider calls were made.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@Ricardo-M-L
Ricardo-M-L marked this pull request as ready for review November 8, 2026 18:57
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