From e91ad53fda8e25e1e73cbb535b54fdb47ec977a8 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Fri, 11 Sep 2026 11:30:24 +0530 Subject: [PATCH] fix(desktop): a failed native refresh only confirms reauth on a dead refresh token mintGatewayWsTicket swallowed every forced-refresh failure into null, so a 5xx or timeout from /auth/native/refresh re-threw the original bearer 401 and latched the boot as "session expired" while the refresh token was still stored. Let a transport failure propagate: ensureNativeAccessToken already returns null (and drops the tokens) on a 401, which is the only refresh outcome that confirms the rejection. --- apps/desktop/electron/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts index 16497919b8..b6adaf3a2e 100644 --- a/apps/desktop/electron/main.ts +++ b/apps/desktop/electron/main.ts @@ -8325,7 +8325,11 @@ async function mintGatewayWsTicket(baseUrl, headers = {}) { throw error } - const rotatedAt = await ensureNativeAccessToken(baseUrl, { forceRefresh: true }).catch(() => null) + // A dead refresh token returns null (tokens dropped) and the original + // 401 stands. A refresh that could not be evaluated at all (5xx, + // timeout, ECONNRESET) is a transport blip, not a verdict on the + // session — let it propagate so the boot stays retryable. + const rotatedAt = await ensureNativeAccessToken(baseUrl, { forceRefresh: true }) if (!rotatedAt || rotatedAt === nativeAt) { throw error