File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -328,13 +328,14 @@ export function getCredentialsForSync(): ClaudeCredentials | null {
328328 return null
329329}
330330
331- export function getCachedCredentials ( ) : ClaudeCredentials | null {
331+ export function getCachedCredentials ( forceRefresh = false ) : ClaudeCredentials | null {
332332 const account = getActiveAccount ( )
333333 if ( ! account ) return null
334334
335335 const now = Date . now ( )
336336 const cached = accountCacheMap . get ( account . source )
337337 if (
338+ ! forceRefresh &&
338339 cached &&
339340 now - cached . cachedAt < CREDENTIAL_CACHE_TTL_MS &&
340341 cached . creds . expiresAt > now + 60_000
@@ -346,9 +347,25 @@ export function getCachedCredentials(): ClaudeCredentials | null {
346347 return cached . creds
347348 }
348349
350+ if ( forceRefresh ) {
351+ log ( "cache_bypass" , {
352+ source : account . source ,
353+ reason : "forced_reload" ,
354+ } )
355+ accountCacheMap . delete ( account . source )
356+ const reloaded = refreshAccount ( account . source )
357+ if ( reloaded ) {
358+ account . credentials = reloaded
359+ }
360+ }
361+
349362 log ( "cache_miss" , {
350363 source : account . source ,
351- reason : cached ? "stale or expiring" : "empty" ,
364+ reason : forceRefresh
365+ ? "forced_reload"
366+ : cached
367+ ? "stale or expiring"
368+ : "empty" ,
352369 } )
353370
354371 const fresh = refreshIfNeeded ( account )
You can’t perform that action at this time.
0 commit comments