fix(python-sdk): keep streamed request bodies unbuffered across retries - #1718
Conversation
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
🦋 Changeset detectedLatest commit: 8bd0e82 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Package ArtifactsBuilt from c2b95c9. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.44.2-devin-1787165767-unbuffered-retry-streams.0.tgzCLI ( npm install ./e2b-cli-2.16.4-devin-1787165767-unbuffered-retry-streams.0.tgzPython SDK ( pip install ./e2b-2.44.0+devin.1787165767.unbuffered.retry.streams-py3-none-any.whl |
|
@devin-ai-integration instead of any assume we're on the version of pyqwest that ships the retrymode |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2d63c7613
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
|
Done in fe00f13 — dropped the One dependency note: no PyPI release ships |
|
pyqwest v0.10.0 was released |
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
|
Bumped the pin to |
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
Summary
pyqwest's retry middleware keeps a request replayable by mirroring a non-
bytesbody into memory as it is sent, so a streamed upload through the shared retrying transports (files.writeof a file-like object,volume.write_file) reached the wire in chunks yet accumulated its whole body in RAM. curioswitch/pyqwest#219 (released in pyqwest 0.10.0) addsRetryMode.UNBUFFERED, which drops that copy: a streamed body is handed to the next attempt only while nothing has been read from it.That is exactly what the SDK's connect-only retry policy needs — pyqwest raises the builtin
ConnectionError(the only thingshould_retry_responseretries) only before the request body was written, so the stream is still untouched on every failure we retry.bytesbodies (unary RPCs, in-memory writes) stay replayable in either mode.Both
ConnectionRetryTransports (sync + async) now declare it:The pyqwest pin moves to
>=0.10.0,<0.11, the release shippingRetryMode.Tests (
tests/test_retry_stream_buffering.py):should_retry_requestwithRetryMode.UNBUFFERED(the inherited hook returnsTrue— buffered)Link to Devin session: https://app.devin.ai/sessions/895a6967064e425abfc84b8cfbc32910
Requested by: @mishushakov