Repository navigation
Add Sandbox tools to sandbox.commands.run() - #1791
Open
jpwilliams wants to merge 4 commits into
Open
jpwilliams wants to merge 4 commits into
jpwilliams wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Pass tools to commands.run and the code in the command can call them. A command with tools defaults to the longest command timeout, since it waits on your functions. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
jpwilliams
added this pull request to stack #1792
October 15, 2026 21:17
🦋 Changeset detectedLatest commit: e9d9aa5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
[Medium impact] Adds tool invocation capability to sandbox command execution. Fix repeated command IDs before merging; later calls can silently skip their commands. FindingsFix with agent prompt### Issue 1
packages/inngest/src/components/sandbox/middleware.ts:175-177
Sequential `commands.run()` calls that reuse an ID with `tools` only run the first command. `step.run()` gives later calls distinct indexed IDs, but `runCommandWithTools()` still uses the original ID for its sandbox directory. The second wrapper sees that directory as already started, skips the new command, and returns the first command's output.
Give each command occurrence a replay-stable identity before deriving its directory and child-step IDs.
### Issue 2
packages/inngest/src/components/sandbox/middleware.ts:194-195
Failed command steps with `tools` never write their sandbox trace details. This wrapper writes `meta` only after `fn()` succeeds, then just rethrows on failure. Unlike ordinary commands, a failed process start or wait loses the sandbox name, command, and service error code, making failures harder to debug.
Write the sandbox trace details on failure too, while keeping trace errors non-fatal.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds
Reviews (1) · Last reviewed commit: "feat(sandbox): tools on commands.run" · Reviewed by Greptile |
Name the tools directory for the executing step's own ID so repeated command IDs don't share it, and write the sandbox trace metadata when a command step with tools fails. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been 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.
Summary
Adds the ability for code running in a Sandbox to call functions from the local scope of the orchestrating run.
Pass
toolstosandbox.commands.run()and each call the code makes to a tool runs as its own durable step.The Sandbox code simply calls
tools.getCustomer("123").Checklist
Added a docs PR that references this PRN/A Later bump