Nested subagent invocation fails with "Requested agent is not allowed by the current agent" despite nested subagents being enabled
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
### Summary
Nested subagent invocation appears to be blocked even when nested subagents are explicitly enabled.
The first delegation level works correctly:
```
agent-a -> agent-b
```
However, any attempt by agent-b to invoke one of its own allowed subagents fails with:
```
Requested agent '' is not allowed by the current agent.
```
This occurs even when:
- chat.subagents.allowInvocationsFromSubagents is set to true
- the setting is configured at both User and Workspace scope
- the intermediate agent has the agent tool enabled
- the target agent is explicitly listed in the intermediate agent's agents: allowlist
- VS Code has been reloaded
- a fresh chat session has been started
## Environment
*VS Code*
```
Version: 1.137.0
Commit: 645f29cc3176500b4b5762ba887cf2a7f0ffdf2c
```
*GitHub Copilot*
```
@github/copilot: 1.0.84.70
@github/copilot-sdk: 1.0.13-preview.4
```
*Operating System*
```
Windows_NT x64 10.0.26200
```
*Notes*
GitHub Copilot Chat is integrated as a built-in component in this VS Code version and does not appear as a separately versioned extension.
### Configuration
The following setting is enabled in BOTH User Settings and Workspace Settings:
```json
{
"chat.subagents.allowInvocationsFromSubagents": true
}
```
### Minimal Reproduction
*agent-a*
```yaml
---
name: agent-a
tools: [agent]
agents:
- agent-b
---
Delegate work to agent-b.
```
agent-b
```yaml
---
name: agent-b
tools: [agent]
agents:
- agent-c
---
Delegate work to agent-c.
```
*agent-c*
```yaml
---
name: agent-c
tools: [read]
---
Simple leaf agent.
```
*Reproduction Steps*
1. Create the three custom agents above.
2. Enable nested subagent invocations:
```json
{
"chat.subagents.allowInvocationsFromSubagents": true
}
```
3. Configure the setting in both User and Workspace settings.
4. Reload VS Code.
5. Start a new chat session.
6. Select agent-a.
7. Submit a request that requires:
```
agent-a -> agent-b -> agent-c
```
Example prompt:
```
Delegate this task to agent-b. Agent-b must delegate the actual work to agent-c.
```
### Observed Behavior
agent-a successfully invokes agent-b.
agent-b then attempts to invoke agent-c.
The invocation fails with:
```
Requested agent 'agent-c' is not allowed by the current agent.
```
Transcript excerpt:
Plain Text
```
agent-b was invoked successfully, but its required delegation to agent-c was blocked:
Requested agent 'agent-c' is not allowed by the current agent.
No agent-c result was produced.
```
### Expected Behavior
Since agent-c is explicitly declared in agent-b's agents: allowlist, and nested subagent invocation is enabled, the following execution should succeed:
```
agent-a
-> agent-b
-> agent-c
```
agent-c should execute normally and return a result to agent-b.
Contributor guide
Assessment
This issue has not been assessed yet.