⚡ Sangsakala Proxy 🏠 Home
Skip to content

Offer account preferences when repository access may use the wrong account - #9127

Merged
Alex Ross (alexr00) merged 5 commits into
mainfrom
copilot/detect-multiple-accounts-issue
Nov 4, 2026
Merged

Alex Ross (alexr00) merged 5 commits into
mainfrom
copilot/detect-multiple-accounts-issue

Conversation

Copilot AI commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Users signed in with multiple GitHub accounts can encounter repository-access failures when the workspace uses the wrong account, without clear guidance on switching accounts.

  • Account guidance: On a non-SAML repository 404, detect multiple signed-in accounts and offer a modal that opens account preferences scoped to this extension and authentication provider.
  • Prompt safeguards: Show at most once per provider per window, without blocking repository discovery. Preserve existing SAML and transient-error handling, and skip UI after disposal.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

… accounts

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Detect if the user has multiple accounts in VSCode Insider Offer account preferences when repository access may use the wrong account Oct 29, 2026

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.

🟡 Changes recommended

The account-preferences warning is non-modal, can consume the one-time offer after a repository closes, and appears for environment-token credentials that account switching cannot change.

3 open issues
What changed in this PR

Adds account-switching guidance for workspace repository-access failures, helping users signed into multiple GitHub accounts identify a possible account mismatch.

Changes:

  • Offers extension-scoped account preferences after inaccessible workspace remotes are detected.
  • Adds GitHub.com-only prompting with duplicate suppression, disposal checks, and error handling.
  • Tests prompt behavior and repository discovery, including missing template repositories.
File Description
src/​test/​github/​folderRepositoryManager.test.ts Tests nonblocking workspace-remote guidance and template-repository exclusion.
src/​test/​github/​credentials.test.ts Tests account detection, prompt suppression, command execution, and disposal handling.
src/​github/​folderRepositoryManager.ts Requests account guidance for inaccessible workspace remotes.
src/​github/​credentials.ts Implements the account-preferences offer and prompt safeguards.

Review effort: Balanced

Comment thread src/github/credentials.ts Resolved
Comment thread src/github/credentials.ts Resolved
Comment thread src/github/folderRepositoryManager.ts Resolved
@alexr00
Alex Ross (alexr00) marked this pull request as ready for review November 3, 2026 14:11
Copilot AI balanced review requested due to automatic review settings November 3, 2026 14:11

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.

🔵 Needs a closer look

The account-preferences prompt is non-modal and can appear after its repository folder closes, consuming the window’s one-time guidance.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Cancel account prompts when the repository closes

src/​github/​folderRepositoryManager.ts:615

If the folder closes while authentication.getAccounts() is pending, the shared CredentialStore remains alive, so this guard still allows a warning for the closed repository and consumes the window's one-time prompt. Pass a folder-lifetime cancellation token or validity callback to the helper, and recheck it after account lookup before setting the offered flag, and before opening preferences. Add a regression test that closes the folder while account lookup is pending.

3 resolved since last review

Review effort: Balanced

@alexr00
Alex Ross (alexr00) merged commit 3a95302 into main Nov 4, 2026
7 checks passed
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.

Detect if the user has multiple accounts, and if the one configured for the workspace might be the wrong one

4 participants