Skip to content

Add Copilot auth token to router decision fetcher for CAPI proxy auth#3980

Merged
TylerLeonhardt merged 1 commit intomicrosoft:mainfrom
aashna:aashnagarg/router-auth-headers
Feb 25, 2026
Merged

Add Copilot auth token to router decision fetcher for CAPI proxy auth#3980
TylerLeonhardt merged 1 commit intomicrosoft:mainfrom
aashna:aashnagarg/router-auth-headers

Conversation

@aashna
Copy link
Contributor

@aashna aashna commented Feb 24, 2026

No description provided.

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

This PR adds Copilot authentication token support to the router decision fetcher to enable authentication with the CAPI router endpoint. The router decision fetcher is used to determine which AI model should handle a query based on reasoning classification.

Changes:

  • Added IAuthenticationService dependency to RouterDecisionFetcher constructor
  • Modified getRoutedModel to retrieve Copilot auth token and include it in Authorization header
  • Updated AutomodeService to pass the authentication service when instantiating RouterDecisionFetcher

Reviewed changes

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

File Description
src/platform/endpoint/node/routerDecisionFetcher.ts Added IAuthenticationService parameter to constructor, retrieved Copilot token, and added Bearer token to Authorization header
src/platform/endpoint/node/automodeService.ts Updated RouterDecisionFetcher instantiation to pass the authentication service

@aashna aashna force-pushed the aashnagarg/router-auth-headers branch from 000375e to 3218638 Compare February 24, 2026 23:36
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
let response: Response;
try {
response = await this._fetcherService.fetch(routerApiUrl, {
Copy link
Member

Choose a reason for hiding this comment

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

The URI here is user configured. If they put something that isn't a GitHub url, their Copilot token will be still sent there.

We should check if the url is a GitHub url and only send the copilot token in that case

@aashna aashna force-pushed the aashnagarg/router-auth-headers branch from 3218638 to f235976 Compare February 25, 2026 18:05
TylerLeonhardt
TylerLeonhardt previously approved these changes Feb 25, 2026
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 25, 2026
@jruales jruales assigned TylerLeonhardt and unassigned jruales Feb 25, 2026
@TylerLeonhardt TylerLeonhardt added this pull request to the merge queue Feb 25, 2026
Merged via the queue into microsoft:main with commit 4027449 Feb 25, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants