You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Harness tools with needsApproval run without approval through the sandbox tool bridge #1854
main and t3/prepare-v1-release (1.0.0). @tanstack/ai-sandbox.
Framework/Library version
Any. Server side, with a harness adapter (@tanstack/ai-claude-code, -codex, -opencode, -grok-build, -acp).
Describe the bug and the steps to reproduce it
A tool marked needsApproval: true runs with no approval when a harness adapter calls it through the sandbox tool bridge.
createToolBridgeCore().callTool (packages/ai-sandbox/src/tool-bridge.ts, about line 162) looks up the tool and calls tool.execute() directly. It never reads needsApproval. The harness adapters bridge every chat() tool (packages/ai-claude-code/src/adapters/text.ts, toolsForChoice, about line 155).
Steps:
Define a server tool with needsApproval: true and an execute() that logs.
Pass it to chat({ adapter: claudeCodeText(...), tools: [tool], middleware: [withSandbox(sandbox)] }).
Ask the agent to call the tool.
The log line prints. No tool-approval interrupt is raised.
Expected: the run pauses with a tool-approval interrupt, as it does for a normal chat() adapter. Or the bridge refuses tools with needsApproval with a clear error.
Found in the full review of #1840. docs/structured-outputs/harnesses.md now describes the current behavior.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
See the steps above. The bypass is visible in callTool in packages/ai-sandbox/src/tool-bridge.ts.
Do you intend to try to help solve this bug with your own PR?
Yes, I am also opening a PR that solves the problem this issue identifies.
Activity
fix(ai-sandbox): refuse needsApproval tools in the harness tool bridge
fix(ai-sandbox): refuse needsApproval tools in the harness tool bridge
refactor!: remove every deprecated API and release all packages as 1.…