Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(quota): orphan pool (no valid connection) must not contribute its slug to key scope

diegosouzapwd07d3dcdaf3a
diff --git a/src/lib/quota/quotaKey.ts b/src/lib/quota/quotaKey.ts
index 05520e7bbe..e493e64f60 100644
--- a/src/lib/quota/quotaKey.ts
+++ b/src/lib/quota/quotaKey.ts
@@ -79,6 +79,7 @@ export async function resolveQuotaKeyScope(
? pool.connectionIds
: [pool.connectionId];
+ let anyValidConnection = false;
for (const connId of connIds) {
const connection = await getProviderConnectionById(connId);
if (!connection) continue; // missing connection contributes nothing; don't abort
@@ -88,9 +89,13 @@ export async function resolveQuotaKeyScope(
connectionIdSet.add(connId);
providerSet.add(provider);
+ anyValidConnection = true;
}
- poolSlugSet.add(quotaPoolSlug(pool.name));
+ // Only expose the pool's slug when it has at least one usable connection —
+ // an orphan pool (all connections deleted) has no quotaShared-* models, so
+ // its slug must not leak into the key's scope.
+ if (anyValidConnection) poolSlugSet.add(quotaPoolSlug(pool.name));
}
return {