Skip to content

fix(accounts): refresh OAuth quotas through read-only usage APIs - #8569

Open
Ming-Sir-69 wants to merge 4 commits into
Wei-Shaw:mainfrom
Ming-Sir-69:fix/account-auto-refresh-usage
Open

Ming-Sir-69 wants to merge 4 commits into
Wei-Shaw:mainfrom
Ming-Sir-69:fix/account-auto-refresh-usage

Conversation

@Ming-Sir-69

@Ming-Sir-69 Ming-Sir-69 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Automatic polling currently leaves Claude quotas stale, and OpenAI only reloads quotas when its stored account snapshot changes. As a result, the same refresh timer visibly queries Claude while OpenAI can keep showing an old value.

Connect the existing refresh timer to active quota reads for both Anthropic OAuth and OpenAI OAuth, including when the account list returns 304. Use the existing Anthropic GET usage reader and OpenAI /wham/usage reader. OpenAI active reads never invoke the synthetic /responses probe or consume a reset credit; the existing snapshot/probe path remains available to its other callers.

Automatic requests keep force=false, bypass the browser cache, merge concurrent reads and retain error backoff. OpenAI read results have a five-second success cache; explicit manual refresh bypasses successful cache entries. Slow polls finish before another timer tick replaces them. Existing Query buttons reflect the request through their loading state. Setup-token accounts keep their passive behavior.

Manual refresh keeps the existing stale-response protection. The already merged #8581 display fix is preserved without being reintroduced into this diff. This changes no scheduled-test plans, schema, account authorization, proxy assignment or automatic-reset configuration.

Validation:

  • 83 related frontend tests pass, including unchanged-list automatic refresh for both providers; typecheck, changed-file lint and production frontend build pass.
  • Backend active-batch, manual-cache, source-validation and OpenAI quota-read tests pass. An HTTP fixture asserts quota GETs and rejects model-generation/reset-consumption paths.
  • Deployed on official v0.2.21 downstream for private acceptance; real automatic/manual quota reads, loading indicators and preserved account/plan state are checked there. Deployment evidence is separate from unmerged-main validation.

CI note: the earlier backend-security run reported GO-2026-6859 in the CI Go 1.27.3 standard library (reported fixed in Go 1.27.4). This PR changes neither the toolchain pin nor workflows; security-check remediation remains separate from quota refresh.

Quota-window correctness: preserve an explicit Anthropic five_hour: null as an absent window rather than synthesizing 0%. Keep a real zero-percent window visible. Persist that distinction into the existing passive snapshot so reloads cannot recreate it. For OpenAI, current personal Pro tiers have no five-hour limit per official policy; active reads also honor which windows are actually reported and never resurrect a missing window from old snapshots. Plus/unknown/workspace plans retain observed limits. No account IDs, email rules or plan-name heuristics for Claude Ultra verification are hardcoded.

Policy references checked 2026-11-15:

Window-presence regressions pass for explicit null, real zero, omitted/unknown, passive reload, all personal Pro tiers, Plus and stale OpenAI snapshots. Steve's read-only upstream response has five_hour: null; the other Claude account reports a real zero window. No model-generation request was used to infer quota availability.

@Ming-Sir-69 Ming-Sir-69 changed the title fix(accounts): refresh Anthropic usage during automatic polling feat(accounts): native Claude quota checks without inference Nov 7, 2026
@Ming-Sir-69 Ming-Sir-69 changed the title feat(accounts): native Claude quota checks without inference feat(accounts): independent Claude quota checks and visible controls Nov 7, 2026
@Ming-Sir-69 Ming-Sir-69 changed the title feat(accounts): independent Claude quota checks and visible controls fix(accounts): refresh Claude usage through the official quota reader Nov 7, 2026
@Ming-Sir-69
Ming-Sir-69 force-pushed the fix/account-auto-refresh-usage branch 3 times, most recently from a53f022 to b94671f Compare November 7, 2026 14:29
@Ming-Sir-69
Ming-Sir-69 force-pushed the fix/account-auto-refresh-usage branch from b94671f to ef0b5e5 Compare November 14, 2026 16:33
@Ming-Sir-69 Ming-Sir-69 changed the title fix(accounts): refresh Claude usage through the official quota reader fix(accounts): refresh OAuth quotas through read-only usage APIs Nov 14, 2026
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