Compare commits

...
Author SHA1 Message Date
Saoud Rizwan 61ecc60685 fix(auth): prevent logout during token refresh retry delay
When a token refresh fails with a network error, the extension waits
30 seconds before retrying. During this window, retrieveClineAuthInfo()
was returning null instead of the stored auth data.

This null value propagates to restoreRefreshTokenAndRetrieveAuthInfo()
which interprets null as 'no auth data exists' and logs the user out.

The fix returns storedAuthData during the retry delay, consistent with
how max retries exceeded and network errors are already handled.
2026-01-10 00:57:09 -08:00
2 changed files with 9 additions and 1 deletions
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
Fix random logouts during token refresh retry delay
@@ -204,7 +204,10 @@ export class ClineAuthProvider {
Logger.debug(
`Waiting ${Math.ceil((this.RETRY_DELAY_MS - timeSinceLastAttempt) / 1000)}s before retry attempt ${this.refreshRetryCount + 1}/${this.MAX_REFRESH_RETRIES}`,
)
return null
// Return stored data instead of null to prevent logout during retry delay.
// Returning null here causes restoreRefreshTokenAndRetrieveAuthInfo() to
// interpret it as "no auth data" and log the user out.
return storedAuthData
}
// Check if we've exceeded max retries