Skip to content

test: log the sandbox ID for every sandbox fixture - #1866

Closed
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1789052412-log-sandbox-id
Closed

test: log the sandbox ID for every sandbox fixture#1866
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1789052412-log-sandbox-id

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

The sandbox fixtures in js-sdk and python-sdk only printed the sandbox ID after a test had failed ([TEST FAILED] Sandbox ID: …), so the ID was missing for passing, slow, or timed-out tests, and in pytest also when a later fixture failed during setup (the _test_failed flag was only set for the call phase). Every sandbox created by a fixture is now reported, in every outcome.

Python — instead of printing in teardown, the factories attach the ID to the test report and a tiny plugin prints it next to the result line on the controller. user_properties is what makes this work under pytest-xdist: captured stdout of a worker is only shown for failures, while report properties are always forwarded.

# fixture
request.node.user_properties.append(("sandbox_id", sandbox.sandbox_id))

# SandboxIdReporter.pytest_runtest_logreport (registered only where a terminalreporter exists, i.e. not on xdist workers)
if report.when == "call" and sandbox_ids:
    terminal_reporter.write_line(f"  sandbox_id={' '.join(sandbox_ids)}")
[gw1] [ 50%] PASSED tests/async/sandbox_async/test_kill.py::test_kill
  sandbox_id=iuy39hqehyco6866eg4yg

JS — the fixture does console.log(\sandbox_id=${sandbox.sandboxId}`)right afterSandbox.create. Vitest's default reporter only replays console output for failed tests, so packages/js-sdk/vitest.config.mtsswitches to['verbose', 'github-actions']whenGITHUB_ACTIONS` is set; local runs keep the default reporter (IDs still appear for failures).

stdout | tests/sandbox/kill.test.ts > kill
sandbox_id=ipi7c4wx0j7zhwx755vgt

Not covered: tests that call Sandbox.create directly instead of using the fixtures, and the code-interpreter-* / desktop-* package fixtures.

Link to Devin session: https://app.devin.ai/sessions/cf4d5f1653574607b936e276b2acb02a
Open in Devin Desktop: https://app.devin.ai/desktop/session/cf4d5f1653574607b936e276b2acb02a?variant=devin
Requested by: @mishushakov

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

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@cla-bot cla-bot Bot added the cla-signed label Sep 10, 2026
@changeset-bot

changeset-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 995daf3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from 1610ea2. Download artifacts from this workflow run.

JS SDK (e2b@2.49.1-devin-1789052412-log-sandbox-id.0):

npm install ./e2b-2.49.1-devin-1789052412-log-sandbox-id.0.tgz

CLI (@e2b/cli@2.19.1-devin-1789052412-log-sandbox-id.0):

npm install ./e2b-cli-2.19.1-devin-1789052412-log-sandbox-id.0.tgz

Code Interpreter JS SDK (@e2b/code-interpreter@2.8.1-devin-1789052412-log-sandbox-id.0):

npm install ./e2b-code-interpreter-2.8.1-devin-1789052412-log-sandbox-id.0.tgz

Desktop JS SDK (@e2b/desktop@2.4.1-devin-1789052412-log-sandbox-id.0):

npm install ./e2b-desktop-2.4.1-devin-1789052412-log-sandbox-id.0.tgz

Python SDK (e2b==2.49.0+devin.1789052412.log.sandbox.id):

pip install ./e2b-2.49.0+devin.1789052412.log.sandbox.id-py3-none-any.whl

Code Interpreter Python SDK (e2b-code-interpreter==2.10.0+devin.1789052412.log.sandbox.id):

pip install ./e2b_code_interpreter-2.10.0+devin.1789052412.log.sandbox.id-py3-none-any.whl

Desktop Python SDK (e2b-desktop==2.5.0+devin.1789052412.log.sandbox.id):

pip install ./e2b_desktop-2.5.0+devin.1789052412.log.sandbox.id-py3-none-any.whl

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

Checked the diff against TASTE.md (e2b-dev/sdk-harness): the document governs the public API surface of packages/js-sdk and packages/python-sdk — parity (T-1/T-2), API shape (T-3–T-25), streaming/handles (T-26–T-30), lifecycle (T-31–T-36), naming/casing (T-10–T-12, T-22–T-23), errors (T-57–T-64), deprecation (T-65–T-68), and docs (T-69–T-74).

Violations found: 0. The PR only changes test infrastructure (packages/js-sdk/tests/setup.ts, packages/js-sdk/vitest.config.mts, packages/python-sdk/tests/conftest.py) — it touches no public API surface, so none of the rules apply. Minor notes, not violations: both SDKs emit the same sandbox_id= label, which is consistent; JS relies on the CI-only verbose reporter while Python always writes via a custom reporter plugin, so the two harnesses surface the ID through different mechanics (test-infra divergence, outside TASTE scope).

devin-ai-integration Bot and others added 2 commits September 10, 2026 15:14
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
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