Repository navigation
Commit 5df7955
committed
fix(opencode): inherit MCP tool allow permissions in subagent sessions
Subagents spawned via the Task tool could see MCP tools in their tool
registry but got permission denied when trying to execute them. The root
cause was that deriveSubagentSessionPermission only forwarded deny rules
and external_directory rules from the parent session, never copying the
allow rules that MCP tools require.
MCP tool permission keys contain underscores (e.g. context7_resolve-library-id,
matrix_matrix_read) as they follow the sanitize(clientName) + '_' + sanitize(toolName)
naming pattern. This fix copies all allow rules whose permission key
contains an underscore, which covers MCP tools while leaving native tools
(todowrite, task, bash, edit, etc.) unaffected since they don't contain
underscores in their permission names. Wildcard '*' allow rules are also
forwarded.
Fixes anomalyco#16491, anomalyco#38081 parent 6340758 commit 5df7955
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
20 | 29 | | |
| 30 | + | |
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
| |||
0 commit comments