@@ -3,7 +3,7 @@ import { loadAccounts, saveAccounts, type AccountStorageV4, type AccountMetadata
33import type { OAuthAuthDetails , RefreshParts } from "./types" ;
44import type { AccountSelectionStrategy } from "./config/schema" ;
55import { getHealthTracker , getTokenTracker , selectHybridAccount , type AccountWithMetrics } from "./rotation" ;
6- import { generateFingerprint , type Fingerprint , type FingerprintVersion , MAX_FINGERPRINT_HISTORY } from "./fingerprint" ;
6+ import { generateFingerprint , updateFingerprintVersion , type Fingerprint , type FingerprintVersion , MAX_FINGERPRINT_HISTORY } from "./fingerprint" ;
77import type { QuotaGroup , QuotaGroupSummary } from "./quota" ;
88import { getModelFamily } from "./transform/model-resolver" ;
99import { debugLogToFile } from "./debug" ;
@@ -371,6 +371,16 @@ export class AccountManager {
371371 } )
372372 . filter ( ( a ) : a is ManagedAccount => a !== null ) ;
373373
374+ // Update fingerprint versions to match the current runtime version.
375+ // Saved fingerprints may carry an older version string; this ensures
376+ // they always reflect the latest fetched (or fallback) version.
377+ let fingerprintVersionChanged = false ;
378+ for ( const acc of this . accounts ) {
379+ if ( acc . fingerprint && updateFingerprintVersion ( acc . fingerprint ) ) {
380+ fingerprintVersionChanged = true ;
381+ }
382+ }
383+
374384 this . cursor = clampNonNegativeInt ( stored . activeIndex , 0 ) ;
375385 if ( this . accounts . length > 0 ) {
376386 this . cursor = this . cursor % this . accounts . length ;
@@ -385,6 +395,11 @@ export class AccountManager {
385395 ) % this . accounts . length ;
386396 }
387397
398+ // Persist updated fingerprint versions to disk
399+ if ( fingerprintVersionChanged ) {
400+ this . requestSaveToDisk ( ) ;
401+ }
402+
388403 return ;
389404 }
390405
0 commit comments