anomalyco / anomalyco/opencode
Task resume keeps permissions from the previous subagent
@jlongster is already working on this.
Since Aug 11, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
When the Task tool resumes a task_id with a different subagent_type, the prompt correctly switches to the new agent, but the child session keeps the permissions derived for the previous agent.
For example, switching from general to a custom agent that explicitly allows task leaves the old session-level task: deny in place and does not add defaults required by the new agent. This makes the selected agent, stored session state, and effective tool permissions disagree.
Steps to reproduce
- Start a Task session with
generaland keep its returnedtask_id. - Resume that
task_idwith a subagent that explicitly allowstaskbut has notodowriterule. - Inspect the resumed child session permissions.
Expected: agent-derived rules are refreshed for the selected subagent, while parent and child-specific restrictions remain.
Actual: the child retains general's derived task: deny and never receives the new todowrite: deny default.
OpenCode version
Current dev (d041eee55).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.