feat: add minimum quota reserve and account cooldown#584
Open
steel-code-agent wants to merge 2 commits intodecolua:masterfrom
Open
feat: add minimum quota reserve and account cooldown#584steel-code-agent wants to merge 2 commits intodecolua:masterfrom
steel-code-agent wants to merge 2 commits intodecolua:masterfrom
Conversation
Per-connection settings to prevent draining accounts to zero and to rest them after quota resets: - Minimum Reserve: block account when remaining quota drops below a configurable threshold (default 15%) - Cooldown on Reset: keep account unavailable for N minutes (default 30) after quota refreshes, preventing immediate re-use Architecture: - Background monitor service (60s polling) checks quota for enabled connections and manages state transitions in-memory - auth.js filters out reserve-blocked and cooling-down connections during account selection (zero-latency in-memory lookup) - GET /api/quota-reserve exposes state to frontend - Edit modal shows Quota Management section for OAuth providers - Quota Tracker cards show orange "Reserve limit" and blue "Cooldown" badges with live countdown - Russian i18n translations included Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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.
Summary
auth.js— pure in-memory lookup with zero latency impact.New files
src/shared/utils/quotaPercent.jssrc/shared/services/quotaReserveState.jssrc/shared/services/credentialRefresh.jssrc/shared/services/quotaMonitorService.jssrc/app/api/quota-reserve/route.jsModified files
src/sse/services/auth.jsisConnectionReserveBlocked()filter in account selectionsrc/app/api/providers/[id]/route.jsminReserveEnabled,minReservePercent,cooldownEnabled,cooldownMinutessrc/app/api/usage/[connectionId]/route.jscredentialRefreshservicesrc/shared/services/initializeApp.jsstartQuotaMonitor()src/shared/components/EditConnectionModal.jssrc/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.jspublic/i18n/literals/ru.jsonTest plan
next build --webpack)🤖 Generated with Claude Code