@@ -943,9 +943,11 @@ describe("MODEL_CACHE_EMPTY_RESPONSE throttling", () => {
943943 } )
944944
945945 it ( "never shares results across different zoo-gateway credentials (auth isolation)" , async ( ) => {
946- // The in-flight fetch map must key on the full compound identity for auth-scoped
947- // providers too, so a slow fetch for one account's session token can never resolve
948- // into a concurrent call carrying a different account's token.
946+ // Auth-scoped providers (see AUTH_SCOPED_PROVIDERS) bypass dedupedFetch entirely --
947+ // shouldSkipCache is true for zoo-gateway, so every call fires its own provider fetch
948+ // and none are deduplicated. That means two concurrent calls can never resolve into
949+ // each other's result regardless of token, which this test confirms for two different
950+ // account tokens; the companion case below confirms the same holds for one token too.
949951 const accountAModels = {
950952 "zoo-gateway/account-a-model" : {
951953 maxTokens : 4096 ,
@@ -991,6 +993,20 @@ describe("MODEL_CACHE_EMPTY_RESPONSE throttling", () => {
991993 expect ( resultA ) . toEqual ( accountAModels )
992994 expect ( resultB ) . toEqual ( accountBModels )
993995 } )
996+
997+ it ( "never deduplicates concurrent zoo-gateway fetches, even for the same token" , async ( ) => {
998+ // Auth-scoped providers skip dedupedFetch unconditionally, so even two calls carrying
999+ // an identical token each fire their own provider fetch -- there is no in-flight sharing
1000+ // to key correctly or incorrectly for these providers.
1001+ freshMockGetZooGatewayModels . mockResolvedValue ( { } )
1002+
1003+ await Promise . all ( [
1004+ freshGetModels ( { provider : providerIdentifiers . zooGateway , apiKey : "same-token" } ) ,
1005+ freshGetModels ( { provider : providerIdentifiers . zooGateway , apiKey : "same-token" } ) ,
1006+ ] )
1007+
1008+ expect ( freshMockGetZooGatewayModels ) . toHaveBeenCalledTimes ( 2 )
1009+ } )
9941010} )
9951011
9961012describe ( "key-scoped cache key derivation" , ( ) => {
0 commit comments