Skip to content

feat(code-interpreter): route Jupyter requests through the unified sandbox endpoint - #1963

Merged
mishushakov merged 4 commits into
mainfrom
devin/1791479609-ci-unified-endpoint
Oct 9, 2026
Merged

mishushakov merged 4 commits into
mainfrom
devin/1791479609-ci-unified-endpoint

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

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 the E2b-Sandbox-Id / E2b-Sandbox-Port: 49999 headers these requests already sent.

  • JS: jupyterUrl calls connectionConfig.getSandboxUrl(...) instead of getSandboxDirectUrl(...). Browsers still use the per-port host (49999-<id>.<domain>) because of the existing CORS restriction in getSandboxUrl.
  • Python SDK: ConnectionConfig.get_sandbox_url / get_sandbox_direct_url take an optional port (defaults to the envd port), matching the port option JS getSandboxUrl / getSandboxDirectUrl already have.
    def get_sandbox_url(self, sandbox_id: str, sandbox_domain: str, port: Optional[int] = None) -> str
  • Python Code Interpreter: sync and async _jupyter_url return connection_config.get_sandbox_url(sandbox_id, sandbox_domain, port=JUPYTER_PORT). Its e2b floor 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:

sbx = Sandbox.create()        # E2B_DOMAIN=e2b.app
sbx.run_code("print(1)")      # before: POST https://49999-<id>.e2b.app/execute
                              # after:  POST https://sandbox.e2b.app/execute  (E2b-Sandbox-Id: <id>, E2b-Sandbox-Port: 49999)

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 through sandbox.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

…ndbox endpoint

Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
@cla-bot cla-bot Bot added the cla-signed label Oct 8, 2026
@changeset-bot

changeset-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bddfe5f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@e2b/code-interpreter Patch
@e2b/code-interpreter-python Patch

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

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@mishushakov
mishushakov marked this pull request as ready for review October 8, 2026 17:18
@mishushakov
mishushakov self-requested a review as a code owner October 8, 2026 17:18
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from 0a6411c. Download artifacts from this workflow run.

JS SDK (e2b@2.55.1-devin-1791479609-ci-unified-endpoint.0, with @e2b/dockerfile-utils@0.1.1-devin-1791479609-ci-unified-endpoint.0):

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.tgz

CLI (@e2b/cli@2.21.3-devin-1791479609-ci-unified-endpoint.0):

npm install ./e2b-cli-2.21.3-devin-1791479609-ci-unified-endpoint.0.tgz

Code Interpreter JS SDK (@e2b/code-interpreter@2.8.3-devin-1791479609-ci-unified-endpoint.0):

npm install ./e2b-code-interpreter-2.8.3-devin-1791479609-ci-unified-endpoint.0.tgz

Desktop JS SDK (@e2b/desktop@2.4.1-devin-1791479609-ci-unified-endpoint.0):

npm install ./e2b-desktop-2.4.1-devin-1791479609-ci-unified-endpoint.0.tgz

Python SDK (e2b==2.55.0+devin.1791479609.ci.unified.endpoint, with e2b-dockerfile-utils==0.1.0+devin.1791479609.ci.unified.endpoint):

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.whl

Code Interpreter Python SDK (e2b-code-interpreter==2.10.3+devin.1791479609.ci.unified.endpoint):

pip install ./e2b_code_interpreter-2.10.3+devin.1791479609.ci.unified.endpoint-py3-none-any.whl

Desktop Python SDK (e2b-desktop==2.6.1+devin.1791479609.ci.unified.endpoint):

pip install ./e2b_desktop-2.6.1+devin.1791479609.ci.unified.endpoint-py3-none-any.whl

devin-ai-integration[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Devin Review

… and async

Co-Authored-By: mish@e2b.dev <mish@e2b.dev>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mishushakov

Copy link
Copy Markdown
Member

check above

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

On it. I'm switching to the base-SDK fix:

  • ConnectionConfig.get_sandbox_url / get_sandbox_direct_url get an optional port argument (defaults to the envd port, minor changeset for @e2b/python-sdk).
  • Code Interpreter calls get_sandbox_url(..., port=JUPYTER_PORT), and its own urls.py helper is removed.
  • The Code Interpreter e2b floor moves to >=2.55.0, the next minor given the pending changesets.

Written by Devin

…ter Jupyter URL

Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread .changeset/sandbox-url-port.md Outdated
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
@mishushakov
mishushakov merged commit 0ad4ec1 into main Oct 9, 2026
37 checks passed
@mishushakov
mishushakov deleted the devin/1791479609-ci-unified-endpoint branch October 9, 2026 14:05
mishushakov added a commit that referenced this pull request Oct 9, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant