Skip to content

Commit e8d7ee9

Browse files
Copilotalexr00
andauthored
Suppress duplicate "Bad credentials" notification after re-authentication (#8745)
* Initial plan * Suppress duplicate "Bad credentials" popup; rely on centralized re-auth Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 5379bd1 commit e8d7ee9

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/view/treeNodes/categoryNode.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { formatError } from '../../common/utils';
1313
import { isCopilotQuery } from '../../github/copilotPrWatcher';
1414
import { FolderRepositoryManager, ItemsResponseResult } from '../../github/folderRepositoryManager';
1515
import { PRType } from '../../github/interface';
16+
import { isAuthError } from '../../github/loggingOctokit';
1617
import { PullRequestModel } from '../../github/pullRequestModel';
1718
import { extractRepoFromQuery } from '../../github/utils';
1819
import { 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

Comments
 (0)