Skip to content

fix(cli): render quota bars in ocx provider quota - #2586

Merged
lidge-jun merged 1 commit into
devfrom
codex/provider-quota-render-2565
Aug 25, 2026
Merged

lidge-jun merged 1 commit into
devfrom
codex/provider-quota-render-2565

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

Closes #2565.

quota() rendered the response through summaryLines(), a depth-1 flattener that emits
N item(s) for a non-scalar array. Every fetched report was discarded, so the default
invocation of the command printed a count and users had to pipe --json through a parser
to read their own quota.

The fix reuses providerQuotaLine, the formatter ocx account refresh already uses, so
both commands render the same shape.

Verification

Before:

$ ocx provider quota
generatedAt: 1787668202536
reports: 5 item(s)

After, against the same live proxy:

$ ocx provider quota
openai weekly 1%
anthropic 5h 9% resets 2026-08-25T19:29:59.802Z weekly 45% resets 2026-08-28T14:59:59.802Z
xai weekly 28% resets 2026-08-27T10:26:01.460Z
cursor monthly 0.69% resets 2026-09-16T16:54:57.000Z First-party models 0.77% ...
google-antigravity Gem 0% resets 2026-08-25T21:41:18.000Z Cla 0% ...
$ bun test tests/cli-headless-parity.test.ts
 32 pass, 0 fail

$ bun x tsc --noEmit
(clean)

Percentages are not reformatted here: ocx account refresh prints the same raw values, and
changing the shared formatter's precision is a separate decision from repairing a dropped
projection.

Checklist

  • Targets dev
  • Based on the current dev head
  • Verified against a live proxy, not only in tests
  • Typecheck clean
  • No secrets or account identifiers in the diff

quota() rendered the response through summaryLines(), a depth-1 flattener
that emits 'N item(s)' for a non-scalar array. Every fetched report was
discarded, so the default invocation printed a count and users had to pipe
--json through a parser to read their own quota.

Reuses providerQuotaLine, the formatter ocx account refresh already uses,
so both commands render the same shape.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner August 25, 2026 16:42
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 3 minutes.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0fc36f8b-524c-48f6-8c5d-da5a67146fd8

📥 Commits

Reviewing files that changed from the base of the PR and between 3838a52 and 216c082.

📒 Files selected for processing (3)
  • src/cli/account-extended.ts
  • src/cli/provider-runtime.ts
  • tests/cli-headless-parity.test.ts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lidge-jun
lidge-jun merged commit 073ae69 into dev Aug 25, 2026
9 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@lidge-jun
lidge-jun deleted the codex/provider-quota-render-2565 branch August 25, 2026 16:42
@github-actions github-actions Bot added the bug Something isn't working label Aug 25, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 216c082766

ℹ️ 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".

Comment on lines +704 to +705
test("one line per report, using the same formatter as ocx account refresh", () => {
const line = providerQuotaLine("anthropic", report("anthropic", {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exercise the provider quota command in the regression test

These tests call the pre-existing providerQuotaLine formatter directly, so they still pass if quota() is reverted to summaryLines, maps the wrong response field, or fails to preserve --refresh; consequently, the behavior changed by this commit has no regression coverage. Invoke handleProviderRuntimeCommand("quota", ...) through fakeRuntime, capture stdout, and assert both the request path and rendered report lines.

AGENTS.md reference: AGENTS.md:L276-L278

Useful? React with 👍 / 👎.

tarunravi pushed a commit to tarunravi/opencodex that referenced this pull request Sep 14, 2026
quota() rendered the response through summaryLines(), a depth-1 flattener
that emits 'N item(s)' for a non-scalar array. Every fetched report was
discarded, so the default invocation printed a count and users had to pipe
--json through a parser to read their own quota.

Reuses providerQuotaLine, the formatter ocx account refresh already uses,
so both commands render the same shape.
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
quota() rendered the response through summaryLines(), a depth-1 flattener
that emits 'N item(s)' for a non-scalar array. Every fetched report was
discarded, so the default invocation printed a count and users had to pipe
--json through a parser to read their own quota.

Reuses providerQuotaLine, the formatter ocx account refresh already uses,
so both commands render the same shape.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant