anomalyco / anomalyco/opencode
Task tool description ignores session permissions
@rekram1-node is already working on this.
Since Sep 9, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
The Task tool's model-facing subagent list ignores session permissions. describeTask filters with agent.permission, while execution and the adjacent Code Mode description merge agent and session rules. A session-denied target is still advertised; a session-allowed target can remain absent.
This is a description mismatch, not a claim that execution bypasses permissions. #41100 included this fix alongside other changes but was automatically closed without merging. PR #48107 fixes session permission merging only.
Scope relative to the related issues
- #35238 concerns the V2
subagenttool inpackages/core, including runtime enforcement. This issue concerns the legacy Task description inpackages/opencode/src/tool/registry.ts. - #45078 concerns copying superseded parent denies into a child's permissions in
deriveSubagentSessionPermission. This reproduction creates no child session; the mismatch already exists inregistry.tools()output. - #39086 reports the entire
tasktool missing. Heretaskis present, but its available-agent list includes session-denied targets or omits session-allowed targets.
The fix only supplies Permission.merge(agent.permission, session.permission ?? []) to describeTask. It changes neither rule evaluation semantics nor execution checks, child-session inheritance, or whole-tool visibility. Four session-override regression cases fail on the unmodified base and pass with #48107; omitted/empty session permissions retain their behavior.
OpenCode version
dev at 830d5eb5354874105cc31599635a80c1662609e8
Steps to reproduce
- Call
ToolRegistry.Service.toolswith an agent whose Task rules deny*and then allowexplore. - Pass
permission: [{ permission: "task", pattern: "explore", action: "deny" }]. - Inspect the returned
task.description: its available-agent list still includesexplore; it should omit it. - Conversely, a session
alloworaskforgeneralshould make it visible despite the agent's wildcard deny, but currently does not.
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.