Repository navigation
Conversation
ee9630b wrapped the server's own validation failures in ToolError so MCP 2.x clients see their message. Errors raised by the OpenSandbox SDK were left as they were, and MCP 2.x reports any exception other than ToolError as just "Error executing tool <name>". A missing sandbox, a rejected API key or a failed connect all looked the same to the client. Convert SandboxException to ToolError in the shared tool decorator, so every tool reports the SDK message. Other exceptions are still hidden behind the generic message, and the tool schemas are unchanged.
acodercat
requested review from
Pangjiping,
hittyt,
jwx0925 and
ninan-nn
as code owners
October 31, 2026 08:54
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
On MCP 2.x, a tool that raises anything other than
ToolErroris reported to the client as justError executing tool <name>, with no detail. ee9630b ("preserve expected tool errors on MCP 2.x") wrapped the server's own validation failures inToolErrorfor that reason. But the errors that come from the OpenSandbox SDK were left as they were, and those are the most common expected failures: a sandbox that doesn't exist, a rejected API key, a failed connect.On current main,
sandbox_killfor a sandbox the server reports as missing (SandboxApiException("Sandbox sbx-missing not found", status_code=404)) returnsis_error=Truewith onlyError executing tool sandbox_kill. The same happens for every other tool, so an agent using the MCP server can't tell a missing sandbox from an auth problem or a bug.Summary
tool()decorator wraps each tool and converts aSandboxExceptionintoToolError(str(exc)), chaining the original. Every tool reports the SDK message the same way, including connect failures fromconnect_if_missing.ToolErrorraised by a tool passes through unchanged.functools.wraps. Thetools/listoutput (names, input and output schemas) is byte-for-byte the same as on main, andContextinjection still works.Testing
Not run (explain why)
Unit tests
Integration tests
e2e / manual verification
New
test_mcp2_sandbox_errors_keep_actionable_message, at the protocol level:sandbox_killwith a manager that raisesSandboxApiException(..., 404)must return an error result containingSandbox sbx-missing not found. It fails on current main withError executing tool sandbox_kill.Compared the
tools/listdump with and without the change: identical.All MCP tests pass (27 passed).
ruffis clean, andpyrightreports the same 3 existing errors as on main.Breaking Changes
Checklist