GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(quota): report unlimited A6API keys by banipest · Pull Request #1171 · lidge-jun/opencodex

Conversation

@banipest

@banipest banipest commented Aug 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

  • keep unlimited A6API API-key quota visible when finite credit totals are zero
  • expose structured USD credit values and optional expiry for finite and unlimited quota rows
  • cover unlimited keys and structured finite-credit data with focused regression tests

Verification

  • bun run typecheck
  • bun test tests/provider-quota.test.ts (86 pass, 0 fail)
  • bun run privacy:scan
  • git diff --check upstream/dev...HEAD

The earlier full-suite run had one unrelated tests/codex-sync-api.test.ts failure, reproduced unchanged on a clean upstream/dev worktree. The focused quota suite and all static/privacy checks pass after rebasing onto the latest dev.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • New Features
    • Added USD credit quota tracking, including used, limit, remaining, and utilization details.
    • Added support for unlimited credit accounts.
    • Added expiration information for metered credit quotas.
    • Quota information now accurately reflects unlimited keys and finite credit balances.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@banipest
banipest requested review from Ingwannu, Wibias and lidge-jun as code owners August 7, 2026 03:40
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the bug Something isn't working label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (2/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 2/4).

Review readiness checklist

  • ⬜ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

2/4 boxes ticked.

This PR stays in draft until every box above is ticked.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions
github-actions Bot marked this pull request as draft August 7, 2026 03:40
@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d8908c33-e617-4aae-941e-eb38f42df1dc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The quota model now supports structured USD credits. A6API parsing reports metered usage, unlimited status, expiration timestamps, and custom quota windows. Tests cover metered and unlimited accounts.

Changes

A6API credit quota reporting

Layer / File(s) Summary
Quota contract and visibility
src/providers/quota.ts
Lines 67–84 add ProviderQuotaCreditsUsd and the optional ProviderQuota.creditsUsd field. Lines 216–217 keep unlimited and percentage-based credit quotas visible.
A6API quota parsing and validation
src/providers/quota.ts, tests/provider-quota.test.ts
Lines 355–375 parse unlimited flags and expiration timestamps. Lines 398–404 report metered USD credit values. Tests at lines 285–291 and 300–328 verify metered and unlimited reports.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • lidge-jun/opencodex#693: Introduced the A6API quota handling extended by this change.
  • lidge-jun/opencodex#878: Also extends quota reporting in src/providers/quota.ts.
  • lidge-jun/opencodex#988: Introduced shared quota UI that consumes provider quota reports.

Suggested labels: enhancement

