fix(sandbox): initialize API client in Command before reading output#130
Merged
fix(sandbox): initialize API client in Command before reading output#130
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ced7247 to
bf96d74
Compare
There was a problem hiding this comment.
Pull request overview
Fixes a workflow deserialization edge-case in @vercel/sandbox where Command/CommandFinished instances lose their _client, causing stdout()/stderr()/output() to fail when getCachedOutput() synchronously calls logs().
Changes:
- Initialize the API client inside
Command.getCachedOutput()before invokinglogs(). - Add a patch changeset describing the fix for deserialized
Commandinstances.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/vercel-sandbox/src/command.ts | Ensures _client is lazily initialized before logs() is called during cached output retrieval. |
| .changeset/fix-command-ensure-client.md | Publishes the fix as a patch with a clear user-facing note. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bf96d74 to
f6c7212
Compare
f6c7212 to
9ba118c
Compare
QuiiBz
approved these changes
Apr 2, 2026
QuiiBz
pushed a commit
that referenced
this pull request
Apr 2, 2026
…tion (#129) ## Summary - Removes `steps/sandbox.ts` — the wrapper functions (`createSandbox`, `execute`, `stopSandbox`) were redundant since `Sandbox.create()` and all instance methods already have `"use step"` built in - Inlines all Sandbox calls directly in the `"use workflow"` function in `workflows/code-runner.ts` - Passes code as a string to `writeFiles()` instead of wrapping with `Buffer.from()` (which is unavailable in the workflow runtime) Depends on #130.
Merged
QuiiBz
pushed a commit
that referenced
this pull request
Apr 2, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## sandbox@2.5.8 ### Patch Changes - Updated dependencies \[[`b91b9e49fb7d2c5a4b601c07c125e6e5a2c43441`](b91b9e4)]: - @vercel/sandbox@1.9.2 ## @vercel/sandbox@1.9.2 ### Patch Changes - Fix `stdout()`/`stderr()`/`output()` failing on deserialized `Command` instances with "logs() requires an API client" error. ([#130](#130)) ## sandbox-filesystem-snapshots@0.0.13 ### Patch Changes - Updated dependencies \[[`b91b9e49fb7d2c5a4b601c07c125e6e5a2c43441`](b91b9e4)]: - @vercel/sandbox@1.9.2 ## workflow-code-runner@0.1.2 ### Patch Changes - Updated dependencies \[[`b91b9e49fb7d2c5a4b601c07c125e6e5a2c43441`](b91b9e4)]: - @vercel/sandbox@1.9.2 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Summary
stdout(),stderr(), andoutput()failing with "logs() requires an API client" on deserializedCommand/CommandFinishedinstances_clientis null.getCachedOutput()callslogs()which is synchronous and throws immediately if_clientis not set. The fix callsensureClient()beforelogs()to lazily initialize the client.throwIfAborted()guard beforeensureClient()to short-circuit on already-aborted signals, matching the pattern inwait()CommandFinishedwithout cached output to exercise the fix