Repository navigation
Conversation
- Anchor auto-balance priorities to the default (healthy 0, low -5, critical -10) so depleted credentials rank below untouched ones. - Read current priority/weight from the stored credential instead of the list payload, which lacks weight, so unchanged values skip the PATCH. - Remember manual priority/weight before the first change and restore them when auto-balance is turned off. - Mark model- and feature-scoped quota rows and compute the bottleneck from account-wide windows, falling back to the healthiest model group. - Stop mutating credential objects held in React state; publish routing changes so the quota and auth file pages update immutably. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Serialize sync and restore per credential and re-check the toggle so a late sync can no longer re-apply auto values after toggle-off. - Treat the Claude 7-day OAuth apps window as account-wide. - Forget saved originals for credentials that no longer exist instead of failing every restore. - Remember the values auto-balance last applied and leave credentials edited by hand untouched on restore. - Read only priority and weight from the credential download so unrelated metadata validation cannot block balancing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Listen for storage events so turning auto-balance off in one tab updates every other open tab and its switch. - Re-read the stored toggle before syncing or restoring, so a tab that missed the event still stops applying auto values. - Keep the in-memory value when storage is unavailable instead of treating it as off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
When managing multiple OAuth accounts for the same provider (e.g., Claude Pro/Max, Codex, Antigravity, Kimi), standard
round-robinorfill-firstrouting strategies do not account for the actual remaining percentage across rolling quota windows (5-hour and 7-day limits). As a result, accounts that are nearly exhausted continue receiving equal traffic unless manually adjusted or until they hit hard HTTP 429 cooldowns.This PR adds an opt-in Auto-balance weights toggle to the Quota Lookup toolbar that automatically synchronizes each OAuth credential's
priorityandweightfields whenever its quota is fetched or refreshed.Changes
src/services/quotaAutoBalance.ts:priorityandweightfrom fetchedQuotaStaterows:priority: 10,weightscaled proportionally (priority: 5so healthy accounts are preferred first.priority: 1,weight: 1as a last-resort fallback.PATCH /credentials/fieldsonly when computedpriorityorweightdiffers from the credential's current values.src/services/quotaEnrichment.ts:commitFetchedQuotaso any successful quota refresh (from Quota Lookup or Auth Files) triggers non-blocking routing sync when auto-balance is enabled.src/pages/QuotaPage.tsx:Auto-balance weightsswitch toOAuthPageToolbarand immediately applies cached quota states when toggled on.en,zh-CN,zh-TW, andjainsrc/i18n/authFileList.ts.tests/quotaAutoBalance.test.tscovering tier calculation and redundant-PATCH avoidance.