Repository navigation
feat(quota): say why an API-key balance is unknown and when it was last read - #8519
Merged
Merged
Conversation
added 2 commits
November 11, 2026 11:14
…st read API-key quota rows now carry two additive fields. quotaUnknownReason is a closed set (no_balance_source, passive_not_observed, read_failed, not_read) that explains a missing balance, and quotaReadAt is the time of the last read, success or failure, taken from the per-key cache entry. Unsupported destinations report no_balance_source and no value; probe failures report read_failed; passive OAuth accounts with no observation report passive_not_observed. Existing quotaMode values and response shapes are unchanged, older CLIs ignore the fields, and the CLI drops reasons it does not know. The CLI QUOTA column reads "unsupported: balance UNKNOWN (no balance source)" and "probe: mo 12%; read 3 min ago", and never prints zero for an unknown balance. The dashboard shows "Last read" under an unknown or failed reading, translated in every locale. Refs #8397
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
✅ Deterministic PR hygiene checks passed. |
Contributor
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
added 2 commits
November 11, 2026 11:28
…bad read time (#8397 review) - A successful read whose provider reports no meterable balance (Abliteration zero credits, a Z.AI plan with no model window) now carries quotaUnknownReason "not_reported" instead of a read time with no reason. - A key added while the read was in flight is "not_read". - The CLI drops a malformed quotaReadAt instead of failing the whole listing. - Route tests for the empty read and for a paused key (not_read, no read time, no request). Refs #8397
Owner
Author
|
Maintainer judgment
|
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
For an API-key provider account,
ocx account list <provider> --quotaansweredquotaMode: unsupportedwith no reason, so a reader could not tell "no balance source" from "balance is zero", and a probe provider never said when its balance was last read (#8397). Owner decision: step 1 only. When a balance is unknown, show why and when it was last read. Show values only for providers that already have a balance reader. Organization cost APIs that need an admin key are out of scope, and no provider requests are added.API-key quota rows (and passive OAuth accounts) gain two optional fields:
quotaUnknownReason, a closed set:no_balance_source: no reader exists for this destination (everyunsupportedkey).passive_not_observed: a passive OAuth provider has no observation for this account yet.read_failed: a reader exists and its last read failed.not_read: a reader exists but no read was made (paused key, a key that changed mid-read, or the flight cap).quotaReadAt: epoch milliseconds of the last read, success or failure, taken from the per-key cache entry. It is omitted when no read happened.Probe values still appear only for
quotaMode: "probe"destinations. The existingquotaModevalues and shapes are unchanged, older CLIs ignore the new fields, and this CLI drops a reason it does not know instead of failing. Human output never prints zero for an unknown balance:An
unsupportedkey readsunsupported: balance UNKNOWN (no balance source). The dashboard adds "Last read: " under an unknown or failed reading, translated in all 11 locales.Closes #8397
The screenshot and the CLI line above come from a throwaway local proxy with one DeepSeek key, a provider that has a balance reader. Its balance read was answered with a 401 inside the process, so nothing was sent to DeepSeek.
--jsonreturned"quotaUnknownReason": "read_failed"andquotaReadAtfor the same row.Verification
src/andgui/put back todev, six new cases fail. They cover the passive account, unsupported keys, probe read time and read failure, human text with an unknown reason dropped, the GUI last-read line, and the locale coverage. They all pass with the change.dev(including feat(accounts): explicit health-gated resume, and login that clears an automatic pause #8515, which touchesoauth-account-routes.tsandsrc/cli/account.ts): the PR diff is byte-identical (samegit patch-id).bun teston the quota, route, GUI and API-key tests, plus the feat(accounts): explicit health-gated resume, and login that clears an automatic pause #8515 resume tests, layout, ratchet, Lab boundary andskill-ocx: 215 pass, 0 fail.bun run typecheck(2,400 files),bun run lint:gui,bun run privacy:scan,bun run structure:checkandbun run skill:surface:check: pass.test:changed(run by the implementing lane alongside another worktree's suite): 43,099 pass, 96 fail. Every failing file was rerun alone. One failure was this change (an expectation inprovider-api-keys.test.tsthat lists row keys) and is fixed. The others passed alone, failed only on spawned-process timeouts and also passed ondev, or also fail ondev(ocx-launcher-desktop-handoff,update-home-launcher,catalog-omit-disabled-native,cli-codex-cli-update-boundary, andlink-ocx-child-e2e, which needs cargo).bun run test; macOS/Windows CI (manualdevbatch only).Checklist