fix: debug-mode Sandbox.connect() and Unset token handling in Python connect()#1428
Conversation
…okens Sandbox.connect() now short-circuits in debug mode like Sandbox.create() (JS, Python sync, Python async). The Python SDK also normalizes absent envd/traffic access tokens from the Unset sentinel to None, fixing broken signed download/upload URLs for non-secure sandboxes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR SummaryLow Risk Overview In Python, Unit tests cover debug connect (no API), env debug, instance connect, and unset token normalization in JS and both Python flavors. Reviewed by Cursor Bugbot for commit 953b293. Bugbot is set up for automated code reviews on this repo. Configure here. |
🦋 Changeset detectedLatest commit: 953b293 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 |
Package ArtifactsBuilt from 78be199. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.29.2-mishushakov-fix-sandbox-connect-bugs.0.tgzCLI ( npm install ./e2b-cli-2.11.2-mishushakov-fix-sandbox-connect-bugs.0.tgzPython SDK ( pip install ./e2b-2.28.2+mishushakov.fix.sandbox.connect.bugs-py3-none-any.whl |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d6bbee7. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6bbee771c
ℹ️ 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".
…rt-circuits connect/create Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Description
Sandbox.connect()now short-circuits in debug mode instead of calling the control plane, matchingSandbox.create()— fixed in the JS SDK and both sync/async Python SDKs (static and instance variants). The Python SDK'sconnect()also previously passed the generated client'sUnsetsentinel through as the envd/traffic access tokens when they were absent (non-secure sandboxes), which madedownload_url()/upload_url()emit broken signed URLs;_cls_connectnow normalizes the response intoSandboxCreateResponsewith properNonevalues, the same pattern_create_sandboxalready uses. DeadUnsetchecks and the now-unused generatedSandboxmodel import were cleaned up, and unit tests cover both behaviors in all three implementations. Debug mode is resolved throughConnectionConfig, so theE2B_DEBUGenv var triggers the short-circuit in bothconnect()andcreate(), not just an explicitdebug=True.Usage
Testing
New unit tests in
tests/sandbox/connect.test.ts,tests/sync/sandbox_sync/test_connect.py, andtests/async/sandbox_async/test_connect.py; existing connect integration suites pass against the live API (8/8 sync Python, 8/8 async Python, 6/6 JS).🤖 Generated with Claude Code