senpi icon indicating copy to clipboard operation
senpi copied to clipboard

anthropic-subscription: custom `bash` tool is replaced by built-in `Bash`, so its own schema is never used

Open Bearmancer opened this issue 1 month ago • 1 comments

What happened?

On the anthropic-subscription provider, a custom tool named bash never reaches the model under its own schema. resolveSdkTools maps any tool named bash to Claude Code's built-in Bash by name only (https://github.com/code-yeongyu/senpi/blob/43fdd06faa9bde3f0e059270a70ec24305c2d5bf/packages/coding-agent/src/core/extensions/builtin/anthropic-subscription/tools.ts#L165-L171, table at https://github.com/code-yeongyu/senpi/blob/43fdd06faa9bde3f0e059270a70ec24305c2d5bf/packages/coding-agent/src/core/extensions/builtin/anthropic-subscription/tools.ts#L20), and mapToolArgs then keeps just {command, timeout} (https://github.com/code-yeongyu/senpi/blob/43fdd06faa9bde3f0e059270a70ec24305c2d5bf/packages/coding-agent/src/core/extensions/builtin/anthropic-subscription/tools.ts#L129-L133).

I hit it with oh-my-openagent's librarian agent (omo-ai 5.1.43), whose bash is a gh/curl broker taking {program, args}. Every call fails with:

Validation failed for tool "bash":
  - program: must have required properties program, args

Haiku 4.5, Haiku 5.5 and Sonnet 5.5 on anthropic-subscription all fail the same way. The same agent on opencode-go/deepseek-v4.1-flash ran gh --version on the first try.

Steps to reproduce

  1. Run senpi on anthropic-subscription with omo-ai loaded.
  2. Spawn a librarian subagent on any Anthropic model and have it run gh --version through bash.
  3. The call is rejected with the error above.

Without any extension, at 43fdd06f: resolveSdkTools given one tool named bash whose schema requires program and args returns sdkTools: ["Bash"] and customTools: [], so the tool is dropped for the built-in.

Expected behavior

A bash tool whose schema is not the stock {command} one is served like any other custom tool (custom-tools MCP server, as write/edit are since #2405), so its own schema applies. The stock bash keeps mapping to built-in Bash.

Version

2026.10.21-2 (failure observed). Source checked on main at 43fdd06f (v2026.10.21-3 plus 138 commits); the end-to-end failure was not rerun on that build.

Evidence

Routing-level proof at 43fdd06f (run from a script outside the clone; tools.ts has only type imports, so it loads without dependencies):

Input Result
one bash tool, schema requires program, args sdkTools: ["Bash"], customTools: []
mapToolArgs("Bash", {command: "gh --version"}) {"command":"gh --version"}; program and args missing
mapToolArgs("Bash", {program: "gh", args: ["--version"]}) {}

Counterfactual. In a scratch copy, one extra condition in the loop of resolveSdkTools (take the built-in path only when the tool is not bash, or its schema has a command property) gives, for the same broker tool, sdkTools: [] and customTools: ["bash"]. A tool with the stock {command, timeout} schema still resolves to ["Bash"]. Toggling that one decision toggles the outcome.

Probes on 2026.10.21-2 (same gh --version call through the librarian bash): Haiku 4.5 (three runs), Haiku 5.5 (two runs, default and explicit) and Sonnet 5.5 on anthropic-subscription were all rejected; the received arguments were {"command": "gh --version"}. opencode-go/deepseek-v4.1-flash succeeded with {program: "gh", args: ["--version"]}.

Not shown: an end-to-end run of the librarian on a build of 43fdd06f, and a patch to tools.ts in the repo.

Every claim in this issue was checked against the source at 43fdd06f.

Covering PR: #5163 (DRAFT, dirty — provisional coverage, unmerged)

Drafted with AI assistance.

Bearmancer avatar Oct 23 '26 04:10 Bearmancer

Thank you @Bearmancer, the links to the name-only mapping and to mapToolArgs keeping just command and timeout show exactly why a custom bash schema never reaches the model. An open draft PR, #5163, takes this on by serving every tool through the custom-tools server instead of Claude Code's built-ins. Updates will show up there.

code-yeongyu avatar Nov 02 '26 11:11 code-yeongyu