@@ -13,6 +13,7 @@ import { formatError } from '../../common/utils';
1313import { isCopilotQuery } from '../../github/copilotPrWatcher' ;
1414import { FolderRepositoryManager , ItemsResponseResult } from '../../github/folderRepositoryManager' ;
1515import { PRType } from '../../github/interface' ;
16+ import { isAuthError } from '../../github/loggingOctokit' ;
1617import { PullRequestModel } from '../../github/pullRequestModel' ;
1718import { extractRepoFromQuery } from '../../github/utils' ;
1819import { PrsTreeModel } from '../prsTreeModel' ;
@@ -299,6 +300,17 @@ export class CategoryTreeNode extends TreeNode implements vscode.TreeItem {
299300 } catch ( e ) {
300301 if ( this . isCopilot && ( e ?. response ?. status === 422 ) && e . message ?. includes ( 'the users do not exist' ) ) {
301302 // Skip it, it's copilot and the repo doesn't have copilot
303+ } else if ( isAuthError ( e ) ) {
304+ // Auth errors (revoked/expired token) are handled centrally by
305+ // CredentialStore.handleAuthError (wired up through RateLogger),
306+ // which prompts the user to re-authenticate. Showing an additional
307+ // "Fetching pull requests failed: Bad credentials" notification
308+ // here is redundant and on some platforms (e.g. macOS) the
309+ // notification can linger on screen after the user has already
310+ // completed the re-authentication flow, making it look like the
311+ // sign-in failed even when it succeeded. Just mark the tree as
312+ // needing login so the "Sign in" entry is shown.
313+ needLogin = true ;
302314 } else {
303315 const error = formatError ( e ) ;
304316 const actions : string [ ] = [ ] ;
0 commit comments