Skip to content

[sandbox-cli] Add detached command controls - #391

Open
erulkey wants to merge 3 commits into
mainfrom
codex/cli-command-lifecycle
Open

erulkey wants to merge 3 commits into
mainfrom
codex/cli-command-lifecycle

Conversation

@erulkey

@erulkey erulkey commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

The SDK can start a command and return its ID while it keeps running. The CLI currently waits for every sandbox exec command, so terminal users cannot return later to read logs or stop the process. This adds sandbox exec --detach and sandbox commands get|logs|wait|kill for the current running session.

command_id=$(sandbox exec --detach my-sandbox -- npm run dev)
sandbox commands logs my-sandbox "$command_id"
sandbox commands kill my-sandbox "$command_id"

Command lookup requires a running session, so inspecting an ID cannot resume a stopped sandbox into a new session. sandbox run keeps its existing create-and-wait behavior. The generated help and skills/sandbox/SKILL.md include the new commands.

Verified with the built CLI: typecheck and build passed; all 226 CLI tests passed. In a playground sandbox, separate CLI processes started a detached command, streamed its output, waited for exit 0, and killed another command with exit 137 while the sandbox remained running. The test sandbox was removed.

Companion docs: vercel/front#91668. Publish the CLI before merging its new public examples.

@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sandbox Ready Ready Preview, v0 Oct 16, 2026 9:51pm UTC
sandbox-cli Ready Ready Preview, v0 Oct 16, 2026 9:51pm UTC
sandbox-sdk-ai-example Ready Ready Preview, v0 Oct 16, 2026 9:51pm UTC
workflow-code-runner Ready Ready Preview, v0 Oct 16, 2026 9:51pm UTC

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

Additional Suggestion:

The connect command exposes a --detach flag that always errors because connect always runs interactively, and --detach cannot be combined with --interactive.

Fix on Vercel

This branch was successfully deployed

4 active deployments
Preview – sandbox — fab57515 Deployed Oct 16, 2026 by vercel[bot]
Preview – sandbox-sdk-ai-example — fab57515 Deployed Oct 16, 2026 by vercel[bot]
Preview – workflow-code-runner — fab57515 Deployed Oct 16, 2026 by vercel[bot]
Preview – sandbox-cli — fab57515 Deployed Oct 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant