Repository navigation
fix: skip empty events in audio streams - #304
Open
Ricardo-M-L wants to merge 1 commit into
Open
Ricardo-M-L wants to merge 1 commit into
Ricardo-M-L wants to merge 1 commit into
Conversation
Ricardo-M-L
marked this pull request as ready for review
November 8, 2026 18:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 frombreaktocontinuepreserved 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
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 existingno-explicit-anywarning intest/sdk/speech.test.ts:117.git diff --check: passed.Implemented and tested with AI assistance. No live provider calls were made.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.