From 3a25494cd8d5cbc9117a38e2e7e53c4323c75592 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 31 Aug 2026 12:10:50 +0000 Subject: [PATCH] fix(scope-recovery): log error in hasActiveOAuthGrant catch block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hasActiveOAuthGrant function silently swallowed all exceptions from runtime.getAuthSource(), making it impossible to diagnose database errors that could prevent the OAuth scope recovery flow from activating. Added log.debug() so failures are visible with --verbose. Co-authored-by: Miguel Betegón --- packages/cli/script/silent-catch-baseline.json | 2 +- packages/cli/src/lib/scope-recovery.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/cli/script/silent-catch-baseline.json b/packages/cli/script/silent-catch-baseline.json index 501d60e85..53555e678 100644 --- a/packages/cli/script/silent-catch-baseline.json +++ b/packages/cli/script/silent-catch-baseline.json @@ -64,7 +64,7 @@ "src/lib/resolve-team.ts": 1, "src/lib/response-cache.ts": 7, "src/lib/scan/worker-pool.ts": 1, - "src/lib/scope-recovery.ts": 1, + "src/lib/scope-recovery.ts": 0, "src/lib/sdk-invoke.ts": 2, "src/lib/search-query.ts": 1, "src/lib/sentry-client.ts": 1, diff --git a/packages/cli/src/lib/scope-recovery.ts b/packages/cli/src/lib/scope-recovery.ts index 107952869..395f3f1b7 100644 --- a/packages/cli/src/lib/scope-recovery.ts +++ b/packages/cli/src/lib/scope-recovery.ts @@ -5,6 +5,7 @@ import { type AuthSource, getAuthConfig } from "./db/auth.js"; import { ApiError, AuthError } from "./errors.js"; import type { LoginResult } from "./interactive-login.js"; import { interactivePromptsAllowed } from "./interactive-prompts.js"; +import { logger } from "./logger.js"; import { OAUTH_SCOPES } from "./oauth.js"; type InteractiveLogin = () => Promise; @@ -79,7 +80,8 @@ function hasActiveOAuthGrant( ): boolean { try { return runtime.getAuthSource() === "oauth"; - } catch { + } catch (error) { + logger.debug("Failed to read auth source for OAuth grant check", error); return false; } }