Repository navigation
feat(cli): add per-account quota to ocx account list - #2587
Conversation
The proxy already probes per-credential usage and the dashboard already renders it, but no CLI command exposed it: fetchOAuthRows never passed quota=1, so a headless or SSH session had to hand-roll an authenticated curl against the management API to answer 'which account has quota left'. --quota opts into the probe and adds a QUOTA column; the default listing stays a cheap local read. --refresh bypasses the server TTL. An unprobed provider shows '-' and a failed probe shows 'unavailable', because blank would read as no usage rather than not measured. Two DTO spellings reach the same field - the per-account probe reports fiveHourPercent, the Codex pool reports shortPercent - and both render as 5h.
|
Warning Review limit reachedNext included review available in 20 seconds. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
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. Comment |
|
✅ Deterministic PR hygiene checks passed. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ddefc7358d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| quota?: { refresh?: boolean }, | ||
| ): Promise<FamilyRows> { | ||
| if (type === "codex") return fetchCodexRows(deps, baseUrl); |
There was a problem hiding this comment.
Forward quota requests to Codex account reads
When the target is openai, including the Codex rows in an unqualified list, the new quota option reaches fetchRows but this branch drops it and calls fetchCodexRows with its default false. Consequently, ocx account list openai --quota [--refresh] neither adds ?refresh=1 nor projects the returned quota, so every Codex row displays - and the newly supported shortPercent rendering is unreachable. Pass separate include-quota and refresh state into the Codex reader, and cover the command-level request/output path rather than only the formatter.
AGENTS.md reference: src/AGENTS.md:L24-L25
Useful? React with 👍 / 👎.
| const wantsQuota = consumeFlag(rest, "--quota"); | ||
| const refreshQuota = consumeFlag(rest, "--refresh"); |
There was a problem hiding this comment.
Reject or honor refresh when quota is omitted
If an operator runs ocx account list anthropic --refresh without --quota, both flags are accepted and removed, but the request options are discarded because wantsQuota is false; the command exits successfully with an ordinary cached/non-quota listing. Since the usage nests --refresh under --quota, this unsupported combination should return a usage error, or --refresh should imply quota, with focused argument-path coverage.
AGENTS.md reference: src/AGENTS.md:L24-L25
Useful? React with 👍 / 👎.
| ``` | ||
|
|
||
| ### `ocx account list [provider] [--json] [--all]` | ||
| ### `ocx account list [provider] [--json] [--all] [--quota [--refresh]]` |
There was a problem hiding this comment.
Synchronize quota documentation across translated pages
The English page now documents the new flags and conditional QUOTA column, but all seven translated copies found under docs-site/src/content/docs/{fr,ja,ko,ru,tr,zh-cn,zh-tw}/reference/cli/providers-accounts.md still publish the old list [provider] [--json] [--all] signature and six-column output. Users viewing those locales therefore cannot discover this workflow and receive a stale command contract; update each directly affected page alongside the canonical source.
AGENTS.md reference: docs-site/AGENTS.md:L15-L16
Useful? React with 👍 / 👎.
The proxy already probes per-credential usage and the dashboard already renders it, but no CLI command exposed it: fetchOAuthRows never passed quota=1, so a headless or SSH session had to hand-roll an authenticated curl against the management API to answer 'which account has quota left'. --quota opts into the probe and adds a QUOTA column; the default listing stays a cheap local read. --refresh bypasses the server TTL. An unprobed provider shows '-' and a failed probe shows 'unavailable', because blank would read as no usage rather than not measured. Two DTO spellings reach the same field - the per-account probe reports fiveHourPercent, the Codex pool reports shortPercent - and both render as 5h.
The proxy already probes per-credential usage and the dashboard already renders it, but no CLI command exposed it: fetchOAuthRows never passed quota=1, so a headless or SSH session had to hand-roll an authenticated curl against the management API to answer 'which account has quota left'. --quota opts into the probe and adds a QUOTA column; the default listing stays a cheap local read. --refresh bypasses the server TTL. An unprobed provider shows '-' and a failed probe shows 'unavailable', because blank would read as no usage rather than not measured. Two DTO spellings reach the same field - the per-account probe reports fiveHourPercent, the Codex pool reports shortPercent - and both render as 5h.
Summary
Closes #2566.
The proxy already probes per-credential usage (
fetchProviderAccountQuotas) and exposes itat
/api/oauth/accounts?provider=…"a=1, and the dashboard already renders it. The CLIjust never passed
quota=1, so a headless or SSH session had to hand-roll an authenticatedcurl against the management API — with the admin token read off disk — to answer "which
account has quota left before I start a long session".
--quotaopts into the probe and adds aQUOTAcolumn. It stays opt-in because the serverprobes the upstream once per stored credential; the default listing remains a local read.
--refreshbypasses the cached result.Two details worth naming:
-and a failed probe showsunavailable. Blank would read as"no usage" rather than "not measured", which is the wrong thing to tell someone choosing an
account.
fiveHourPercentwhile the Codex pool reports the same idea as
shortPercent. Both render as5h.Verification
Against a live proxy with three Anthropic logins:
Exactly the decision the issue describes: the active account is at 45% weekly while a sibling
sits at 98%.
The default listing is unchanged (no
QUOTAcolumn), and a full--quotarun shows-forproviders without a per-account probe.
--jsoncarries the complete breakdown.Docs updated in
docs-site/src/content/docs/reference/cli/providers-accounts.md.Checklist
devdevhead