Suggested reviewers: wibias, ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: reporting unlimited A6API keys in quota results.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]
coderabbitai Bot reviewed Aug 7, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/provider-quota.test.ts`:
- Around line 300-327: Update the test around fetchProviderQuotaReports to use a
valid nonzero expires_at timestamp in the mocked unlimited-quota response, then
assert that the returned creditsUsd object includes the same expiresAt value
alongside its existing fields. Keep the test focused on propagating expiry for
unlimited accounts.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1f1dc15e-b69d-4902-9f2a-c5377732ec6c

📥 Commits

Reviewing files that changed from the base of the PR and between 1fc24f0 and 63d1c8d.

📒 Files selected for processing (2)
  • src/providers/quota.ts
  • tests/provider-quota.test.ts

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/provider-quota.test.ts
Comment on lines +300 to +327
test("A6API unlimited keys remain visible even when all finite credit totals are zero", async () => {
globalThis.fetch = (async (input: RequestInfo | URL) => new Response(JSON.stringify(
String(input).includes("subscription")
? { data: { hard_limit_usd: 100_000_000 } }
: { data: {
total_granted: 0,
total_used: 0,
total_available: 0,
unlimited_quota: true,
expires_at: 0,
} },
), { status: 200 })) as typeof fetch;

const result = await fetchProviderQuotaReports(a6apiOnlyConfig(), true);

expect(result.reports).toHaveLength(1);
expect(result.reports[0]?.quota.creditsUsd).toEqual({
used: 0,
limit: 0,
remaining: 0,
percent: 0,
unlimited: true,
});
expect(result.reports[0]?.quota.customWindows).toEqual([{
label: "Unlimited API credits",
percent: 0,
}]);
});

@coderabbitai coderabbitai Bot Aug 7, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Test expiry propagation for unlimited accounts.

Line 309 sets expires_at to 0. The test cannot detect a regression that drops expiresAt from the unlimited creditsUsd branch.

Set a valid timestamp and assert expiresAt in the expected quota object.

Proposed test update
-          expires_at: 0,
+          expires_at: "2027-01-01T00:00:00Z",
...
       percent: 0,
       unlimited: true,
+      expiresAt: Date.parse("2027-01-01T00:00:00Z"),

As per path instructions, a src/ behavior change must have a focused regression test under tests/.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test("A6API unlimited keys remain visible even when all finite credit totals are zero", async () => {
globalThis.fetch = (async (input: RequestInfo | URL) => new Response(JSON.stringify(
String(input).includes("subscription")
? { data: { hard_limit_usd: 100_000_000 } }
: { data: {
total_granted: 0,
total_used: 0,
total_available: 0,
unlimited_quota: true,
expires_at: 0,
} },
), { status: 200 })) as typeof fetch;
const result = await fetchProviderQuotaReports(a6apiOnlyConfig(), true);
expect(result.reports).toHaveLength(1);
expect(result.reports[0]?.quota.creditsUsd).toEqual({
used: 0,
limit: 0,
remaining: 0,
percent: 0,
unlimited: true,
});
expect(result.reports[0]?.quota.customWindows).toEqual([{
label: "Unlimited API credits",
percent: 0,
}]);
});
test("A6API unlimited keys remain visible even when all finite credit totals are zero", async () => {
globalThis.fetch = (async (input: RequestInfo | URL) => new Response(JSON.stringify(
String(input).includes("subscription")
? { data: { hard_limit_usd: 100_000_000 } }
: { data: {
total_granted: 0,
total_used: 0,
total_available: 0,
unlimited_quota: true,
expires_at: "2027-01-01T00:00:00Z",
} },
), { status: 200 })) as typeof fetch;
const result = await fetchProviderQuotaReports(a6apiOnlyConfig(), true);
expect(result.reports).toHaveLength(1);
expect(result.reports[0]?.quota.creditsUsd).toEqual({
used: 0,
limit: 0,
remaining: 0,
percent: 0,
unlimited: true,
expiresAt: Date.parse("2027-01-01T00:00:00Z"),
});
expect(result.reports[0]?.quota.customWindows).toEqual([{
label: "Unlimited API credits",
percent: 0,
}]);
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/provider-quota.test.ts` around lines 300 - 327, Update the test around
fetchProviderQuotaReports to use a valid nonzero expires_at timestamp in the
mocked unlimited-quota response, then assert that the returned creditsUsd object
includes the same expiresAt value alongside its existing fields. Keep the test
focused on propagating expiry for unlimited accounts.

Source: Path instructions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@banipest
banipest force-pushed the fix/a6api-unlimited-quota-v2 branch from e646862 to d2f4991 Compare August 7, 2026 04:50
banipest and others added 2 commits August 7, 2026 16:46
@banipest
fix(quota): report unlimited A6API keys
396db16
@banipest @codex
test(quota): cover unlimited A6API expiry
162be68
Co-Authored-By: Codex <[email protected]>
@banipest
banipest force-pushed the fix/a6api-unlimited-quota-v2 branch from d2f4991 to 162be68 Compare August 7, 2026 07:46
@lidge-jun lidge-jun mentioned this pull request Aug 7, 2026
fix(cursor,quota): adopt the Grok wire prefix (#1159) and unlimited A6API keys (#1171) #1208
Merged
3 tasks done
@lidge-jun

lidge-jun commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Closing in favor of #1208, which adopts this change as-is.

This PR needed no changes. It was independently re-audited against current dev and confirmed correct — the unlimited branch is properly ordered ahead of finite-total validation, expiry is preserved, and the generic customWindows row is what the GUI and CLI already consume. We are rebuilding it on our stack per the sequential-PR convention. You are credited in the commit.

Why it sat: 524 workflow runs were queued awaiting maintainer approval, 39 on open-PR branches including this one. The readiness gate verifies the ci check, and a run that never started has no result to verify — so this could not leave draft no matter what you did. Our backlog, not your PR.

Two observations recorded in #1208, neither blocking: creditsUsd and its expiry are not yet surfaced by the GUI (visibility comes from customWindows), and the unlimited flag accepts true/1/\"true\".

Thanks for catching this — a working key showing as dead is exactly the kind of bug that erodes trust in the dashboard.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lidge-jun lidge-jun closed this Aug 7, 2026
lidge-jun added a commit that referenced this pull request Aug 7, 2026
@lidge-jun
fix(quota): report unlimited A6API keys instead of hiding them (#1171)
e916ec7
Adopted from PR #1171 by @byongshintv, rebuilt on the current stack. Original
closed in favor of this commit.

An unlimited A6API key reports zero finite credit totals. Finite-total
validation then treated that as a terminal failure and returned before the key
could be represented at all, so a perfectly working key looked dead in the
dashboard.

The unlimited branch now runs ahead of that validation and emits the generic
`customWindows` row the GUI and CLI already consume, preserving expiry. It
accepts `true`, `1`, and `"true"` for the upstream flag.

Two known limitations, stated rather than discovered later: `creditsUsd` and
its expiry are not yet surfaced by the GUI — visibility comes from
`customWindows` — and neither changes existing behavior for finite keys.

Confirmed to fail with the unlimited branch disabled.
iF2007 pushed a commit to iF2007/opencodex that referenced this pull request Aug 7, 2026
@lidge-jun
fix(quota): report unlimited A6API keys instead of hiding them (lidge…
aabee91
…-jun#1171)

Adopted from PR lidge-jun#1171 by @byongshintv, rebuilt on the current stack. Original
closed in favor of this commit.

An unlimited A6API key reports zero finite credit totals. Finite-total
validation then treated that as a terminal failure and returned before the key
could be represented at all, so a perfectly working key looked dead in the
dashboard.

The unlimited branch now runs ahead of that validation and emits the generic
`customWindows` row the GUI and CLI already consume, preserving expiry. It
accepts `true`, `1`, and `"true"` for the upstream flag.

Two known limitations, stated rather than discovered later: `creditsUsd` and
its expiry are not yet surfaced by the GUI — visibility comes from
`customWindows` — and neither changes existing behavior for finite keys.

Confirmed to fail with the unlimited branch disabled.
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
@lidge-jun
fix(quota): report unlimited A6API keys instead of hiding them (lidge…
fca1a36
…-jun#1171)

Adopted from PR lidge-jun#1171 by @byongshintv, rebuilt on the current stack. Original
closed in favor of this commit.

An unlimited A6API key reports zero finite credit totals. Finite-total
validation then treated that as a terminal failure and returned before the key
could be represented at all, so a perfectly working key looked dead in the
dashboard.

The unlimited branch now runs ahead of that validation and emits the generic
`customWindows` row the GUI and CLI already consume, preserving expiry. It
accepts `true`, `1`, and `"true"` for the upstream flag.

Two known limitations, stated rather than discovered later: `creditsUsd` and
its expiry are not yet surfaced by the GUI — visibility comes from
`customWindows` — and neither changes existing behavior for finite keys.

Confirmed to fail with the unlimited branch disabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments
@lidge-jun lidge-jun Awaiting requested review from lidge-jun lidge-jun is a code owner
@Ingwannu Ingwannu Awaiting requested review from Ingwannu Ingwannu is a code owner
@Wibias Wibias Awaiting requested review from Wibias

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bug Something isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@banipest @lidge-jun
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.