Skip to content

fix(providers): recover Kimi after quota reset - #8632

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.49from
glazec:fix/kimi-quota-reset-auto-recovery
Jul 27, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.49from
glazec:fix/kimi-quota-reset-auto-recovery

Conversation

@glazec

@glazec glazec commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Classify Kimi Coding billing-cycle 403 responses as recoverable quota exhaustion.
  • Align the connection cooldown with the earliest cached quota reset so the existing recovery scheduler can reactivate it automatically.
  • Preserve the exhausted cooldown when another quota window still reports capacity before that reset.

Related Issues

Validation

Run only the focused loop for what you changed — the full unit suite, Vitest, the
60% coverage gate, and the production build all run in CI on this PR (#8329):

  • Focused tests for the change: node --import tsx/esm --import ./open-sse/utils/setupPolyfill.ts --import ./tests/_setup/isolateDataDir.ts --test tests/unit/error-classifier.test.ts tests/unit/kimi-quota-reset-recovery.test.ts tests/unit/provider-limits-recovery.test.ts (28 passed)
  • npm run lint
  • Production-code changes include a new or updated automated test in this PR
  • SonarQube PR analysis is green or any remaining issues are explicitly documented below

Additional local checks:

  • npm run typecheck:core
  • npm run build
  • npm run test:coverage: coverage thresholds passed with 84.09% statements and lines, 78.4% branches, and 87.96% functions. The command remained nonzero because five unrelated macOS and MCP tests fail on this checkout.

Tests Added Or Updated

  • tests/unit/error-classifier.test.ts
  • tests/unit/kimi-quota-reset-recovery.test.ts
  • tests/unit/provider-limits-recovery.test.ts

Coverage Notes

The tests cover the Kimi 403 classification, reset-aware cooldown persistence, and protection against a partially refreshed quota snapshot clearing that cooldown early.

Reviewer Notes

The failure was caused by the Kimi billing-cycle message falling through as forbidden, which used the generic cooldown path. A partial weekly quota snapshot could then clear the unavailable state before the exhausted short window reset. This patch reuses the existing quota cache and recovery scheduler. It adds no migration, feature flag, dashboard change, or provider-specific scheduler.

Sanitized live verification on the reporter's Railway deployment produced a successful Kimi Coding request after quota reset. The persistent 14m dashboard warning is intentionally outside this PR so the provider recovery fix remains atomic.

The five unrelated local full-suite failures are ccr-mcp-integration, mcp-extra-forward-6178, restore-policies on macOS Bash 3, and two ServiceSupervisor PID inspection cases. None of those files or subsystems are changed here.

@glazec
glazec marked this pull request as ready for review July 26, 2026 17:09
@glazec
glazec requested a review from diegosouzapw as a code owner July 26, 2026 17:09
@diegosouzapw
diegosouzapw merged commit 01c0f8a into cheaper-inference:release/v3.8.49 Jul 27, 2026
3 checks passed
diegosouzapw added a commit that referenced this pull request Jul 27, 2026
…stryker drift

file-size: nine frozen entries could not absorb the combined result of the
31-PR train. Two distinct causes, kept apart in the baseline note on purpose:

  (1) GENUINE irreducible growth at existing chokepoints —
      providerLimits/auth (#8632), rateLimitManager (#8616),
      models-catalog-route.test (#8610).
  (2) COLLISION with #8585, which banked shrinks measured on the pre-train
      release tip while 30 sibling PRs in the SAME train grew those files
      again — chat/accountFallback (#8628), chatCore (#8613),
      videoGeneration (#8581), imageGeneration.

Ceilings re-pinned to the post-merge tip. #8612 (also in this train) automates
shrink-banking so this self-inflicted drift stops recurring.

stryker: three covering unit tests were missing from tap.testFiles —
isLocalStreamLifecycleError-abort-shape (circuitBreaker.ts, a shared base-red
that was reddening Fast Quality Gates on every open PR),
noauth-autocombo-lockout-7623 (accountFallback.ts) and
kimi-quota-reset-recovery (auth.ts), the latter two landed with this train.
@glazec
glazec deleted the fix/kimi-quota-reset-auto-recovery branch July 27, 2026 22:34
@diegosouzapw diegosouzapw mentioned this pull request Jul 28, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
* fix(providers): recover Kimi after quota reset

* docs: add Kimi quota recovery changelog
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…stryker drift

file-size: nine frozen entries could not absorb the combined result of the
31-PR train. Two distinct causes, kept apart in the baseline note on purpose:

  (1) GENUINE irreducible growth at existing chokepoints —
      providerLimits/auth (cheaper-inference#8632), rateLimitManager (cheaper-inference#8616),
      models-catalog-route.test (cheaper-inference#8610).
  (2) COLLISION with cheaper-inference#8585, which banked shrinks measured on the pre-train
      release tip while 30 sibling PRs in the SAME train grew those files
      again — chat/accountFallback (cheaper-inference#8628), chatCore (cheaper-inference#8613),
      videoGeneration (cheaper-inference#8581), imageGeneration.

Ceilings re-pinned to the post-merge tip. cheaper-inference#8612 (also in this train) automates
shrink-banking so this self-inflicted drift stops recurring.

stryker: three covering unit tests were missing from tap.testFiles —
isLocalStreamLifecycleError-abort-shape (circuitBreaker.ts, a shared base-red
that was reddening Fast Quality Gates on every open PR),
noauth-autocombo-lockout-7623 (accountFallback.ts) and
kimi-quota-reset-recovery (auth.ts), the latter two landed with this train.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
* fix(providers): recover Kimi after quota reset

* docs: add Kimi quota recovery changelog
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…stryker drift

file-size: nine frozen entries could not absorb the combined result of the
31-PR train. Two distinct causes, kept apart in the baseline note on purpose:

  (1) GENUINE irreducible growth at existing chokepoints —
      providerLimits/auth (cheaper-inference#8632), rateLimitManager (cheaper-inference#8616),
      models-catalog-route.test (cheaper-inference#8610).
  (2) COLLISION with cheaper-inference#8585, which banked shrinks measured on the pre-train
      release tip while 30 sibling PRs in the SAME train grew those files
      again — chat/accountFallback (cheaper-inference#8628), chatCore (cheaper-inference#8613),
      videoGeneration (cheaper-inference#8581), imageGeneration.

Ceilings re-pinned to the post-merge tip. cheaper-inference#8612 (also in this train) automates
shrink-banking so this self-inflicted drift stops recurring.

stryker: three covering unit tests were missing from tap.testFiles —
isLocalStreamLifecycleError-abort-shape (circuitBreaker.ts, a shared base-red
that was reddening Fast Quality Gates on every open PR),
noauth-autocombo-lockout-7623 (accountFallback.ts) and
kimi-quota-reset-recovery (auth.ts), the latter two landed with this train.
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.

fix(resilience): Kimi Coding remains disabled after billing quota resets — 403 classified as terminal banned instead of transient quota_exhausted

2 participants