Skip to content

Implement subagent default setting to Auto without overriding models - #333663

Merged
Bhavya U (bhavyaus) merged 4 commits into
mainfrom
sbatten/agents/subagent-default-auto-setting
Sep 3, 2026
Merged

Implement subagent default setting to Auto without overriding models#333663
Bhavya U (bhavyaus) merged 4 commits into
mainfrom
sbatten/agents/subagent-default-auto-setting

Conversation

@sbatten

Copy link
Copy Markdown
Member

This pull request introduces a new setting, chat.subagents.defaultToAuto, which allows local subagents to default to the Auto model when no specific model is specified. Key changes include:

  • New Setting Implementation: The setting is off by default and only affects unspecified non-BYOK subagents, allowing them to use the eligible Copilot Auto model.
  • Model Resolution Logic: The logic for model resolution has been updated to ensure that explicit and agent-configured models take precedence over the Auto model.
  • Cache-First Lookup: The Auto model lookup is now cache-first, activating the provider only when necessary.
  • Testing: Comprehensive tests have been added to validate participant routing, cache behavior, eligibility, precedence, and fallback scenarios. All tests have passed successfully.

This change enhances the flexibility of subagent behavior while maintaining existing configurations and ensuring backward compatibility.

Copilot AI balanced review requested due to automatic review settings August 31, 2026 22:21

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.

Copilot review overview

Review tier: Balanced
Findings: 1 Medium severity · 1 Low severity

New issues introduced by this change (2)
Severity Finding
Medium severity src/​vs/​workbench/​contrib/​chat/​common/​tools/​builtinTools/​runSubagentTool.ts — When agentName is omitted, subagent is always undefined, even though this tool inherits the…
Low severity src/​vs/​workbench/​contrib/​chat/​test/​common/​tools/​builtinTools/​runSubagentTool.test.ts — This and the following direct-invocation Auto test are inside the nested subagent depth tracking
What changed in this PR

Adds an experimental setting to default eligible local subagents to Copilot Auto while preserving explicit, agent-configured, and BYOK model selections.

Changes:

  • Registers chat.subagents.defaultToAuto.
  • Adds cache-first Auto model resolution and eligibility checks.
  • Expands model precedence, fallback, and routing tests.
File Description
chat.shared.contribution.ts Registers the setting.
constants.ts Adds its configuration key.
runSubagentTool.ts Implements Auto model resolution.
runSubagentTool.test.ts Adds routing and fallback coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bhavyaus

Bhavya U (bhavyaus) commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

This PR has now been rebased onto the latest main and updated with the follow-up implementation.

In addition to preserving explicit, agent-configured, inherited, and BYOK model behavior while allowing eligible subagents to default to Auto, the PR now adds product telemetry for the model-selection source. The chat.subagentModelSelection event is emitted when the subagent is invoked and contains no model IDs, agent names, prompts, paths, or other user-authored content.

selectionSource value Meaning
explicitModel The runSubagent tool call explicitly supplied its model argument, and that model resolved successfully.
agentModel An explicitly named subagent supplied a model through its model: configuration, and that model resolved successfully.
autoDefault chat.subagents.defaultToAuto successfully replaced the inherited model with Auto. This proves the new feature wired Auto in.
mainModel The subagent kept the parent/main request model. This includes the setting being disabled, BYOK preservation, Auto being unavailable or ineligible, an unavailable configured agent model, or inheriting the current agent’s already-selected model.

Selection precedence:

explicitModelagentModelautoDefaultmainModel

The event records the source of the model assigned to the subagent, not the concrete backend to which Auto later routes.

Validation completed: 48/48 targeted tests passed, full client and Copilot extension compilation passed, ESLint and pre-commit hygiene passed, and live Code OSS validation confirmed that the parent remained on Claude Opus 5 while the Auto-routed subagent ran on MAI Code 1.1 Flash.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 1e1ee361 Current: 78e63f3e

2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details.

Errored (8)

Fixtures that failed to render — no screenshot was produced.

sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunning/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunning/Light — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunningAutoStart/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostNotRunningAutoStart/Light — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostDisconnected/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/HostDisconnected/Light — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/Connecting/Dark — unknown error (no image hash produced)
unknown error (no image hash produced)
sessions/remoteHostUnavailable/remoteHostUnavailableEmptyState/Connecting/Light — unknown error (no image hash produced)
unknown error (no image hash produced)

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.

Copilot review overview

🟡 Changes recommended

The new picker guard mishandles defined empty-string subagent invocation IDs.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity extensions/​copilot/​src/​extension/​conversation/​vscode-node/​chatParticipants.ts — Use a presence check here rather than truthiness. An empty-string subAgentInvocationId is still…
Issues resolved since last review (2)
Severity Finding
Low severity src/​vs/​workbench/​contrib/​chat/​test/​common/​tools/​builtinTools/​runSubagentTool.test.ts — This and the following direct-invocation Auto test are inside the nested subagent depth trackingView resolved comment
Medium severity src/​vs/​workbench/​contrib/​chat/​common/​tools/​builtinTools/​runSubagentTool.ts — When agentName is omitted, subagent is always undefined, even though this tool inherits the… View resolved comment

Comment thread extensions/copilot/src/extension/conversation/vscode-node/chatParticipants.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

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.

Copilot review overview

🟡 Changes recommended

Automatic rate-limit switching can still change the global model picker from a subagent request.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity extensions/​copilot/​src/​extension/​conversation/​vscode-node/​chatParticipants.ts — The picker guard is incomplete: switchToAutoModel still unconditionally executes…
Issues resolved since last review (1)
Severity Finding
Medium severity extensions/​copilot/​src/​extension/​conversation/​vscode-node/​chatParticipants.ts — Use a presence check here rather than truthiness. An empty-string subAgentInvocationId is still… View resolved comment

@bhavyaus
Bhavya U (bhavyaus) merged commit cec8ce7 into main Sep 3, 2026
41 checks passed
@bhavyaus
Bhavya U (bhavyaus) deleted the sbatten/agents/subagent-default-auto-setting branch September 3, 2026 19:49
@vs-code-engineering vs-code-engineering Bot added this to the 1.137.0 milestone Sep 3, 2026
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.

5 participants