exec: remove sandbox fallback on permission error
Silent fallback from the anvilmcp sandbox to the default sandbox on permission errors undermined the sandbox policy — a restriction firing is the sandbox working correctly, not a failure to recover from. Sandbox selection is now explicit: the requested policy runs, and failure surfaces as an error. Also removes the now-unused IsPermissionError helper from ollie/exec. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
89d41a7195
commit
3d60dbde5d
7
main.go
7
main.go
|
|
@ -213,7 +213,6 @@ func handleToolCall(req MCPRequest) {
|
|||
timeout = int(t)
|
||||
}
|
||||
sandbox, _ := params.Arguments["sandbox"].(string)
|
||||
sandboxExplicit := sandbox != ""
|
||||
if sandbox == "" {
|
||||
sandbox = "anvilmcp"
|
||||
}
|
||||
|
|
@ -224,12 +223,6 @@ func handleToolCall(req MCPRequest) {
|
|||
fmt.Fprintf(os.Stderr, "[anvilmcp] Executing %s code (timeout: %ds, sandbox: %s, trusted: %v)\n", language, timeout, sandbox, trusted)
|
||||
result, err := executor.Execute(code, language, timeout, sandbox, trusted)
|
||||
|
||||
// Fallback to default sandbox on permission errors (only if sandbox wasn't explicit)
|
||||
if err != nil && !sandboxExplicit && execpkg.IsPermissionError(err) {
|
||||
fmt.Fprintf(os.Stderr, "[anvilmcp] Permission error in %s sandbox, falling back to default\n", sandbox)
|
||||
result, err = executor.Execute(code, language, timeout, "default", trusted)
|
||||
}
|
||||
|
||||
// Log token comparison
|
||||
codeTokens := estimateTokens(code)
|
||||
outputTokens := estimateTokens(result)
|
||||
|
|
|
|||
Reference in New Issue