Skip to content

fix(python): keep timeout=0 on sandbox create and connect - #1842

Closed
claxman wants to merge 1 commit into
e2b-dev:mainfrom
claxman:fix/1840-timeout-zero
Closed

claxman wants to merge 1 commit into
e2b-dev:mainfrom
claxman:fix/1840-timeout-zero

Conversation

@claxman

@claxman claxman commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #1840

Sandbox.create(timeout=0) and Sandbox.connect(..., timeout=0) used timeout or default, so 0 became 300 seconds. JS create uses timeoutMs ?? default and keeps 0. Fork already used if timeout is not None.

Same if timeout is not None default in sync and async _create and _cls_connect. I did not reject timeout <= 0. JS sends 0.

Testing (no live API):

cd packages/python-sdk && .venv/bin/python -m pytest tests/shared/sandbox/test_timeout.py -q --tb=short

6 passed. Restoring the four or defaults makes the four timeout=0 cases fail with posted timeout 300 instead of 0.

Sandbox.create(timeout=0, api_key=...)
# POST body timeout is 0, not 300

timeout or default treated 0 as missing and posted 300 seconds. JS uses ?? and keeps 0. Fork already used if timeout is not None.
@claxman
claxman requested a review from mishushakov as a code owner September 8, 2026 02:12
@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0a0e268

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

This PR includes changesets to release 1 package
Name Type
@e2b/python-sdk 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

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TASTE.md review: checked T-1/T-2 (JS↔sync↔async parity — the is not None default now matches JS timeoutMs ?? default and the existing fork handling, applied identically in sandbox_sync and sandbox_async), T-44/T-47 (sandbox-lifetime clock, default via the named default_sandbox_timeout constant, no magic numbers), T-52 (no client-side rejection of timeout <= 0 — left to the backend). 0 violations; the change complies with TASTE.md.

@claxman

claxman commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot

cla-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@mishushakov

Copy link
Copy Markdown
Member

I believe this is on purpose, keep in mind also that we will be dropping all the SDK defaults from the SDK in favor of backend-defined values:
#1749

@mishushakov mishushakov closed this Sep 8, 2026
@claxman

claxman commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

You're right. timeout or default treating 0 as unset is the current Python idiom, and #1749 is dropping those SDK defaults. Closing this.

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.

Python Sandbox.create(timeout=0) sends the 300s default instead of 0

2 participants