Skip to content

Add sandbox lifecycle create option#1404

Open
matthewlouisbrockman wants to merge 2 commits into
mainfrom
cli-create-lifecycle-json
Open

Add sandbox lifecycle create option#1404
matthewlouisbrockman wants to merge 2 commits into
mainfrom
cli-create-lifecycle-json

Conversation

@matthewlouisbrockman

Copy link
Copy Markdown
Contributor

adds the lifecycle for autoresume/autopause and timeout to the cli

@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9d97411

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

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

@cursor

cursor Bot commented Jun 9, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Scoped CLI option parsing and sandbox create wiring with tests; no auth or core API changes beyond existing SDK options.

Overview
e2b sandbox create now accepts --ontimeout (pause or kill), --autoresume (only with --ontimeout pause), and --timeout (seconds, minimum 30). Those values are passed into Sandbox.create as lifecycle and timeoutMs, and attached sessions use the same timeout for keep-alive and when the terminal disconnects instead of always resetting to 1s. A changeset and vitest coverage were added for parsing, validation, and option wiring.

Reviewed by Cursor Bugbot for commit 9d97411. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread packages/cli/src/commands/sandbox/create.ts Outdated
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from 4f34a40. Download artifacts from this workflow run.

JS SDK (e2b@2.28.3-cli-create-lifecycle-json.0):

npm install ./e2b-2.28.3-cli-create-lifecycle-json.0.tgz

CLI (@e2b/cli@2.11.1-cli-create-lifecycle-json.0):

npm install ./e2b-cli-2.11.1-cli-create-lifecycle-json.0.tgz

Python SDK (e2b==2.27.1+cli-create-lifecycle-json):

pip install ./e2b-2.27.1+cli.create.lifecycle.json-py3-none-any.whl

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: caae7c5dad

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cli/src/commands/sandbox/create.ts
@matthewlouisbrockman matthewlouisbrockman force-pushed the cli-create-lifecycle-json branch from caae7c5 to 8bb1920 Compare June 9, 2026 02:23
Comment thread packages/cli/src/commands/sandbox/create.ts Outdated

@mishushakov mishushakov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

would change DX here by flattening the params, that should also help with parsing.
if you want them under lifecycle anyways, you could also:

e2b sbx create base --lifecycle.autoresume --lifecycle.ontimeout="pause"

Comment on lines +33 to +37
.option(
'--lifecycle <json>',
'sandbox lifecycle JSON, eg. {"onTimeout":"pause","autoResume":true}',
parseLifecycle
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would flatten this to --ontimeout and --autoresume

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.

kk, fixed

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 09d5b1b. Configure here.

Comment thread packages/cli/src/commands/sandbox/create.ts
@matthewlouisbrockman matthewlouisbrockman force-pushed the cli-create-lifecycle-json branch from 09d5b1b to c994bb5 Compare June 10, 2026 02:46
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.

2 participants