fix(opencode): accept agent and agent_type as task tool parameter aliases#20805
Open
jbmml wants to merge 1 commit intoanomalyco:devfrom
Open
fix(opencode): accept agent and agent_type as task tool parameter aliases#20805jbmml wants to merge 1 commit intoanomalyco:devfrom
jbmml wants to merge 1 commit intoanomalyco:devfrom
Conversation
…ases Non-Claude models consistently send "agent" or "agent_type" instead of "subagent_type" when calling the task tool, causing repeated Zod validation failures. Accept all three parameter names with a clear precedence order: subagent_type > agent > agent_type. Fixes anomalyco#20804 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jbmml
pushed a commit
to jbmml/opencode
that referenced
this pull request
Apr 8, 2026
Applies both open PRs (anomalyco#20805, anomalyco#20809) to current dev for local use: - task tool: accept agent/agent_type as aliases for subagent_type - experimental.ts: replace broken zodToJsonSchema with z.toJSONSchema Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Fixes #20804
Type of change
What does this PR do?
Non-Claude models (MiniMax, Gemini, Qwen) send
agentoragent_typeinstead ofsubagent_typewhen calling the task tool. Zod rejects these becausesubagent_typeis the only accepted parameter name and it's required. Models retry in a loop (20+ times in my testing) without ever guessing the right name.The fix makes
subagent_typeoptional and addsagentandagent_typeas optional aliases. A new exportedresolveAgentType()function normalizes these to a single value at the top ofexecute()with clear precedence:subagent_type>agent>agent_type. If none are provided, it throws the same error as before.This is the minimal change — one source file and one test mock updated. The resolver is a pure function with no side effects.
How did you verify your code works?
bun test test/tool/)resolveAgentTypecovering all alias paths and the error caseChecklist