anomalyco / anomalyco/opencode

Task resume keeps permissions from the previous subagent

Open
#41,681 1 comment 0 reactions 1 assignee View on GitHub

@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

  1. Start a Task session with general and keep its returned task_id.
  2. Resume that task_id with a subagent that explicitly allows task but has no todowrite rule.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.