Skip to content

refactor(workflow-code-runner): inline Sandbox calls in workflow function#129

Merged
QuiiBz merged 2 commits intomainfrom
nr/workflow-code-runner-refactor
Apr 2, 2026
Merged

refactor(workflow-code-runner): inline Sandbox calls in workflow function#129
QuiiBz merged 2 commits intomainfrom
nr/workflow-code-runner-refactor

Conversation

@TooTallNate
Copy link
Copy Markdown
Member

@TooTallNate TooTallNate commented Apr 1, 2026

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.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

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

Project Deployment Actions Updated (UTC)
sandbox Ready Ready Preview, Comment, Open in v0 Apr 2, 2026 4:07pm
sandbox-cli Ready Ready Preview, Comment Apr 2, 2026 4:07pm
sandbox-sdk Ready Ready Preview, Comment Apr 2, 2026 4:07pm
sandbox-sdk-ai-example Ready Ready Preview, Comment Apr 2, 2026 4:07pm
workflow-code-runner Ready Ready Preview, Comment Apr 2, 2026 4:07pm

Request Review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the workflow code runner example to remove the redundant sandbox step wrappers and call @vercel/sandbox APIs directly from the workflow, while also avoiding Buffer.from() in the workflow runtime.

Changes:

  • Removed examples/workflow-code-runner/steps/sandbox.ts (wrapper steps for Sandbox.create(), execution, and stop).
  • Inlined sandbox lifecycle + execution logic directly in examples/workflow-code-runner/workflows/code-runner.ts.
  • Updated writeFiles() usage to pass code as a string (no Buffer.from()), aligning with the widened content type.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
examples/workflow-code-runner/workflows/code-runner.ts Inlines sandbox create/write/run/stop calls inside the "use workflow" function and passes code to writeFiles() as a string.
examples/workflow-code-runner/steps/sandbox.ts Removes redundant step wrappers around sandbox operations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TooTallNate TooTallNate force-pushed the nr/fix-command-ensure-client branch from f6c7212 to 9ba118c Compare April 2, 2026 16:06
…tion

Sandbox.create() and instance methods (writeFiles, runCommand, stop)
all have "use step" built in, so the wrapper functions in
steps/sandbox.ts were redundant.
@TooTallNate TooTallNate force-pushed the nr/workflow-code-runner-refactor branch from e7ac714 to aa690ce Compare April 2, 2026 16:06
Base automatically changed from nr/fix-command-ensure-client to main April 2, 2026 18:05
@QuiiBz QuiiBz merged commit 28237b8 into main Apr 2, 2026
10 checks passed
@QuiiBz QuiiBz deleted the nr/workflow-code-runner-refactor branch April 2, 2026 18:05
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.

4 participants