feat(sidebar): show provider quota usage in the sidebar footer
Claude and Codex both report plan limits on every turn, but nothing surfaced them until you opened provider settings. This adds a quota meter to the sidebar footer.
What's here
Server — providerRateLimits.ts parses each driver's limit payload into one shared shape ({ planType, updatedAt, windows[] }), and the provider snapshot carries it to the client. Covered by providerRateLimits.test.ts (11 tests).
Sidebar — the footer shows only the two windows that answer "what stops me now" and "what stops me this week", so its height stays predictable. Overage earns a row only once it's actually live. Bars stay quiet until they matter: primary under 75%, warning at 75%, destructive at 90%.
Tooltip — the detail surface. Every window the provider reported, each with its own relative reset ("resets in 2h" beats a wall-clock time for the question the meter raises), the plan badge, and how stale the numbers are. The hovered window keeps a full-strength bar; the rest dim. Clicking any row opens provider settings.
Claude MAX 20X
─────────────────────────────────────
5h resets in 2h
▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░ 62%
Weekly resets in 4d
▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░ 18%
─────────────────────────────────────
Updated 3m ago Open settings ↗
Edge cases
rateLimitspresent but empty means the account has no plan limits (API key, Bedrock, Vertex) — no rows at all, rather than a permanently pending meter.- Authenticated but nothing reported yet shows dashed placeholder rows; the tooltip explains limits arrive when a turn ends.
aria-labelcarries the whole card as one sentence, so screen readers lose nothing to the visual layout.
Testing
providerRateLimits.test.ts passes (11/11); @t3tools/web typechecks. The sidebar itself hasn't been exercised against a live authenticated provider yet.
🤖 Generated with Claude Code
[!NOTE] Medium Risk Touches provider snapshot push path and live Claude adapter event wiring; failures are mostly best-effort (Codex probe, experimental Claude usage API) but incorrect normalization could mislead users about quota.
Overview Adds account rate limits to the provider snapshot (
ServerProvider.rateLimitsin contracts) and a sidebar usage meter so Claude and Codex plan quota is visible without opening settings.Server — New
providerRateLimits.tsnormalizes driver-native payloads into shared{ planType, updatedAt, windows[] }, merges Claude windows by label (single-windowrate_limit_eventvs full/usageread), andstreamRateLimitUpdatesrepublishes snapshots as limits change. Codex readsaccount/rateLimits/readduring status probes and attaches limits on the probe result. Claude adds a PubSubrateLimitEventsside channel (so snapshot enrichment does not compete withProviderServiceon the turn event queue), publishes fromrate_limit_eventand experimental turn-end usage read, and keeps accumulated windows in aRefacross snapshot refreshes.Web —
SidebarUsageMeterin the footer shows 5h / Weekly (and live Overage) with color thresholds, tooltips for all windows, staleness, and navigation to provider settings; emptyrateLimits.windowsmeans no plan limits apply (no placeholder rows).Reviewed by Cursor Bugbot for commit e67d3e22a6a132d70a45dd4705f0da29c840f3d3. Bugbot is set up for automated code reviews on this repo. Configure here.
[!NOTE]
Show provider quota usage meters in the sidebar footer
- Adds
ServerProviderRateLimitsto the contracts schema and threads it through provider snapshots, covering both Claude (via a streamingrateLimitEventsside channel) and Codex (viaaccount/rateLimits/readat probe time).- Introduces
providerRateLimits.tswith normalization and merging utilities for provider-native rate-limit payloads, including window labeling, overage logic, and staleness stamping.- Renders a new
SidebarUsageMetercomponent in the sidebar footer showing per-provider usage rows (5h, Weekly, Overage) with tooltips and reset timing, clicking through to provider settings.- The Claude adapter publishes rate-limit events to a PubSub side channel so consumers can subscribe without interfering with the main runtime event queue.
📊 Macroscope summarized e67d3e2. 10 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
2b6cafed-5ee1-4920-9702-290d40d187a7You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
✨ 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.
Comment @coderabbitai help to get the list of available commands.
Approvability
Verdict: Needs human review
5 blocking correctness issues found. This PR introduces a new feature (quota usage meters in the sidebar) with ~989 additions across server and client. Multiple unresolved review comments identify potential bugs including race conditions, stale state after logout, and debug logging left in production code.
You can customize Macroscope's approvability policy. Learn more.
Closing in favor of #2829 (orchestration V2).
#2829 deletes the V1 orchestration layer this PR builds on — apps/server/src/orchestration/**, provider/Layers/*Adapter.ts and provider/Services/** are removed and replaced by apps/server/src/orchestration-v2/**, with the IPC surface renamed to ORCHESTRATION_V2_WS_METHODS. The files this PR touches either no longer exist or are rewritten, so it can't be rebased — it would need reimplementing against the V2 adapters.
This is not a judgement on the change itself. Several of these are real gaps we still want fixed; the base just moved out from under them.
Once #2829 merges, please rebase onto main, port the change to the V2 equivalent, and reopen (or open a fresh PR). Ping me and I'll prioritise the review.
Ok will do that