Suppress duplicate "Bad credentials" notification after re-authentication#8745
Merged
Conversation
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix 'Bad credentials' pop up for GitHub login in VS Code
Suppress duplicate "Bad credentials" notification after re-authentication
May 12, 2026
alexr00
approved these changes
May 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR suppresses a redundant “Bad credentials” notification in the pull request category tree after a successful re-authentication, relying on the centralized auth-error handling introduced in #8728.
Changes:
- Detect auth-related API failures via
isAuthErrorinCategoryTreeNode.doGetChildren. - Skip the per-call error notification for auth errors and instead set
needLogin = trueso the tree shows the “Sign in” entry.
Show a summary per file
| File | Description |
|---|---|
| src/view/treeNodes/categoryNode.ts | Uses isAuthError to avoid showing a duplicate “Bad credentials” toast and marks the tree as needing login. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
dmitrivMS
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fix
After revoking the OAuth token on github.com and re-signing in via the prompt that VS Code shows, a
Bad credentials - https://docs.github.com/restnotification continues to linger, making it look like sign-in failed.What was the bug?
Two paths react to the same 401 from in-flight API calls:
CategoryTreeNode.doGetChildrenshows avscode.window.showErrorMessage("Fetching pull requests failed: Bad credentials …") with a "Login again" action.RateLogger.logApiErrorinvokesCredentialStore.handleAuthError, which centrally drives re-auth viavscode.authentication.getSession({ forceNewSession }).The central flow completes successfully, but the notification from (1) does not auto-dismiss. macOS native notifications stay on screen long enough that the user sees the stale "Bad credentials" message after they've already finished signing in — on Windows the toast typically dismisses before the browser round-trip completes, hiding the issue.
How did you fix it?
In
src/view/treeNodes/categoryNode.ts, when the caught error matchesisAuthError(already exported fromloggingOctokit.ts), skip the redundant notification and just markneedLogin = trueso the tree shows the "Sign in" entry. The centralizedhandleAuthErrorremains the single source of truth for the re-auth prompt.