Skip to content

fix(quota): drop bespoke quota caches on upstream 429 - #16932

Open
maxmad64bis wants to merge 1 commit into
diegosouzapw:release/v3.8.52from
maxmad64bis:fix/bespoke-quota-cache-stale-after-429
Open

maxmad64bis wants to merge 1 commit into
diegosouzapw:release/v3.8.52from
maxmad64bis:fix/bespoke-quota-cache-stale-after-429

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #15306

Summary

After a real 429, the limits screen keeps the usage read before the refusal for up to a minute, and the preflight re-admits the connection just refused. That stale read comes from a 429 path that drops only the codex and generic quota caches. Each fetcher now registers how to drop its own cache, and the 429 path uses that registry, so the next preflight reads fresh usage; a non-429 response or a probe-origin failure keeps the cache.

Related Issues

Target Branch

  • Base is the active release/v3.8.x branch (the highest open release/v*), not main
  • New feature? From 3.8.55 on it is held with the v4-feature label for the v4 channel

Validation

  • Change type: provider
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • tests/unit/quota-cache-invalidation-on-429.test.ts — new: the site and the v0/tavily fetchers refetch on a 429; other statuses, probe-origin failures and registered keys are covered.
  • tests/unit/generic-quota-fetcher.test.ts — renamed dispatcher; the same 429, 200, probe and padding cases.
  • tests/unit/chatcore/execute-provider-request.test.ts — new shape case: the 429 site uses the shared dispatcher.

Coverage Notes

Fetcher files sit in open-sse/services/, their test files in tests/unit/.

  • open-sse/handlers/chatCore/executeProviderRequest.ts — chatcore/execute-provider-request.test.ts, antigravity-429-quota-cooldown.test.ts.
  • agentrouterQuotaFetcher.ts — agentrouter-quota-fetcher.test.ts.
  • bailianQuotaFetcher.ts — bailian-quota-fetcher.test.ts.
  • codexQuotaFetcher.ts — codex-quota-fetcher.test.ts.
  • context7QuotaFetcher.ts — context7-quota-fetcher.test.ts.
  • crofUsageFetcher.ts — crof-usage-fetcher.test.ts.
  • deepseekQuotaFetcher.ts — deepseek-quota-fetcher.test.ts.
  • firecrawlQuotaFetcher.ts — firecrawl-quota-fetcher.test.ts.
  • genericQuotaFetcher.ts — generic-quota-fetcher.test.ts.
  • grokCliQuotaFetcher.ts — grok-cli-quota-fetcher.test.ts.
  • grokQuotaFetcher.ts — grok-quota-fetcher.test.ts.
  • jinaQuotaFetcher.ts — jina-quota-fetcher.test.ts.
  • llmgatewayQuotaFetcher.ts — llmgateway-quota-fetcher.test.ts.
  • lyceumQuotaFetcher.ts — lyceum-quota-fetcher.test.ts.
  • moonshotQuotaFetcher.ts — moonshot-quota-fetcher.test.ts.
  • opencodeQuotaFetcher.ts — opencode-quota-fetcher.test.ts.
  • openrouterQuotaFetcher.ts — openrouter-quota-6842.test.ts.
  • quotaPreflight.ts — quota-cache-invalidation-on-429.test.ts (registry case), newapi-aggregator-preflight-dispatch.test.ts.
  • qwenTokenPlanQuotaFetcher.ts — qwen-token-plan-quota-fetcher.test.ts.
  • tavilyQuotaFetcher.ts — tavily-quota-fetcher.test.ts.
  • v0QuotaFetcher.ts — v0-quota-fetcher.test.ts.
  • xaiOauthQuotaFetcher.ts — xai-oauth-quota-fetcher.test.ts.

Reviewer Notes

@maxmad64bis
maxmad64bis force-pushed the fix/bespoke-quota-cache-stale-after-429 branch 2 times, most recently from 82a498a to b177b8c Compare October 17, 2026 03:20
the 429 path invalidates each provider's registered quota cache, so preflight stops re-admitting a connection that just answered 429
@maxmad64bis
maxmad64bis force-pushed the fix/bespoke-quota-cache-stale-after-429 branch from b177b8c to c19aa06 Compare October 17, 2026 03:59
@maxmad64bis
maxmad64bis marked this pull request as ready for review October 17, 2026 09:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant