File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -645,7 +645,7 @@ export const OpenAIOAuthPlugin: Plugin = async ({ client }: PluginInput) => {
645645 let newestNoAccountId : number | undefined ;
646646 let newestExactAccountId : number | undefined ;
647647 let newestAnyNonEmptyAccountId : number | undefined ;
648- let nonEmptyAccountIdCount = 0 ;
648+ const distinctNonEmptyAccountIds = new Set < string > ( ) ;
649649
650650 for ( const index of matches ) {
651651 const existing = accounts [ index ] ;
@@ -658,7 +658,7 @@ export const OpenAIOAuthPlugin: Plugin = async ({ client }: PluginInput) => {
658658 : index ;
659659 continue ;
660660 }
661- nonEmptyAccountIdCount += 1 ;
661+ distinctNonEmptyAccountIds . add ( existingAccountId ) ;
662662 newestAnyNonEmptyAccountId =
663663 typeof newestAnyNonEmptyAccountId === "number"
664664 ? pickNewestAccountIndex ( newestAnyNonEmptyAccountId , index )
@@ -677,7 +677,7 @@ export const OpenAIOAuthPlugin: Plugin = async ({ client }: PluginInput) => {
677677 if ( typeof newestNoAccountId === "number" ) {
678678 return newestNoAccountId ;
679679 }
680- if ( nonEmptyAccountIdCount === 1 ) {
680+ if ( distinctNonEmptyAccountIds . size === 1 ) {
681681 return newestAnyNonEmptyAccountId ;
682682 }
683683 return undefined ;
Original file line number Diff line number Diff line change @@ -1965,7 +1965,7 @@ describe("OpenAIOAuthPlugin persistAccountPool", () => {
19651965 expect ( mockStorage . accounts . some ( ( account ) => account . accountId === "token-personal" ) ) . toBe ( true ) ;
19661966 } ) ;
19671967
1968- it ( "preserves org/no-org shared-refresh entries with different accountId values in pre-populated storage " , async ( ) => {
1968+ it ( "preserves org/no-org shared-refresh entries with different accountId values from a single login " , async ( ) => {
19691969 const accountsModule = await import ( "../lib/accounts.js" ) ;
19701970 const authModule = await import ( "../lib/auth/auth.js" ) ;
19711971
You can’t perform that action at this time.
0 commit comments