Repository navigation
feat(code-interpreter): route Jupyter requests through the unified sandbox endpoint - #1963
Conversation
…ndbox endpoint Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
🦋 Changeset detectedLatest commit: bddfe5f 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 |
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Package ArtifactsBuilt from 0a6411c. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-dockerfile-utils-0.1.1-devin-1791479609-ci-unified-endpoint.0.tgz ./e2b-2.55.1-devin-1791479609-ci-unified-endpoint.0.tgzCLI ( npm install ./e2b-cli-2.21.3-devin-1791479609-ci-unified-endpoint.0.tgzCode Interpreter JS SDK ( npm install ./e2b-code-interpreter-2.8.3-devin-1791479609-ci-unified-endpoint.0.tgzDesktop JS SDK ( npm install ./e2b-desktop-2.4.1-devin-1791479609-ci-unified-endpoint.0.tgzPython SDK ( pip install ./e2b_dockerfile_utils-0.1.0+devin.1791479609.ci.unified.endpoint-py3-none-any.whl ./e2b-2.55.0+devin.1791479609.ci.unified.endpoint-py3-none-any.whlCode Interpreter Python SDK ( pip install ./e2b_code_interpreter-2.10.3+devin.1791479609.ci.unified.endpoint-py3-none-any.whlDesktop Python SDK ( pip install ./e2b_desktop-2.6.1+devin.1791479609.ci.unified.endpoint-py3-none-any.whl |
There was a problem hiding this comment.
Note
Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
… and async Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
There was a problem hiding this comment.
LGTM — straightforward, well-tested routing change. Reviewed the jupyterUrl/_jupyter_url getters in all three implementations (JS, Python sync, Python async) against the base SDK's existing getSandboxUrl/get_sandbox_url pattern — they're logically equivalent, including the debug, sandbox_url-override, sandbox_domain-preference, and browser-CORS-fallback branches. The new/updated test suites (sandboxUrl.test.ts, test_sandbox_url.py) exercise each of those branches for both domains support and no-support cases.
Extended reasoning...
Small, self-contained change (6 files) that routes Jupyter/Code-Interpreter HTTP requests through the same sandbox.<domain> gateway the rest of the SDK already uses, falling back to the legacy per-port host on unsupported domains or in browsers. No auth/crypto logic is touched; the only security-relevant surface is which hostname the client connects to, and that logic mirrors the already-shipped ConnectionConfig.getSandboxUrl/get_sandbox_url implementations verified by reading connectionConfig.ts and connection_config.py. JS and both Python (sync/async) variants were changed in parallel and stayed logically equivalent, each with matching new tests, and a changeset was added.
This review covers commit 5337b3c, which is no longer the latest commit on this pull request; later commits are not covered by it.
|
check above |
|
On it. I'm switching to the base-SDK fix:
|
…ter Jupyter URL Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
…quire e2b>=2.55.1 (#1967) ## Summary Hotfix: `e2b-code-interpreter` 2.10.4 on PyPI is broken. It requires `e2b>=2.55.0` and calls `connection_config.get_sandbox_url(..., port=JUPYTER_PORT)`, but the `port` argument from #1963 isn't in the published e2b 2.55.0. e2b 2.55.0 shipped at 09:34, and #1963 merged after that without a python-sdk changeset. Reproduced on a clean install against prod: ``` pip install e2b-code-interpreter==2.10.4 # resolves e2b 2.55.0 Sandbox.create().run_code("print(1)") # TypeError: ConnectionConfig.get_sandbox_url() got an unexpected keyword argument 'port' ``` The release then failed while trying to republish e2b 2.55.0 from the changed source: PyPI rejected it because `Local file and index file do not match` ([run](https://github.com/e2b-dev/E2B/actions/runs/37941620569/job/113858112984)). This PR: - adds a `@e2b/python-sdk` patch changeset, so `get_sandbox_url(..., port=)` ships as e2b 2.55.1 - adds a `@e2b/code-interpreter-python` patch changeset and raises its floor to `e2b>=2.55.1`, so `pip install -U e2b-code-interpreter` can't keep e2b 2.55.0 (2.10.5) `uv lock` in `packages/code-interpreter-python` produces no diff because uv ignores the specifier on workspace sources. After merging, run Release. Consider yanking `e2b-code-interpreter` 2.10.4 on PyPI. Link to Devin session: https://app.devin.ai/sessions/936595cc854a4ee092ec502d52ec48ab Open in Devin Desktop: https://app.devin.ai/desktop/session/936595cc854a4ee092ec502d52ec48ab?variant=devin Requested by: @mishushakov Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: mish@e2b.dev <mish@e2b.dev>
Summary
Code Interpreter Jupyter requests (
/execute,/contexts…) now go through the unified sandbox endpoint (https://sandbox.<domain>) on supported domains, the same way the base SDK sends envd traffic. Routing relies on theE2b-Sandbox-Id/E2b-Sandbox-Port: 49999headers these requests already sent.jupyterUrlcallsconnectionConfig.getSandboxUrl(...)instead ofgetSandboxDirectUrl(...). Browsers still use the per-port host (49999-<id>.<domain>) because of the existing CORS restriction ingetSandboxUrl.ConnectionConfig.get_sandbox_url/get_sandbox_direct_urltake an optionalport(defaults to the envd port), matching the port option JSgetSandboxUrl/getSandboxDirectUrlalready have._jupyter_urlreturnconnection_config.get_sandbox_url(sandbox_id, sandbox_domain, port=JUPYTER_PORT). Itse2bfloor moves to>=2.55.0, the next minor given the pending changesets. The dedicated HTTP/1.1 Jupyter transport is unchanged.User code doesn't change. Only the host the requests go to does:
Tested against prod (
e2b.app): the full Code Interpreter JS (41) and Python (83) suites pass. run_code with streaming and the context create/list/restart/remove calls succeed throughsandbox.e2b.app(sync and async).Link to Devin session: https://app.devin.ai/sessions/7c087dcec5ee4b49a7b65f9b059ff360
Open in Devin Desktop: https://app.devin.ai/desktop/session/7c087dcec5ee4b49a7b65f9b059ff360?variant=devin
Requested by: @mishushakov