feat: display provider usage limits in settings - #1732
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
For now, I’ve added two images to illustrate the UI: 1. Free tier viewThis screenshot reflects my current setup. I don’t have subscriptions to Codex or Claude Code, I’m using Copilot Pro (available to me as a student). It shows how the weekly usage limit appears in the interface. 2. Pro tier (mocked example)This second screenshot uses dummy data to demonstrate how the UI could look for users on a Pro plan (Codex or Claude Code). It includes both session-based limits and weekly limits for clarity. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80515efa38
ℹ️ 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".
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR introduces a broad provider-usage capability with new cross-platform probes, live telemetry ingestion, contract changes, and shared PTY lifecycle behavior on existing provider paths. An unresolved concrete issue can also leave empty provider tiles when usage windows are discarded. You can add or adjust custom eligibility rules. Learn more. |
|
Hey @juliusmarminge, could you take a look at this PR when you get a moment? Thanks! |
|
A few concerns after checking the code:
I can test further and commit to this PR if you're okay with it, @Aditya190803. Genuinely want to see this merged - it would be super useful |
|
this is on my list to review still! Just dealing with some larger prep work so haven't had time yet. As for the "it must be more visible and sjhould be 1:1 like codex app": How often do you guys check your limits to warrant it being one click ??? I check it at most a few times a week, so hiding it in settings next to the provider status is fine! |
|
Yes when the single settings page gets too large we'll split it to subpages. We already did the work adding the sidebar when adding the archive |
juliusmarminge
left a comment
There was a problem hiding this comment.
implementation seems way overcomplicated.
why cache the data? the provider check runs once per minute. we can get fresh data on every tick?
how i imaagined this working:
- extend the
checkProviderprobe in ServerProvider to include a newusageLimitsproperty. - on the auth check probes (app server / claude), extract usage data
- stream it down to client as part of the normal provider snapshot
- render the UI on settings page
given i haven't looked into exactly what's possible to probe and not, why is this PR so much more than that?
f9aabcd to
171df70
Compare
036a9b9 to
ed12bb8
Compare
|
Wth I have implemented for all 4 providers Well done @t3dotgg |
|
That's actually so sad I was following this for quite a while omg |
I even modified It to work properly with the new usage page |
|
Hey I'm OOO but raised this to the team. I've been in support of your implementation over Theo's. I think his agent might have been a bit of a yes-man and just favored their own implementation blindly. |
Your implementation is great. I've been using it for ages it seems. Although the idea to display the limits on hover seems useful, so you don't have to click anything. It would be great if you add it too. |
|
My bad |
…provider-usage-limits # Conflicts: # apps/server/src/provider/Layers/ProviderRegistry.test.ts
|
I'll get this over the finish line when i get back 🫡 |
There was a problem hiding this comment.
Reviewed the web UI added by this PR (apps/web/src/components/usage/**, timestampFormat.ts, UsagePage.tsx). The bar geometry, role="progressbar" semantics and motion-reduce transition now match ContextWindowMeter, and the reset formatters both go through the host-locale formatters in timestampFormat.ts. Two findings inline: a provider tile that can render with a heading and no body, and a copy-pasted badge-geometry override that is now on its third call site.
Posted via Macroscope — UI Consistency
There was a problem hiding this comment.
Reviewed the web UI added by this PR (apps/web/src/components/usage/**, timestampFormat.ts, UsagePage.tsx). The bar geometry, role="progressbar" semantics and motion-reduce transition now match ContextWindowMeter, and the reset formatters both go through the host-locale formatters in timestampFormat.ts. Two findings inline: a provider tile that can render with a heading and no body, and a copy-pasted badge-geometry override that is now on its third call site.
Posted via Macroscope — UI Consistency
…provider-usage-limits # Conflicts: # apps/server/src/provider/Layers/GrokProvider.ts # apps/web/src/components/usage/UsagePage.tsx # docs/user/usage.md
There was a problem hiding this comment.
Reviewed the changed Effect service code (usage probes, provider layers, ingestion layer, drivers). The earlier findings about threading PtyAdapter["Service"] through value parameters are resolved — the probes now acquire the tag from the environment via Effect.serviceOption. One issue remains in GrokDriver.ts.
Posted via Macroscope — Effect Service Conventions
Keep probes from hanging the rest of status checks, preserve last-good quota bars, and stop empty usage tiles from rendering without an explanation. Co-authored-by: Cursor <cursoragent@cursor.com>
Replay last-exit on a microtask so Terminal Manager can assign session.process first. On Windows, kill the PTY tree with taskkill so cmd.exe-launched CLI children do not leak. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
| if (isGrokFreeTier(provider)) { | ||
| return GROK_FREE_TIER_USAGE_MESSAGE; | ||
| } | ||
| if (!provider.usageLimits) return "Usage data unavailable"; |
There was a problem hiding this comment.
Dropped usage windows leave empty tiles
Low Severity
Forward-compatible decoding now drops invalid or unknown usage windows instead of failing the provider, which can leave usageLimits.available true with an empty windows array. providerQuotaNotice only fills the tile body when usageLimits is missing, so those snapshots render a title with no bars and no message on web and mobile.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit fdc78fb. Configure here.
| return { | ||
| models, | ||
| ...(auth ? { auth } : {}), | ||
| } satisfies GrokAcpDiscoveryResult; |
There was a problem hiding this comment.
Grok auth probe can discard models
Medium Severity
The Grok auth subscription probe still runs inside the outer ACP discovery timeout, so a slow acp.start() can leave too little budget for auth/check_subscription. When that outer timer fires, the already-built model catalog is thrown away and the provider is reported as a startup timeout instead of ready with unknown auth.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 574252c. Configure here.
| Effect.catchCause((cause) => | ||
| Cause.hasInterrupts(cause) ? Effect.failCause(cause) : Effect.succeed(Option.none()), | ||
| ), | ||
| ); |
There was a problem hiding this comment.
Codex rate-limit interrupt drops snapshot
Medium Severity
The Codex rate-limit read rethrows interrupts, so an outer probe timeout that fires during account/rateLimits/read can still fail the whole app-server snapshot. Account, models, and skills that were already fetched are then discarded as a provider timeout instead of publishing with usage degraded.
Reviewed by Cursor Bugbot for commit 574252c. Configure here.
|
Follow-up stacked on this PR: remaining session/weekly usage in the chat box, current provider only. Stacked PR: #8445
Settings Chat hover |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
There are 31 total unresolved issues (including 30 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e6ed20c. Configure here.
| ? window.windowDurationMins | ||
| : reported.length > 1 && index === 0 | ||
| ? CODEX_SESSION_WINDOW_DURATION_MINS | ||
| : CODEX_WEEKLY_WINDOW_DURATION_MINS; |
There was a problem hiding this comment.
Codex partials mislabeled as weekly
Medium Severity
Live Codex account.rate-limits.updated payloads reuse the full-snapshot resolver, which treats a lone duration-less primary window as weekly. Codex notifications are documented as partial, and mergeUsageLimitWindows upserts by kind, so a session-only patch can overwrite the weekly bar and leave the session bar stale during a turn.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit e6ed20c. Configure here.









Fixes #228.
What Changed
Added provider usage limits to the settings flow end to end for all 4 providers (Codex, Claude, Cursor, OpenCode):
Note: For OpenCode, only the official OpenCode-managed providers (OpenCode Go, OpenCode Zen) are shown.
Why
Users need a visible place to confirm provider usage limits without digging through logs or backend state. This keeps the value available across sessions and makes the current limits easy to inspect from the UI.
UI Changes
The Settings panel now shows provider usage limits in the provider section.
Checklist
Note
Medium Risk
Spawns PTY processes and parses CLI output during provider health checks, which can affect probe latency and reliability; live usage merge logic changes snapshot refresh behavior for quota fields.
Overview
Adds end-to-end provider usage limits: server status probes populate
usageLimitson provider snapshots, live session events can refresh them without a full re-probe, and the mobile Usage screen shows a Provider limits section with progress bars and reset dates.Server probing attaches quota data per driver: Claude/Cursor/Grok via optional PTY CLI scraping (
claude --print /usage, Cursor/Grok/usageTUI flows), Codex via a boundedaccount/rateLimits/readapp-server call (with API-key/Bedrock marked unavailable), OpenCode Go/Zen from managed inventory usage fields, and Grok auth/subscription via ACP before TUI usage on paid tiers. Drivers threadPtyAdapterfrom the registry context when present; missing PTY degrades to explicit “unavailable in this runtime” reasons.Snapshot lifecycle extends managed providers with
applyUsageLimits, merges liveaccount.rate-limits.updatedingestion, and preserves in-flight live patches when enrichment or refresh completes so quota bars do not snap back to stale probe values.Mobile groups limits by environment when multiple servers are connected, hides OpenCode from this section, and surfaces notices (e.g. Grok free tier, missing data).
Also ignores
.claude-work-test/in gitignore so Claude usage probe tests do not commit session files.Reviewed by Cursor Bugbot for commit e6ed20c. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add provider usage limits display to settings and usage pages
ServerProviderUsageLimitsandServerProviderUsageWindowschemas in server.ts, constraining window kinds tosessionandweekly, percent to [0, 100], and dropping invalid windows during decode viaForwardCompatibleArrayProviderUsageLimitsIngestionLivein ProviderUsageLimitsIngestion.ts which subscribes toaccount.rate-limits.updatedevents and folds live usage patches into provider snapshots viaapplyUsageLimitsonmakeManagedServerProvidertaskkill /T /Fand replay exit events to listeners registered after process exitmakeManagedServerProviderenrichment publish path now early-returns ifenrichmentGenerationchanged and preserves currentsnapshot.usageLimitswhen enrichment yields a different reference — stale enrichment no longer reverts live patches; callers relying on enrichment to overwrite live usage updates will see different behaviorMacroscope summarized e6ed20c.