Repository navigation
fix(sdk): stream Python responses without 4 KB buffering - #1296
Draft
dewanshshekhar wants to merge 1 commit into
Draft
dewanshshekhar wants to merge 1 commit into
dewanshshekhar wants to merge 1 commit into
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.
Summary
The Python SDK waits for 4096 bytes (or EOF) before delivering small SSE responses. The same fixed-size read can split a UTF-8 character and raise
UnicodeDecodeErrorduring an otherwise valid response. Exiting on[DONE], closing the iterator early, or encountering a decode error also leaves the HTTP response open.Changes
[DONE], consumer cancellation, and errors.Testing
UnicodeDecodeErrorat byte 4095).python -m unittest discover -s sdk/python -vpassed all seven tests on Windows / Python 3.11.15, including CRLF, non-JSON data and HTTP-error compatibility cases.cargo fmt --all -- --checkpassed. Python 3.8 syntax parsing andgit diff --checkpassed.cargo clippy --workspace --all-targets -- -D warningspassescargo test --workspacepassesThe Rust build, Clippy and workspace-test attempts used
--locked --offlineand stopped at missing cached dependencyasync-trait. They are not reported as passing. This draft changes only the Python SDK and its tests; the repository's existing Rust CI remains available for validation.Security
Prepared with OpenAI Codex assistance. Submitted as a draft for maintainer review.