Repository navigation
fix(sse): canonicalize alias provider ids before quota fetcher lookup (#10877) - #10922
Merged
Merged
Conversation
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…7-quota-alias-lookup fix(sse): canonicalize alias provider ids before quota fetcher lookup (cheaper-inference#10877)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10877
Root cause
getResetAwareProvider()(open-sse/services/combo/quotaScoring.ts) returned the raw, lowercasedprovider/providerIdfrom a combo target with zero alias canonicalization. That raw value feedsgetQuotaFetcher(provider)inquotaStrategies.ts(reset-aware / reset-window strategies) and incombo.ts(auto-combo candidate scoring). Fetchers are registered under canonical provider ids (e.g.ollama-cloud,codex), while provider definitions declare separate alias spellings (e.g.ollamacloud,cx) that combo targets can carry astarget.provider/target.providerId. A fetcher registered under the canonical id was therefore silently missed for any target stored under an alias spelling, degrading quota-aware routing to plain priority ordering with no warning.The exact same alias class is already correctly canonicalized elsewhere (
accountFallback.ts::getCanonicalLockProvider→resolveProviderId()) for per-model lockout tracking; this PR reuses that resolver in the quota path.Fix
getResetAwareProvider()now canonicalizes viaresolveProviderId()before returning, fixing bothquotaStrategies.ts:74andquotaStrategies.ts:264(both call sites deriveproviderfrom this function).getQuotaFetcher(provider)call incombo.ts(auto-combo candidate scoring /buildAutoCandidates) is also canonicalized at the fetcher-lookup site only, without touching the other uses of thatprovidervariable (circuit breaker, historical latency keying, connection grouping) to keep the diff scoped.Regression test (TDD)
tests/unit/quota-scoring-alias-lookup-10877.test.ts:getResetAwareProvider()now returns the canonical id (was RED before the fix — asserted'ollamacloud'actual vs'ollama-cloud'expected)ollama-cloud) is now found for an alias-spelled target (ollamacloud)codex) are unaffected (no cache-key drift for non-aliased providers)nullis still returned when neitherproviderIdnorprovideris setVerification
node --import tsx/esm --test tests/unit/quota-scoring-alias-lookup-10877.test.ts→ RED before fix, GREEN aftergeneric-quota-fetcher,ollama-cloud-usage,combo/reset-window-strategy-9330,headroom-codex-quota-snapshot-6379,opencode-quota-fetcher,combo-lockout-quota-reset-6863,combo-quota-exhaustion-only-fallback,combo-priority-quota-exhaustion-cutoff-5923,combo-quota-soft-penalty,combo/auto-quota-cutoff,combo-strategies(116/116 pass)npx vitest run --config vitest.mcp.config.ts open-sse/services/combo/__tests__ open-sse/services/autoCombo/__tests__ open-sse/services/__tests__/antigravity-quota-family.test.ts→ 109/109 passnpm run typecheck:corecleannpx eslint --suppressions-location config/quality/eslint-suppressions.json <changed files>cleannode scripts/check/check-file-size.mjsOKnode scripts/check/check-complexity.mjsOK (2573 vs baseline 2774)node scripts/check/check-cognitive-complexity.mjsOK (1157 vs baseline 1223)node scripts/check/check-changelog-integrity.mjsOKOptional follow-up noted in the analysis plan-file but out of scope here: emit a deduplicated
log.warnwhen a combo member still has no fetcher after canonicalization, so degradation to priority ordering is no longer silent.