Skip to content

Commit 7aa2062

Browse files
committed
refactor(api): retain auth-scoped provider set
1 parent 058bb63 commit 7aa2062

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/api/providers/fetchers/modelCache.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,17 @@ const KEY_SCOPED_PROVIDERS: ReadonlySet<RouterName> = new Set([
6666
providerIdentifiers.moonshot, // Per-key model visibility (api.moonshot.ai vs api.moonshot.cn)
6767
])
6868

69+
// Providers whose model lists are scoped to the signed-in user (e.g. per-account
70+
// allowlists or org policies). For these we MUST NOT cache results on disk or
71+
// in memory: a sign-in/out cycle could otherwise serve a previous user's model
72+
// list to the next user, and stale data could mask backend allowlist updates.
73+
const AUTH_SCOPED_PROVIDERS: ReadonlySet<RouterName> = new Set([
74+
providerIdentifiers.zooGateway,
75+
providerIdentifiers.kimiCode,
76+
])
77+
6978
function isAuthScopedProvider(provider: RouterName): boolean {
70-
// Signed-in model lists must never cross users through memory, disk, or in-flight caching.
71-
return provider === providerIdentifiers.zooGateway || provider === providerIdentifiers.kimiCode
79+
return AUTH_SCOPED_PROVIDERS.has(provider)
7280
}
7381

7482
// Memoize derived digests so the deliberately-structureless KDF runs at most once per

0 commit comments

Comments
 (0)