Copilot Chat: ADO auth-change handler re-fetches semanticsearchstatus on every event (missing session-id dedup)

Open
#320,570 3 comments 0 reactions 1 assignee View on GitHub

@mjbvz is already working on this.

Since Jun 9, 2026.

Assessment

This issue has not been assessed yet.

Description

bug chat-codebase

Does this issue occur when all extensions are disabled?: No

  • VS Code Version: 1.123.0 (system setup)
  • OS Version: Windows_NT x64 10.0.26200

Steps to Reproduce:

  1. Open VS Code with a workspace containing 2+ Azure DevOps repositories.
  2. Sign in via the Microsoft auth provider.
  3. Wait for all repos to reach Ready.
  4. Switch focus to another window and back (or open a new chat turn).
  5. In Dev Tools → Network, observe: one GET …/semanticsearchstatus request fires per ADO repo, every time, even though the repos are already Ready.

Expected: No re-fetch when nothing changed.
Actual: N requests per event per user, indefinitely.

Root cause

In extensions/copilot/src/platform/workspaceChunkSearch/node/codeSearch/codeSearchChunkSearch.ts, the GitHub auth-change handler already dedupes no-op events by comparing session ids (lines 175–188). The ADO handler (lines 190–195) doesn't - it fires updateRepoStatuses('ado', …) on every event regardless of whether anything actually changed.

Suggested fix

Apply the same session-id dedup that GitHub already has. Sketch:

// codeSearchChunkSearch.ts, replace lines 190-195
{
    let lastAdoSessionId = this._authenticationService.anyAdoSession?.id;
    this._register(Event.any(
        this._authenticationService.onDidAdoAuthenticationChange,
        this._adoCodeSearchService.onDidChangeIndexState
    )(() => {
        const adoSessionId = this._authenticationService.anyAdoSession?.id;
        if (adoSessionId === lastAdoSessionId) {
            return;
        }
        lastAdoSessionId = adoSessionId;
        this.updateRepoStatuses('ado', new TelemetryCorrelationId('CodeSearchChunkSearch::onDidAdoChange'));
    }));
}

Related to commit https://github.com/microsoft/vscode/commit/9e2a9e36812ae9065a6841702229f41859d064b8 which mapped 401/403 to 'not-authorized' and made NotAuthorized sticky in refreshStatusFromEndpoint. That change stopped the silent retry loop for misconfigured users. This issue covers the remaining steady-state volume from healthy authenticated users, which has the same root pattern - updateRepoStatuses firing even when nothing changed.

(Optional, separate) Bonus improvement

updateRepoStatuses calls refreshStatusFromEndpoint(true, …) (line 1003), which forces a network refresh even for repos already in Ready. Adding a short TTL (e.g., 5–10 min) so Ready is sticky would further reduce request volume, but is a larger change. Happy to file separately if useful.

Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.