Repository navigation
fix(sandbox): accept newer E2B SDK transport keywords - #4597
Draft
hemildesai wants to merge 1 commit into
Draft
hemildesai wants to merge 1 commit into
hemildesai wants to merge 1 commit into
Conversation
E2B SDK 2.5x passes http_version and retry_connect to the transport factories Gym replaces with its aiohttp transport (the envd health probe uses retry_connect=False). The replacement rejected both, so every sandbox create failed after the server returned 201. Accept and ignore them: Gym's transport is HTTP/1.1-only and does not retry connects. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Hemil Desai <[email protected]>
7 tasks done
This branch has not been deployed
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.
What changed and why
nemo_gym/sandbox/providers/e2b/_sdk.pyreplaces the E2B SDK'sclient_async.get_transport/get_envd_transportwith a factory that returns Gym's aiohttp-backedGymAiohttpTransport. Newer E2B SDKs (seen with 2.53.1) call these factories with two more keywords:retry_connect(the envd health probe passesretry_connect=False)http_versionGym's replacement rejected both. With e2b 2.53.1 installed, every sandbox create failed right after the server returned 201:
The fix accepts both keywords and ignores them. Gym's transport is HTTP/1.1-only and does not retry connects, so neither has anything to change. Behaviour with older SDKs is unchanged.
uv.lockresolves e2b 2.46.0, which doesn't pass these keywords, so CI didn't catch this. It only shows up when an environment has a newer e2b within the declarede2b>=2.36.0,<3.0.0range.Issue: none filed. This is a small compatibility fix found while running E2B-compatible sandboxes with e2b 2.53.1.
Validation
tests/unit_tests/test_e2b_provider.py: the fake-SDK factory test now also calls the patched factory withhttp_version,for_streamingandretry_connect=False. It fails without the fix (TypeError: ... unexpected keyword argument 'http_version') and passes with it.test_e2b_provider.py,test_e2b_build.pyandtest_opensandbox_http_transport.py: 171 passed with e2b 2.46.0 (locked) and 171 passed with e2b 2.53.1.sandbox_async.get_envd_api(..., retry_connect=False)andclient_async.get_transport(..., http_version="1.1")reproduce the error above without the fix, and returnGymAiohttpTransportwith it.pre-commit run --all-files: passed.Rollout evidence
The failure was first seen in a real sandbox probe against an E2B-compatible gateway with e2b 2.53.1: 10/10 creates returned 201, then failed with the error above. I re-ran the same probe with this fix, with no other code changes:
POST /v2/sandboxes: 10/10 returned 201;POST /v2/sandboxes/{id}/connect: 10/10 returned 200;An end-to-end eval run on the fix is next.
Compatibility
No config or API changes, and no change for e2b versions that don't pass these keywords.
🤖 Generated with Claude Code