Skip to content

Optimize auto tiers routing profiles in Copilot agent - #333626

Merged
Logan Ramos (lramos15) merged 3 commits into
mainfrom
lramos15/agents/auto-tiers-routing-profiles-optimization
Aug 31, 2026
Merged

Optimize auto tiers routing profiles in Copilot agent#333626
Logan Ramos (lramos15) merged 3 commits into
mainfrom
lramos15/agents/auto-tiers-routing-profiles-optimization

Conversation

@lramos15

Copy link
Copy Markdown
Member

This pull request implements routing profiles optimization for the Copilot agent via the agent host protocol, addressing user requests for enhanced auto tiers functionality. Key changes include:

  • New Module: Introduced autoModeTiers.ts to define canonical tiers and localized labels.
  • Session Management: Updated copilotAgent.ts to synthesize tier configuration for the auto model and manage model enumeration.
  • Session Launcher: Enhanced copilotSessionLauncher.ts to handle the new autoTier option during session creation.
  • UI Integration: Mapped the tier setting to the navigation picker group in agentHostLanguageModelProvider.ts.
  • Configuration: Added a new setting chat.agentHost.copilot.autoModeTiers.enabled to control the feature.
  • Testing: Expanded test coverage across various components to ensure functionality and correctness.

This implementation is contingent on the CLI being updated to a version that supports the new autoTier option, as the previous version would reject it.

Copilot AI balanced review requested due to automatic review settings August 31, 2026 19:23
@lramos15
Logan Ramos (lramos15) enabled auto-merge (squash) August 31, 2026 19:23
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Base: bcec3677 Current: a10ded6f

No screenshot changes.

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 · 3 Low severity

New issues introduced by this change (4)
Severity Finding
Medium severity src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts — Changing “Optimize for” after a session is materialized is accepted and persisted, but this branch…
Low severity extensions/​copilot/​src/​extension/​conversation/​vscode-node/​test/​languageModelAccess.test.ts — This replaces a valid reasoning-effort value (max) with an Auto routing-tier value…
Low severity src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts — The suite opening and longContextModel declaration were accidentally joined onto one line. Split…
Low severity src/​vs/​platform/​agentHost/​common/​autoModeTiers.ts — The JSDoc terminator and exported function declaration are accidentally joined. Put the declaration…
What changed in this PR

Adds configurable Auto routing profiles across Agent Host and the Copilot extension.

Changes:

  • Defines and exposes efficiency, balance, and intelligence tiers.
  • Propagates selected tiers into new Copilot sessions.
  • Updates runtime dependencies, configuration, telemetry, and tests.
File Description
src/​vs/​platform/​agentHost/​common/​autoModeTiers.ts Defines canonical tiers and labels.
src/​vs/​platform/​agentHost/​common/​copilotCliConfig.ts Adds the feature gate.
src/​vs/​platform/​agentHost/​node/​copilot/​modelIdentifiers.ts Identifies the Auto model.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts Publishes tier schemas and tracks selections.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotSessionLauncher.ts Sends tiers during session creation.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Tests schema publication and refreshes.
src/​vs/​platform/​agentHost/​test/​node/​copilotSessionLauncher.test.ts Tests tier resolution and forwarding.
src/​vs/​workbench/​contrib/​chat/​browser/​chat.shared.contribution.ts Registers the experimental setting.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostCopilotCliSettingsContribution.ts Forwards the setting to Agent Host.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostLanguageModelProvider.ts Groups the tier picker in navigation.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostLanguageModelProvider.test.ts Tests picker grouping.
extensions/​copilot/​src/​platform/​endpoint/​common/​autoModeTiers.ts Updates extension tiers and compatibility mapping.
extensions/​copilot/​src/​platform/​endpoint/​node/​automodeService.ts Normalizes legacy overrides.
extensions/​copilot/​src/​platform/​endpoint/​node/​autoV2Fetcher.ts Updates telemetry documentation.
extensions/​copilot/​src/​platform/​endpoint/​node/​test/​automodeService.spec.ts Updates routing tests.
extensions/​copilot/​src/​extension/​conversation/​common/​languageModelAccess.ts Updates tier labels and descriptions.
extensions/​copilot/​src/​extension/​conversation/​vscode-node/​test/​languageModelAccess.test.ts Updates model-schema tests.
extensions/​copilot/​package.json Documents accepted override values.
package.json Upgrades the Copilot runtime.
package-lock.json Locks updated runtime packages.

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

