Conversation
dvd233
marked this pull request as ready for review
October 6, 2026 03:48
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.
Fixes #277
Summary
Add cleanup to
Client.streamSSEso that, after the parser releases its reader, the SDK cancels its response body when iteration exits. This releases still-open responses after[DONE], consumer break/return, or parsing errors. Cancellation failures preserve the existing result/error.Standalone
parseSSEownership, SSE/CRLF parsing, normal EOF behavior, and public signatures stay unchanged. Regression tests also cover existing transcription cleanup without duplicate underlying cancellation.Only
src/sdk/client.tsandtest/sdk/stream-cleanup.test.tschange. The validation workflow and harness remain on a separate fork-only branch.Validation
da978118b8accb38e007582a8a226ab833bafaad. SDK lifecycle and loopback connection-close probes pass on Node 18.20.8 and Node 24.The full suite uses an offline fetch guard allowing loopback fixtures and blocking external requests/redirects. In-memory probes also run under a socket-denial guard. All credentials/audio are synthetic; no live provider requests were made.
Scope
Cleanup applies after shared SSE iteration starts. Queued
return()still waits for a pendingnext(); never-started generators and text content-type rejection before shared parsing remain unchanged.AI assistance was used for implementation, tests, and automated review.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.