Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

The auto model router adds ~200ms latency to inline chat due to the classification API call. This change optimizes inline chat by skipping the router API call when a cached model selection already exists, while still participating in automodel routing.

Changes

Modified AutomodeService._resolveWithRouterModel() to skip router API fetch for inline chat when cache exists:

// For inline chat (ChatLocation.Editor), skip router fetching if there's already a cached entry
// to avoid 200ms latency penalty.
const prompt = chatRequest?.prompt?.trim();
const isInlineChat = location === ChatLocation.Editor;
const shouldRoute = prompt?.length && (!entry || entry.lastRoutedPrompt !== prompt) && !(isInlineChat && entry);

Behavior:

  • First inline chat request: Routes normally using the router API to select the best model
  • Subsequent inline chat requests: Reuses the cached model selection, avoiding the 200ms API call
  • Other locations (Panel, Terminal, etc.): Continue to use router on every request as before

This approach allows inline chat to benefit from smart model routing while avoiding latency penalties on repeated requests.

Original prompt

This section details on the original issue you should resolve

<issue_title>Auto model router should not be used in inline chat</issue_title>
<issue_description>I believe that the auto model router is being used for all Auto usage today (when enabled).
We should make sure to not use the router for inline chat.
Reason:
a) Inline chat needs to be fast, and we do not want to pay the 200ms penalty
b) We always resolve to fast models in Inline Chat ourselves, thus the classifiation might not be needed at all

cc @jrieken @eleanorjboyd </issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Remove auto model router for inline chat usage Skip auto model router for inline chat Jan 20, 2026
Copilot AI requested a review from TylerLeonhardt January 20, 2026 16:58
Copilot AI changed the title Skip auto model router for inline chat Skip auto model router API call for cached inline chat Jan 20, 2026
Copilot AI requested a review from TylerLeonhardt January 20, 2026 17:47
Copilot AI and others added 4 commits January 26, 2026 09:49
- Inline chat still uses automodel routing but skips router API call when cache exists
- Addresses feedback to include logic in shouldRoute instead of blocking router path entirely
- Inline chat will route on first call, then reuse cached model on subsequent calls

Co-authored-by: TylerLeonhardt <[email protected]>
@TylerLeonhardt TylerLeonhardt force-pushed the copilot/remove-auto-router-inline-chat branch from 1b34074 to 045a204 Compare January 26, 2026 17:55
@TylerLeonhardt TylerLeonhardt marked this pull request as ready for review January 26, 2026 17:59
Copilot AI review requested due to automatic review settings January 26, 2026 17:59
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Optimizes Auto mode routing decisions to reduce latency for inline chat by avoiding router-classification calls under certain conditions.

Changes:

  • Restricts router-based model selection to panel chat requests (other locations fall back to non-router behavior).
  • Adds a new Vitest suite covering router usage (panel vs. inline/terminal/no-config).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/platform/endpoint/node/automodeService.ts Gates router-based resolution behind a “panel chat only” check.
src/platform/endpoint/node/test/automodeService.spec.ts Adds tests asserting router fetch usage/non-usage across chat locations and config states.

@TylerLeonhardt TylerLeonhardt added this pull request to the merge queue Jan 26, 2026
Merged via the queue into main with commit 08de31b Jan 26, 2026
25 checks passed
@TylerLeonhardt TylerLeonhardt deleted the copilot/remove-auto-router-inline-chat branch January 26, 2026 23:22
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.

Auto model router should not be used in inline chat

3 participants