feat(web): show usage limits and reset credits in provider settings - #9598
feat(web): show usage limits and reset credits in provider settings#9598ProtonDev-sys wants to merge 1 commit into
Conversation
The Usage page already draws each provider's quota windows and banked reset credits, but the provider editor in Settings said nothing about them. Reuse the same block there so a user checking a Codex or Claude account sees its windows and can redeem a reset credit without leaving Settings. The section is skipped for accounts that can never report limits (API key) and the redeem button follows the panel's read-only gate.
There was a problem hiding this comment.
🟠 High
An already-open dialog still lets the user redeem a credit after readOnly becomes true, so clicking Use credit dispatches consumeResetCredit without operate permission. readOnly only disables the opener; also disable the confirmation button.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/usage/UsageLimits.tsx around line 405:
An already-open dialog still lets the user redeem a credit after `readOnly` becomes `true`, so clicking `Use credit` dispatches `consumeResetCredit` without operate permission. `readOnly` only disables the opener; also disable the confirmation button.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds provider quota visibility and an irreversible reset-credit action to a new settings surface, rather than only changing presentation of an existing path. An unresolved high-severity finding also identifies a read-only confirmation-path risk, so the change warrants closer review. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
Summary
The Usage → Limits page already renders each provider's subscription quota windows and banked reset credits (Codex
account/rateLimits/read+provider.consumeResetCredit). The provider editor in Settings → Providers said nothing about them, so checking your Codex limits or redeeming a banked reset meant leaving Settings.This reuses the existing block in the provider editor as a Usage limits section.
Changes
UsageLimits.tsx: extractProviderUsageLimitsBlock(windows + reset credits) fromProviderLimits; add areadOnlygate on the redeem button. The Usage page renders exactly what it did before.ProviderInstanceCard.tsx: optionalusageLimitsslot, rendered as a "Usage limits" section after Setup (editor mode only).ProviderSettingsPanel.tsx: pass the block when the live provider reportsusageLimits. Skipped whenunavailable.reason === "unsupported"(API-key accounts) so Settings stays quiet; probe failures still surface. Redeem follows the panel'sreadOnly.ProviderSettingsPanel.environment.test.tsx.No server or contract changes. Works with a plain
codex login(ChatGPT) account; nothing here depends on CLIProxyAPI sources.Before / After
Before: Settings → Providers → Codex shows Display name / Runtime / Environment / Models only.
After: a "Usage limits" section between Setup and Runtime with the 5h / weekly bars, pace glyph, reset countdown, and (when banked) "N reset credits banked · next expires in … [Use a reset credit]" behind the existing confirm dialog.
(Screenshots to follow.)
Verification
pnpm --filter @t3tools/web typecheckvp test run --project unitoncomponents/settings+components/usage: 28/28Note
Low Risk
Web-only UI reuse of existing
consumeResetCreditflow; redeem is gated by the same read-only permissions as other provider settings.Overview
Settings → Providers now shows the same subscription quota windows and banked reset credits as Usage → Limits, so users can check Codex-style limits or redeem credits without leaving the provider editor.
ProviderUsageLimitsBlockis extracted from the Usage page layout (windows, notices, reset credits) and passed intoProviderInstanceCardas a new Usage limits section between Setup and Runtime. The panel only renders it in editor mode when the live provider reportsusageLimits, and skips drivers markedunavailable.reason === "unsupported". Use a reset credit respects the settings panel’sreadOnlyflag (disabled when the session can’t operate).The Usage → Limits page still uses the shared block inside
ProviderLimitswith the account heading unchanged. Two environment tests cover presence, read-only wiring, and omission when limits are missing or unsupported.Reviewed by Cursor Bugbot for commit 5c9dc16. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add usage limits and reset credits to provider settings cards
ProviderUsageLimitsBlockfromProviderLimitsin UsageLimits.tsx so limit windows, notices, and reset credits render as a standalone block without the account headingusageLimitsReactNode prop toProviderInstanceCardin ProviderInstanceCard.tsx, rendered as a "Usage limits" section between setup and runtimeEnvironmentProviderSettingsin ProviderSettingsPanel.tsx supplies the block only to editor-mode cards with a live provider whose limits are not marked unsupported; list-mode cards and unsupported providers get no contentResetCreditsgains an optionalreadOnlyprop that disables the redemption button alongside the existing busy stateProviderLimitswrapper in UsageLimits.tsx now checks for absent usage limits before rendering; any caller relying on the section always rendering even with no limits data will see it omitted📊 Macroscope summarized 5c9dc16. 3 files reviewed, 1 issue evaluated, 0 issues filtered, 1 comment posted
🗂️ Filtered Issues