Fix volume SDK issues: transports, timeouts, empty files, eager stream errors#1431
Conversation
…clients - Python: cache AsyncVolume HTTP transports per event loop (and per proxy) instead of a process-wide singleton; cache sync transports per thread - Python: apply request_timeout (default 60s) to volume metadata operations instead of running with httpx timeouts disabled - Python: send read_file(format="stream") request eagerly so errors raise at call time, matching JS - Python: drop the E2B_ACCESS_TOKEN fallback for volume content auth and stop mutating the caller's headers dict in VolumeConnectionConfig - JS: return empty Blob/ReadableStream/Uint8Array from Volume.readFile for empty files instead of undefined - JS: apply the documented 60s default request timeout to volume content requests Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: dbd37fd The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
PR SummaryMedium Risk Overview Python: Volume content HTTP clients apply the 60s Mock-based tests cover read paths, timeouts, transport caching, and auth/config behavior in both SDKs. Reviewed by Cursor Bugbot for commit dbd37fd. Bugbot is set up for automated code reviews on this repo. Configure here. |
Package ArtifactsBuilt from 679ddad. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.29.2-mishushakov-fix-volume-sdk-issues.0.tgzCLI ( npm install ./e2b-cli-2.11.2-mishushakov-fix-volume-sdk-issues.0.tgzPython SDK ( pip install ./e2b-2.28.2+mishushakov.fix.volume.sdk.issues-py3-none-any.whl |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 528e97bfe1
ℹ️ 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".
| def get_transport(config: VolumeConnectionConfig) -> AsyncTransportWithLogger: | ||
| if AsyncTransportWithLogger.singleton is not None: | ||
| return AsyncTransportWithLogger.singleton | ||
| key: TransportKey = (id(asyncio.get_running_loop()), config.proxy) |
There was a problem hiding this comment.
Key async transport cache by loop objects
When async volume calls are made from sequential event loops (for example repeated asyncio.run(...) calls in a worker or test harness), CPython can reuse the object id of a closed loop almost immediately. Because this cache stores only id(get_running_loop()), a new loop can receive the AsyncHTTPTransport created for the previous closed loop, reintroducing the cross-loop/closed-loop transport failures this change is meant to avoid. Keying by the loop object itself, preferably with weak references, avoids stale id collisions.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
it's same defect as the rest of the SDK, would merge as-is and then do a follow up PR that fixes that in both. @matthewlouisbrockman for visibility
…n SDK Drop the eager-send change so the stream request is still deferred to first iteration; keep the stream tests but assert errors while consuming instead of at call time. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fixes a batch of review findings in the JS and Python volume SDKs, aligning behavior between the two. Python now caches
AsyncVolumeHTTP transports per event loop and proxy (sync per thread) instead of a process-wide singleton, applies the 60s defaultrequest_timeoutto metadata operations that previously ran with httpx timeouts disabled, no longer falls back toE2B_ACCESS_TOKENfor volume content auth, and no longer mutates the caller'sheadersdict. JSVolume.readFilenow returns empty values instead ofundefinedfor empty files, and volume content requests get the documented 60s default request timeout. All changes are covered by new mock-based unit tests (no live API needed) plus changesets for both SDKs.Usage examples
🤖 Generated with Claude Code