Skip to content

Batch subcalls fail with PascalCase tool names (Read, Bash) that work at top level #486

Closed

Description

@ravshansbox

Summary

Capitalized (PascalCase) tool names like Read and Bash work as top-level tool calls but fail when used as subcalls inside batch, erroring with Unknown tool: Read. Did you mean: read?.

Repro

Call batch with subcalls using the capitalized names the Anthropic OAuth surface advertises:

{
  "tool_calls": [
    { "tool": "Read", "file_path": "package.json" },
    { "tool": "Bash", "command": "ls -la" }
  ]
}

Result:

batch 2/2 failed
  Read error: Unknown tool: Read. Did you mean: read? ...
  Bash error: Unknown tool: Bash. Did you mean: bash, ...

The lowercase equivalents (read, bash) inside batch work fine.

Root cause

The Anthropic OAuth layer advertises tools with PascalCase names and reverse-maps them (Read -> read, Bash -> bash, etc.) via anthropic_map_tool_name_from_oauth before top-level calls reach the registry.

batch subcall names are raw strings that never pass through that provider-side mapping. They only go through the canonical alias resolver resolve_tool_name in crates/jcode-tool-types/src/lib.rs, which is case-sensitive and does not include the PascalCase aliases. So Read/Bash/Write/Edit/Grep/Agent/ScheduleWakeup fall through unchanged and fail to resolve.

batch.rs already calls Registry::resolve_tool_name on each subcall, so centralizing the fix there is sufficient.

Proposed fix

Add the PascalCase OAuth aliases to resolve_tool_name (crates/jcode-tool-types/src/lib.rs) so nested/batch subcalls resolve identically to top-level calls:

"Read" => "read",
"Bash" => "bash",
"Write" => "write",
"Edit" => "edit",
"Grep" => "agentgrep",
"Agent" => "subagent",
"ScheduleWakeup" => "schedule",
// ("Skill" is already mapped)

Open question: what Glob should resolve to, given there is no native glob/grep tool (both grep-like aliases currently map to agentgrep).

Add a unit test in the resolve_tool_name test module asserting the PascalCase forms resolve to their canonical tools.

Activity

  1. added a commit that references this issue on Jul 18, 2026
    2b4b75e
  2. 1jehuang commented on Jul 18, 2026

    @1jehuang
    Owner

    Fixed in 2b4b75e (already auto-closed): the PascalCase OAuth aliases (Read, Bash, Write, Edit, Grep, Agent, ScheduleWakeup) now resolve in resolve_tool_name, so batch subcalls match top-level behavior. Glob was intentionally left unmapped since there is no native glob tool and top-level Glob was never reverse-mapped to anything runnable either. Unit tests added. Ships in the next release.

    — Jcode agent

  3. added 2 commits that reference this issue on Aug 30, 2026
    a9ec393
    179e8aa
  4. added a commit that references this issue on Sep 18, 2026
    cd15231
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions