Repository navigation
Conversation
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.
Bug
The shared SDK SSE iterator yields every JSON payload as a successful event, including server error frames delivered after HTTP 200. A consumer can finish a failed text or speech generation without an exception, or receive an API error as a transcription delta and later lose its cause to the generic incomplete-transcript error.
The Anthropic streaming contract includes in-stream error events; MiniMax's text endpoint uses this compatible format. The CLI audio decoder already checks both
errorand nonzerobase_resp.status_code, but the SDK shared iterator does not.Fix
Check both error shapes before yielding and reuse
mapApiError, including the response URL for endpoint-specific hints. Keep JSON parsing in its own catch so quota/content-filter errors are not relabeled as parse failures. Preserve previous valid chunks, successful status code 0, empty events and[DONE]handling. No new dependency or public API.This is separate from #279 (response-body ownership/cleanup). It does not duplicate that cleanup change or claim to solve it.
Validation
test/sdk/speech.test.ts.Full-suite validation uses temporary configuration, a process-local no-op URL opener and a validation-only fetch preload rejecting external hosts by default (test-owned mocks can override it). Windows OAuth/full-suite tests were not run because of the existing browser-opening mock issue. No existing assertions, timeouts or skip conditions were relaxed.
Implemented and tested with Codex assistance.
Need help on this PR? Tag
@codesmith-botwith what you need.