From a3242035c2aaa358885b5bde8527f5e837412c82 Mon Sep 17 00:00:00 2001 From: "buf0-bot[bot]" <252831055+buf0-bot[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 23:14:05 -0700 Subject: [PATCH] fix: pr-bug-scan findings from #1478 (#1561) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed banner Docs link to use openExternal IPC like the block variant; restricted hasKeyringFallback to same-host keyring accounts so multi-host users aren't told a fallback exists when none does. Findings addressed: - src/renderer/src/components/github-project/GhAuthErrorHelp.tsx:218-227 — Banner Docs link uses instead of shell IPC - src/main/github/auth-diagnose.ts:121-127 — hasKeyringFallback ignores host, can mislead multi-host users Rebased onto current main to drop unrelated reverts. Co-authored-by: orca-bot --- src/main/github/auth-diagnose.ts | 8 ++++++-- .../src/components/github-project/GhAuthErrorHelp.tsx | 9 ++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/github/auth-diagnose.ts b/src/main/github/auth-diagnose.ts index b356bf7b6..aeaf4b9e2 100644 --- a/src/main/github/auth-diagnose.ts +++ b/src/main/github/auth-diagnose.ts @@ -128,8 +128,12 @@ export async function diagnoseGhAuth(): Promise { ? REQUIRED_SCOPES.filter((s) => !active.scopes.includes(s)) : [...REQUIRED_SCOPES] // Is there a non-env (keyring) account we could fall back to by unsetting - // the env var? Only meaningful if the active account is env-shadowed. - const keyringFallback = accounts.find((a) => a.source === 'keyring') ?? null + // the env var? Only meaningful if the active account is env-shadowed, and + // only if the keyring login is on the SAME host — otherwise unsetting the + // env var leaves the user with no credential for the host that was active. + const keyringFallback = active + ? (accounts.find((a) => a.source === 'keyring' && a.host === active.host) ?? null) + : null return { ghAvailable, activeAccount: active, diff --git a/src/renderer/src/components/github-project/GhAuthErrorHelp.tsx b/src/renderer/src/components/github-project/GhAuthErrorHelp.tsx index 31cbf6c64..793bfec55 100644 --- a/src/renderer/src/components/github-project/GhAuthErrorHelp.tsx +++ b/src/renderer/src/components/github-project/GhAuthErrorHelp.tsx @@ -216,14 +216,13 @@ export function GhAuthErrorHelp({ ))} {docsUrl ? ( - openExternal(docsUrl)} className="inline-flex items-center gap-1 rounded border border-amber-500/30 px-1.5 py-0.5 text-[11px] hover:bg-amber-500/20" > Docs - + ) : null}