Issue: Tool mapping bugs causing task failures and missing functionality
Environment
- OpenCode 1.3.17
- opencode-claude-bridge 1.9.0
- Claude Sonnet 4.6
Bug 1: Agent subagent_type not required — causes task validation errors
Observed: When the model calls the Agent tool without subagent_type, OpenCode's task tool rejects it:
The task tool was called with invalid arguments: [
{
"expected": "string",
"code": "invalid_type",
"path": ["subagent_type"],
"message": "Invalid input: expected string, received undefined"
}
]
Root cause: src/claude-tools.ts:217 has required: ["description", "prompt"] — missing subagent_type. OpenCode's task tool requires it.
Fix: Add "subagent_type" to the required array.
Bug 2: general-purpose maps to build instead of general
Observed: When the model picks general-purpose, the bridge translates it to build. But OpenCode has a dedicated general subagent (per official docs). This sends general-purpose tasks to the wrong agent with different permissions.
Also, general was missing from the outbound map, so OpenCode's general type couldn't translate back to general-purpose for the API.
Root cause: src/index.ts:749 maps "general-purpose": "build". Outbound map at src/index.ts:592 doesn't include general.
Fix: Map "general-purpose": "general" inbound, add general: "general-purpose" outbound.
Bug 3: AskUserQuestion has no mapping to OpenCode's question tool
Observed: The model tries to call AskUserQuestion to ask clarifying questions, but the bridge treats it as a stub tool with no mapping to OpenCode's question tool. All clarification attempts fail.
Root cause: AskUserQuestion is only in STUB_TOOLS, not in INBOUND_TOOL_NAME_MAP or OUTBOUND_TOOL_NAME_MAP.
Fix: Add AskUserQuestion: "question" to inbound map, question: "AskUserQuestion" to outbound map.
Additional finding: SSE chunk boundary fragility
The inbound stream parameter translation (e.g. "file_path" → "filePath", "activeForm" → "priority") uses regex on raw SSE text chunks. If a chunk boundary splits a key name, the translation silently fails. This causes intermittent failures on Edit, Read, Write, and TodoWrite tools. This is harder to fix (requires buffering) but worth noting.
PR
PR submitted with fixes for bugs 1-3.
Issue: Tool mapping bugs causing task failures and missing functionality
Environment
Bug 1: Agent
subagent_typenot required — causes task validation errorsObserved: When the model calls the Agent tool without
subagent_type, OpenCode'stasktool rejects it:Root cause:
src/claude-tools.ts:217hasrequired: ["description", "prompt"]— missingsubagent_type. OpenCode's task tool requires it.Fix: Add
"subagent_type"to the required array.Bug 2:
general-purposemaps tobuildinstead ofgeneralObserved: When the model picks
general-purpose, the bridge translates it tobuild. But OpenCode has a dedicatedgeneralsubagent (per official docs). This sends general-purpose tasks to the wrong agent with different permissions.Also,
generalwas missing from the outbound map, so OpenCode'sgeneraltype couldn't translate back togeneral-purposefor the API.Root cause:
src/index.ts:749maps"general-purpose": "build". Outbound map atsrc/index.ts:592doesn't includegeneral.Fix: Map
"general-purpose": "general"inbound, addgeneral: "general-purpose"outbound.Bug 3:
AskUserQuestionhas no mapping to OpenCode'squestiontoolObserved: The model tries to call
AskUserQuestionto ask clarifying questions, but the bridge treats it as a stub tool with no mapping to OpenCode'squestiontool. All clarification attempts fail.Root cause:
AskUserQuestionis only inSTUB_TOOLS, not inINBOUND_TOOL_NAME_MAPorOUTBOUND_TOOL_NAME_MAP.Fix: Add
AskUserQuestion: "question"to inbound map,question: "AskUserQuestion"to outbound map.Additional finding: SSE chunk boundary fragility
The inbound stream parameter translation (e.g.
"file_path"→"filePath","activeForm"→"priority") uses regex on raw SSE text chunks. If a chunk boundary splits a key name, the translation silently fails. This causes intermittent failures on Edit, Read, Write, and TodoWrite tools. This is harder to fix (requires buffering) but worth noting.PR
PR submitted with fixes for bugs 1-3.