Repository navigation
fix(sandbox): close exec() stdin on trusted-host and accept stdin input - #6022
Conversation
Latest result Pull request merged. Final answersSession Pull request merged. PR #6022 is ready to merge. The assigned head retains the fixes for all six resolved review findings, and no new repair was needed. Hosted CI, changed-file lint, and eight focused stdin regressions passed. The Cloudflare RPC test could not run locally because the sandbox blocks loopback listeners. Session Updated the branch with main because main changed packages/sandbox/README.md, packages/sandbox/src/cloudflare.ts, packages/sandbox/src/error-diagnostics.ts and 12 more after its checks ran; waiting for checks on the new head. Session Updated the branch with main because main changed packages/sandbox/README.md, packages/sandbox/src/cloudflare.ts, packages/sandbox/src/error-diagnostics.ts and 12 more after its checks ran; waiting for checks on the new head. Session Updated the branch with main because main changed packages/sandbox/README.md, packages/sandbox/src/cloudflare.ts, packages/sandbox/src/error-diagnostics.ts and 12 more after its checks ran; waiting for checks on the new head. Session Updated the branch with main because main changed packages/sandbox/README.md, packages/sandbox/src/cloudflare.ts, packages/sandbox/src/error-diagnostics.ts and 12 more after its checks ran; waiting for checks on the new head. Session Updated the branch with main because main changed packages/sandbox/README.md, packages/sandbox/src/cloudflare.ts, packages/sandbox/src/error-diagnostics.ts and 12 more after its checks ran; waiting for checks on the new head. Session CI reconciliation completed; the same-head repair budget is exhausted. |
There was a problem hiding this comment.
Important
The trusted-host EOF fix works. The new stdin option is not portable yet: Crabbox can drop the input, Vercel can reject after a normal exit, and the hosted runtimes can lose normal exec() output and deadline behavior.
Approach: Ignore stdin by default on trusted-host, but keep explicit input on an exec() path that preserves each runtime’s output and command lifecycle.
Reviewed changes
- Trusted-host: Verified EOF for
cat, text input, early exit, and timeout through the built public API. - Shared API and drivers: Traced
exec()andspawn()across the built-in runtimes and custom sessions. Confirmed hosted failures with provider fixtures and checked the Vercel SDK and Crabbox CLI sources. No live hosted runtimes were used. - Tests: 156 tests passed and 6 were skipped across the focused remote-provider, Cloudflare, Crabbox, and container suites. The new trusted-host test fails on this runner because
rgis not installed.
pullfrog(high) | 𝕏
@vite-hub/agent
@vite-hub/auth
@vite-hub/blob
@vite-hub/browser
@vite-hub/bundle
@vite-hub/channels
@vite-hub/choices
@vite-hub/cli
@vite-hub/cms
@vite-hub/codemods
@vite-hub/comments
@vite-hub/connections
@vite-hub/content
create-vitehub
@vite-hub/database
@vite-hub/device
@vite-hub/docs
@vite-hub/email
@vite-hub/env
@vite-hub/forge
@vite-hub/forms
@vite-hub/gateways
@vite-hub/i18n
@vite-hub/kit
@vite-hub/kv
@vite-hub/markdown-template
@vite-hub/mcp
@vite-hub/presets
@vite-hub/queue
@vite-hub/rate-limit
@vite-hub/realtime
@vite-hub/runtime
@vite-hub/sandbox
@vite-hub/schedule
@vite-hub/shell
@vite-hub/source
@vite-hub/sync
@vite-hub/ui
vite-hub
@vite-hub/web-container
@vite-hub/webhooks
@vite-hub/workflow
@vite-hub/workspace
commit: |
MCP eval dry run
Tool list sizeThe characters the model reads: the server instructions, and the name, description, and input schema of each tool.
|

On
trusted-host,exec()started each command with an open stdin pipe that the caller could not write to or close. A command that reads stdin, such ascat,wc -l, orrg authwithout a path, waited until its timeout, or forever without one. A Workspace Session runs its commands through the sameexec(), so it hung too.What changed
trusted-hostexec()now starts the command with stdin connected to/dev/null.catandwc -lread empty input, andrg authsearches the working directory as it does in a terminal.spawn()is unchanged.exec()takes a newstdinoption with text or bytes:session.exec("wc", ["-l"], { stdin: "a\nb\n" }). Trusted-host, container, Vercel, and Cloudflare accept this input and close stdin afterwards. A built-in session that cannot deliver input, such as Crabbox, throwsSANDBOX_EXEC_STDIN_UNSUPPORTEDinstead of silently discarding it. Custom runtimes implement input in their ownsession.exec().exec()deadline, and fatal I/O errors stop only the affected command.SandboxSpawnOptionskeepsstdin?: boolean. It now extendsOmit<SandboxExecOptions, "stdin">.exec()handles stdin.This follows the plan decision for #5972:
exec()closes stdin unless the caller passes stdin content.Verification
main,session.exec("cat", [], { timeout: 3_000 })rejects withTimeoutError: The operation was aborted due to timeout. The regression verifies thatcatandwc -lfinish without input, that text and bytes arrive, and that sending 4 MiB totruestill resolves.vp test runinpackages/sandboxpassed 1046 tests with 7 skipped; the package typecheck, changed-file lint, and root diagnostic tests also passed.Not verified
The original test was run on Linux. No live hosted runtimes were used for this repair; Cloudflare, Vercel, and Crabbox were verified through local fixtures.
Closes #5972
Prepared with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code