You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Subagent identity swapping after first tool call #18404
I have a subagent setup to run a particular MCP/tool which as a lot of context instruction. Quite reliably in the latest version of opencode, after the first tool call, it reverts to the default primary agent mid-conversation and then loses access to that tool. It then delegates out to yet another subagent (which should be impossible, is explicitly banned in my config) to do further tool calls.
So a relatively complex interaction taking a few dozen tool calls will often spawn nearly two dozen subagents as each one swaps identities to the primary agent after the first tool call, loses access to the tool, gets confused, realizes it can delegate, makes new instructions, and tasks a new subagent.
Not ideal!
Plugins
superpowers
OpenCode version
1.2.27
Steps to reproduce
setup a subagent with access to a specialized MCP and "task":{"*": "deny"} permissions.
setup a primary agent instructed to task tool calls to that subagent and permissions denying use of that tool
ask primary to perform this task
With that setup, then I'm observing the following behavior from opencode:
it delegates to subagent
first tool call succeeds
subagent identity swaps, next tool calls fail
new agent identity performs task tool call to subagent that should've been impossible
Activity
Vishal2002 commentedon Mar 21, 2026
Can I work on this issue.
github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.