Repository navigation
Commit 5d6c74a
committed
fix: 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 copied 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.
Fixes #16491, #38081 parent 2662a4f commit 5d6c74a
1 file changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
26 | 33 | | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
| 38 | + | |
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
34 | | - | |
| 42 | + | |
0 commit comments