Skip to content
Source
Sign inSign up
TanStack/ai

Harness tools with needsApproval run without approval through the sandbox tool bridge #1854

Send to my agent
Closedtombeckenham opened this issue 0 comments
tombeckenhamcommented

TanStack AI version

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:

  1. Define a server tool with needsApproval: true and an execute() that logs.
  2. Pass it to chat({ adapter: claudeCodeText(...), tools: [tool], middleware: [withSandbox(sandbox)] }).
  3. Ask the agent to call the tool.
  4. 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.

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.

  1. tombeckenham added labelsbug

  2. tombeckenham closed this

Sign in to join this conversation.