Skip to content

agentHost: keep plugin subagents in Copilot catalog - #342092

Merged
Martin Aeschlimann (aeschli) merged 3 commits into
microsoft:mainfrom
aeschli:aeschli/fix-plugin-subagents
Oct 18, 2026
Merged

Martin Aeschlimann (aeschli) merged 3 commits into
microsoft:mainfrom
aeschli:aeschli/fix-plugin-subagents

Conversation

@aeschli

@aeschli Martin Aeschlimann (aeschli) commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #341680

The Copilot runtime treats any explicitly provided customAgents array, including an empty one, as the complete agent catalog instead of merging agents discovered from pluginDirectories. Because Agent Host always supplies its built-in agents explicitly, file-plugin siblings disappeared from the task tool whenever a plugin parent was selected.

This change projects every enabled plugin agent into customAgents while continuing to use pluginDirectories for the plugin's other resources. It adds discovery coverage for a multi-agent plugin alongside workspace and user-home agents, plus a real bundled-runtime integration test that selects a plugin parent and successfully delegates through task to a sibling from the same plugin.

Validation

  • Passed — npm run build-fast -- --client-only
  • Passed — ./scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotPluginConverters.test.ts --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts --grep 'toSdkSessionCustomAgents|passes a standalone client bundle' (3 tests)
  • Passed — ./scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotPluginConverters.test.ts --run src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts (182 tests)
  • Passed — ./scripts/test.sh --run src/vs/platform/agentHost/test/node/sessionCustomizationDiscovery.test.ts (17 tests)
  • Passed twice — ./scripts/test-integration.sh --run src/vs/platform/agentHost/test/node/providerIntegration/copilotMockLlm.integrationTest.ts --grep 'selected plugin agent delegates'
  • Passed — npm run typecheck-client
  • Passed — targeted ESLint for all changed TypeScript files

Project every enabled plugin agent into the SDK customAgents catalog so explicit built-ins do not suppress sibling discovery. Cover the handoff with unit tests and a bundled-runtime delegation integration test.\n\nFixes #341680

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 15:35
Document that the Copilot runtime suppresses discovery whenever customAgents is supplied, including an explicit empty array.

Co-authored-by: Copilot <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Manual-only agents lose their invocation restriction, and the integration test does not select the synced plugin parent.

2 open findings
What changed in this PR

Restores plugin sibling agents to Copilot’s explicit agent catalog so they remain available for delegation.

Changes:

  • Projects all plugin agents into customAgents.
  • Preserves directory-based discovery for other plugin resources.
  • Updates unit coverage and adds bundled-runtime sibling-delegation coverage.
File Description
src/​vs/​platform/​agentHost/​test/​node/​providerIntegration/​copilotMockLlm.integrationTest.ts Adds plugin sibling-delegation integration coverage.
src/​vs/​platform/​agentHost/​test/​node/​copilotPluginConverters.test.ts Expects all plugin agents in the catalog.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Verifies plugin agents alongside standalone and built-in agents.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotSessionLauncher.ts Uses the simplified catalog converter.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotPluginConverters.ts Includes every supplied plugin agent.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

}
}
return customAgents;
return toSdkCustomAgents(plugins.flatMap(plugin => plugin.agents), fileService);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid finding. Follow-up #342427 forwards the runtime disableModelInvocation flag and adds bundled-runtime coverage proving a restricted sibling cannot be delegated to.

Comment on lines +249 to +259
client.dispatch({
channel: chatUri,
clientSeq: 2,
action: {
type: ActionType.ChatTurnStarted,
turnId: 'turn-plugin-subagent',
startedAt: new Date().toISOString(),
message: {
text: `[scenario:${PLUGIN_SIBLING_SCENARIO_ID}] Delegate to the plugin sibling.`,
origin: { kind: MessageKind.User },
agent: { uri: URI.file(parentAgentFile).toString() },

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid finding. Follow-up #342427 selects the parent through the URI published on the synced plugin child, so the integration test now exercises the intended plugin parent.

Verify that a multi-agent plugin, workspace agents, and user-home agents remain in their distinct discovery containers.

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copilot Agent Host: file-plugin subagents disappear when customAgents is supplied

4 participants