Comment thread src/vs/platform/agentHost/node/copilot/copilotAgent.ts Outdated
Comment thread src/vs/platform/agentHost/test/node/copilotAgent.test.ts Outdated
Comment thread src/vs/platform/agentHost/common/autoModeTiers.ts Outdated
Logan Ramos (lramos15) and others added 2 commits August 31, 2026 16:19
Align remote/package.json with the root @github/copilot pin so the
check-package-json hygiene task passes, and restore the formatting of two
accidentally joined lines.

Keep a materialized session's Auto routing profile fixed: the runtime owns it
from creation, so a mid-session change is now reverted in the recorded
selection instead of being persisted and shown as if it applied. The launch
profile is read from the session's launch plan via a new launchAutoTier getter.

Also restore a reasoning-effort value in an extension test that a tier rename
had wrongly rewritten.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9d0e056c-277d-40c3-ba90-eb5fe6653948
Trim every comment added for the Auto routing profile work to at most two
lines, and reduce the automodeService JSDoc edit to the renamed word so the
surrounding wording stays as its author wrote it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9d0e056c-277d-40c3-ba90-eb5fe6653948
@lramos15
Logan Ramos (lramos15) merged commit c9479ad into main Aug 31, 2026
38 checks passed
@lramos15
Logan Ramos (lramos15) deleted the lramos15/agents/auto-tiers-routing-profiles-optimization branch August 31, 2026 21:01
@vs-code-engineering vs-code-engineering Bot added this to the 1.137.0 milestone Aug 31, 2026
registerTriggers: (store, push) => this._pushOnSettingChange(store, push, AgentHostMultiTurnContextRoutingEnabledSettingId),
},
{
key: CopilotCliConfigKey.AutoModeTiers,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review: The normal workbench registers this settings forwarder, but the standalone Agents Window loads localAgentHost.contribution.ts, whose manual registrations omit it. As a result, the experiment-backed setting never reaches Agent Host root config, AutoModeTiers remains false, and the picker cannot appear in that surface. Please register AgentHostCopilotCliSettingsContribution alongside the other local Agent Host contributions and cover the entry point.

},
{
key: CopilotCliConfigKey.AutoModeTiers,
computeValue: () => this._configurationService.getValue<boolean>(AgentHostAutoModeTiersEnabledSettingId) === true,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review: Nit: Please add AutoModeTiers to the exhaustive forwarding test in agentHostCopilotCliSettingsContribution.test.ts. Its schema, configured values, dispatch count, and expected result still cover only the prior mappings, so an incorrect setting key or trigger here would pass unnoticed.

if (override) {
// Normalized because the override is a raw string setting, so unlike a picker value it never
// passes through the schema filter that drops retired names.
const normalized = normalizeAutoModeTier(override);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review: Only the advanced override is normalized. Existing eco or max picker values can remain in scoped/profile model-configuration storage, are forwarded unchanged, and fail isSelectableAutoModeTier, silently falling back to balance in panel chat or fast inline. Please normalize the configured picker value before validation and add upgrade coverage for persisted aliases.

const entry = current.target ?? await this._ensureResolvedChatSession(current);
await entry?.setModel(model.id, resolveCopilotReasoningEffort(model, this._configurationService, this._logService, current.configurationId), getCopilotContextTier(model, longContextWindow, freeLongContext));
if (entry) {
recorded = this._pinLaunchAutoTier(model, entry, current.configurationId);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review: The launch-tier correction only runs for an already-materialized session. A provisional Auto session can retain tier: intelligence, then have the gate turn off before first send; the launcher omits capi.autoTier, but materialization persists provisional.model unchanged. Metadata then claims Intelligence while the runtime uses the service default, and a later fallback can reuse the stale tier. Resolve the effective tier once and use it for both the launch plan and persisted model.

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.

4 participants