Repository navigation
feat(sdk): add opt-in stdin for detached commands - #365
Merged
Merged
Conversation
runCommand accepts `stdin: true` (detached only), and Command gains writeStdin() and closeStdin(). Writes are serialized per command, split into 512 KiB chunks, and never retried so bytes can't be delivered twice.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Workflow DevKit retries failed steps by default, which could resend stdin bytes, so writeStdin and closeStdin now run with maxRetries 0. Rate limited writes are retried again since they were never applied. A write that fails after possibly delivering data now blocks later writes instead of appending to a partial message, an abort while waiting in the queue takes effect, and CommandFinished rejects stdin calls with a clear error.
Each workflow step gets a freshly deserialized Command, so the write queue and the rejection after a failed write don't carry across steps.
kishorekrd
force-pushed
the
kishore/command-stdin
branch
from
October 6, 2026 18:04
9509d26 to
f420931
Compare
Each stdin request now carries the position it starts at, so a request that fails on a dropped connection or a restarting server is resent without delivering the same bytes twice. Timeouts are only resent while the process keeps reading.
Passing a Readable such as process.stdin as `stdin` pipes it to the command and closes stdin when it ends, with or without `detached`.
kishorekrd
marked this pull request as ready for review
October 8, 2026 21:00
- Close stdin at the position the API reports once a write has failed, instead of a stale one the API rejects. - Treat a client error that follows a resent request as possibly written, so later writes are rejected. - Use the bytes written a timeout reports instead of asking for them. - Report a stream failure to one wait() and let later calls wait for exit, keep piping when a wait is aborted, close stdin when the stream is destroyed before it ends, and read a stream the caller paused.
QuiiBz
reviewed
Oct 9, 2026
QuiiBz
reviewed
Oct 9, 2026
QuiiBz
reviewed
Oct 9, 2026
QuiiBz
approved these changes
Oct 9, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds stdin for commands, mainly to run stdio MCP servers (like
agent-browser mcp) in a sandbox.stdin: trueneedsdetached: true. AReadableis written in order with backpressure, and stdin closes when it ends. The caller's stream is never destroyed.runCommandrejects and kills the command. When detached, the nextwait()rejects instead.closeStdinstill works.@vercel/sandbox-mocksupport is a follow-up.Needs backend support that ships separately. The integration tests fail until it's deployed.