Skip to content

fix(providers): route Claude quota warnings and report applicable resets - #15624

Merged
diegosouzapw merged 6 commits into
cheaper-inference:release/v3.8.52from
feci:fix/claude-quota-warning-20261006
Oct 7, 2026
Merged

diegosouzapw merged 6 commits into
cheaper-inference:release/v3.8.52from
feci:fix/claude-quota-warning-20261006

Conversation

@feci

@feci feci commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Claude OAuth accounts at 91–93% weekly usage can report active critical limits while inference is still allowed. Cached quota selection interpreted this warning as exhaustion and rejected every request before an upstream attempt. Preserve eligibility whenever the window reports positive remaining quota, while retaining configured operator cutoffs and explicit upstream 429 handling.

When quota really is exhausted, report the latest applicable blocking reset for each account, then the earliest of those account recovery times. Exclude unrelated model windows and sessions with recovery enabled. This prevents synthetic five-minute retry messages and premature resets when several windows block the same request.

Related Issues

Validation

  • Change type: routing / provider
  • Reproduced five new failing cases before the implementation; all pass afterward.
  • node --import tsx/esm --test tests/unit/claude-scoped-quota-auth.test.ts tests/unit/claude-quota-normalization.test.ts tests/unit/claude-fable-usage.test.ts — 37 passed.
  • DISABLE_SQLITE_AUTO_BACKUP=true node --import tsx/esm --import ./open-sse/utils/setupPolyfill.ts --import ./tests/_setup/isolateDataDir.ts --test --test-force-exit tests/integration/claude-quota-chat-ordering.test.ts — 7 passed, including explicit upstream 429 cooldown precedence.
  • npm run typecheck:core
  • Changed-file ESLint, Prettier, and all pre-commit hooks.
  • npm run check:file-size -- --base-ref origin/release/v3.8.52 — passed after reducing the changed auth block.
  • npm run lint — passed.
  • Reconciled against active release/v3.8.52 at 23a1148486.
  • Production changes include automated regressions.
  • Strict core typecheck reports an existing implicit-any parameter at open-sse/services/combo/autoStrategy.ts:519; this PR does not touch that file.
  • Earlier CI runs passed all eight unit shards, Vitest, and the Claude integration regressions. Remaining reported failures concern existing dependency audits, generated provider skills, documentation translation drift, cycles, and an unrelated memory-reindex integration assertion. The build job failed without a failing step/log, so its cause is not yet established. The PR-specific file-size failure has been corrected and verified locally. Latest-head checks are pending. The base also has known failures tracked in 🔴 Release branch not green: release/v3.8.52 #15306.

Tests Added Or Updated

  • tests/unit/claude-scoped-quota-auth.test.ts

Coverage Notes

The five added cases cover both observed weekly warning percentages, configured percentage cutoffs, scoped warning versus actual exhaustion, the latest applicable reset on an account, unrelated model windows, recovery-enabled sessions, and the earliest recovery across accounts. Existing tests continue covering missing percentage telemetry and explicit upstream rejections.

Reviewer Notes

No migrations, feature flags, credentials, or deployment customizations. The explicit upstream 429 classifier is unchanged. Production validation: the predeployment /v1/messages probe returned the exact cached HTTP 429 with no selected account. After deploying the fix on the existing 3.8.52 fork build, both JSON and SSE probes for claude-opus-5-5 returned HTTP 200 and OK. The JSON probe used 41 input / 4 output tokens. Both accounts were then refreshed through the authenticated usage endpoint: their active critical weekly windows still reported 7% and 9% remaining, and repeated JSON/SSE requests succeeded. The isolated image health check and all 61 production regression tests (including existing Codex paid-credit and rotation behavior) passed. Database/configuration backups and image-only rollback were prepared; no schema changes were required.

@feci
feci requested a review from diegosouzapw as a code owner October 6, 2026 07:27
Tomas Fecko and others added 5 commits October 6, 2026 09:28
Keep model-aware applicable Claude resets and the tip predictive-warning guard.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@diegosouzapw
diegosouzapw merged commit ca46467 into cheaper-inference:release/v3.8.52 Oct 7, 2026
7 of 9 checks passed
diegosouzapw added a commit that referenced this pull request Oct 7, 2026
Records the Onda B quality drift on the post-squash tip `9214916a`. Product squashes do not carry the baseline.

File-size ceilings inside `frozen`, measured with `split("\n").length`:

- `browser-worker.ts` 4398 → 4467 (#15615)
- `EndpointPageClient.tsx` 2493 → 2531 (#15565)
- `SystemStorageTab.tsx` 1611 → 1619 (#15565)
- `imageGeneration.ts` 3346 → 3377 (#15423, #15513)
- `catalog.ts` 2127 → 2130 (#15701)
- `auth.ts` 3666 → 3668 (#15624)

`node scripts/check/check-file-size.mjs` passed. The legacy string map was not edited.

⚠️ base-red inherited: #15306
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.

2 participants