Repository navigation
Conversation
Adapt existing Cursor footer work to current upstream with account-safe refreshes, bounded requests, compact presentation and remote compatibility. Co-authored-by: ivo922 <[email protected]> Co-authored-by: Mihail Vratchanski <[email protected]>
📝 WalkthroughWalkthroughThis change adds Cursor CLI authentication and dashboard usage fetching. It integrates Cursor into rate-limit service state, refresh cycles, credential identity handling, retry behavior, and shared types. It adds Cursor status-bar visibility, rendering, settings search, localization, error messages, default-item migration, and paired-host capability filtering. Tests cover authentication, fetching, service orchestration, rendering, persistence, compatibility, and end-to-end behavior. Priority: ➖ Normal Merge Risk: 🔵 Low · up to A temporary paired-host status failure can prevent an acknowledged status-bar update from reaching the host. Local preferences remain saved, but the host update should fall back to the compatible payload. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 3.51% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 57 functions across 50 files. (12 skipped: 2 unsupported, 10 over the file limit.)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 76ddcb21-3767-4c80-9595-0d8616b355fe
📒 Files selected for processing (62)
docs/readme/cursor-usage.mdmobile/src/components/accounts-snapshot.tssrc/main/rate-limits/claude-oauth-usage-error.tssrc/main/rate-limits/cursor-auth.test.tssrc/main/rate-limits/cursor-auth.tssrc/main/rate-limits/cursor-credential-identity.tssrc/main/rate-limits/cursor-fetcher-failures.test.tssrc/main/rate-limits/cursor-fetcher.test.tssrc/main/rate-limits/cursor-fetcher.tssrc/main/rate-limits/rate-limit-retry-after.tssrc/main/rate-limits/rate-limit-service-test-harness.tssrc/main/rate-limits/service-account-target-selection.test.tssrc/main/rate-limits/service-antigravity-usage.test.tssrc/main/rate-limits/service-cursor-identity.test.tssrc/main/rate-limits/service-inactive-account-previews.test.tssrc/main/rate-limits/service-live-claude-usage.test.tssrc/main/rate-limits/service-minimax-usage.test.tssrc/main/rate-limits/service-refresh-orchestration.test.tssrc/main/rate-limits/service-window-activation.test.tssrc/main/rate-limits/service/service-configuration.tssrc/main/rate-limits/service/service-full-cycle-application.tssrc/main/rate-limits/service/service-full-cycle-preparation.tssrc/main/rate-limits/service/service-polling.tssrc/main/rate-limits/service/service-result-policy.tssrc/main/rate-limits/service/service-state.tssrc/main/rate-limits/service/service-types.tssrc/main/runtime/rpc/methods/client-ui.test.tssrc/renderer/src/components/settings/AppearanceWindowSidebarSection.tsxsrc/renderer/src/components/settings/appearance-status-bar-cursor-toggle-search.tssrc/renderer/src/components/settings/appearance-status-bar-ports-toggle-search.tssrc/renderer/src/components/settings/appearance-status-bar-search.test.tssrc/renderer/src/components/settings/appearance-status-bar-search.tssrc/renderer/src/components/status-bar/StatusBarProviderSegment.tsxsrc/renderer/src/components/status-bar/StatusBarVisibilityMenu.tsxsrc/renderer/src/components/status-bar/provider-segment-monthly-window.test.tsxsrc/renderer/src/components/status-bar/status-bar-agent-gating.test.tssrc/renderer/src/components/status-bar/status-bar-agent-gating.tssrc/renderer/src/components/status-bar/status-bar-provider-visibility.test.tssrc/renderer/src/components/status-bar/status-bar-provider-visibility.tssrc/renderer/src/components/status-bar/tooltip.test.tssrc/renderer/src/components/status-bar/tooltip.tsxsrc/renderer/src/components/status-bar/usage-error-copy.test.tssrc/renderer/src/components/status-bar/usage-error-copy.tssrc/renderer/src/components/status-bar/usage-provider-settings-target.test.tssrc/renderer/src/components/status-bar/usage-provider-settings-target.tssrc/renderer/src/components/status-bar/use-status-bar-controller.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/store/slices/ui-hydration-workspace-preferences.test.tssrc/renderer/src/store/slices/ui/ui-slice-hydration-actions.tssrc/renderer/src/web/preload-api/web-status-bar-host-updates.tssrc/renderer/src/web/preload-api/web-ui-api.test.tssrc/renderer/src/web/preload-api/web-ui-api.tssrc/shared/cursor-usage-buckets.tssrc/shared/persisted-ui-state-types.tssrc/shared/protocol-version.tssrc/shared/rate-limit-state-factory.tssrc/shared/rate-limit-types.test.tssrc/shared/rate-limit-types.tssrc/shared/rpc-contract/client-ui-params.tssrc/shared/status-bar-defaults.tssrc/shared/ui-chrome-types.tstests/e2e/status-bar-cursor-usage.spec.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| if (!hostUpdates.statusBarItems?.includes('cursor')) { | ||
| return hostUpdates | ||
| } | ||
| const status = await getRemoteRuntimeStatus() |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Handle failed remote status queries as unsupported.
If getRemoteRuntimeStatus() rejects, prepareHostUiUpdates rejects before it removes cursor. setWithAck propagates that rejection, so it does not send ui.set. However, setWithAck writes the merged local UI state first, so local persistence has already occurred.
Treat a failed capability query as unsupported and remove cursor before returning the host update. This allows setWithAck to send the compatible update.
There was a problem hiding this comment.
Important
The Cursor credential-identity check conflates an unreadable/corrupt auth.json (status: 'error') with a signed-out state, so a transient file read/parse failure is treated as an account change: it clears the meter (and its 429 cooldown) and discards a freshly fetched valid snapshot. See the inline comment.
Reviewed changes
Reviewed the full 62-file diff at 8ba8640dd0 against main (fe4237cd41) — a new Cursor subscription-usage meter in the status bar.
- Auth + fetch: new
cursor-auth.ts(asyncauth.jsonread, per-platform paths, sanitized errors) andcursor-fetcher.ts(timeout/abort,redirect: 'error', 401/403/429 handling, percent clamping, billing-cycle reset mapping). - Service integration: a
cursorslot andcursorAuthConfiguredflag threaded through the rate-limit service, with per-cycle credential-key change detection, late-response discard, and a 429 cooldown that skips the fetch. - Renderer: status-bar visibility/gating (detection-gated on
cursor-agent), segment/bucket presentation, tooltip icon and error copy, settings search entry, and default-on hydration. - Shared/wire:
cursoradded to theStatusBarItem/provider enums plus optional snapshot fields, and astatus-bar.cursor-item.v1capability the web preload uses to stripcursorbefore writing to hosts that don't advertise it. - Tests/docs: fetcher/auth/identity/web-compat/segment tests, an e2e footer spec, and
docs/readme/cursor-usage.md.
Technical details
# Auth-read errors are treated as account changes
## Affected sites
- `src/main/rate-limits/cursor-credential-identity.ts:5` — `cursorCredentialKey` returns `null` for both `missing` and `error`, so callers cannot tell "logged out / different account" from "file momentarily unreadable".
- `src/main/rate-limits/service/service-full-cycle-preparation.ts:152-155` — clears `state.cursor` (and its `usageMetadata.retryAtMs`) whenever the key differs; an `error` read yields `null`.
- `src/main/rate-limits/service/service-full-cycle-application.ts:230-234` — `latestKey !== cursorResult.value.credentialKey` is also true when the second read errors, so the just-fetched valid result is thrown away.
## Required outcome
- Only treat a real credential change as: a different valid token hash, or a genuine `missing` (signed out). A read/parse `error` must leave `this.cursorCredentialKey` and `state.cursor` untouched and must not discard the in-flight result.
- `cursorAuthConfigured` should not flip to `false` on a transient error if the previous read was `ok`.
- Add a regression test where `readCursorAuthSession` resolves `{ status: 'error' }`; the current suite only covers `missing` and network failures, so this path is untested.
## Open questions for the human
- Should an auth-file parse error keep the last-good snapshot with an error chip (the `grok` behaviour) rather than blanking the meter?ℹ️ Nitpicks
src/main/rate-limits/service-cursor-identity.test.ts:99usesexpect(service.getState().cursor?.session ?? null).toBeNull(), which also passes forcursor === null,undefined, or afetchingplaceholder.expect(service.getState().cursor).toBeNull()would actually pin the "cleared" claim in the test name.- The Linux/macOS auth path matches Vercel's official
@ai-sdk/harness-cursorresolver, but those platforms are unit-tested only, not live-verified. A cheap fallback to~/.cursor/auth.json(the CLI home Orca already assumes elsewhere) would cover installs whose CLI resolves auth differently.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| if (cursorResult.status === 'fulfilled' && latestKey !== cursorResult.value.credentialKey) { | ||
| // An account changed while the request was in flight; its response no longer owns the meter. | ||
| this.updateState({ ...this.state, cursor: null }) | ||
| return | ||
| } |
There was a problem hiding this comment.
The identity check treats an auth-file read/parse error (status: 'error') exactly like a signed-out state: cursorCredentialKey returns null for both, so a transient failure (e.g. cursor-agent rewriting auth.json mid-login, or an EACCES) registers as an account change. This branch then discards the freshly fetched valid snapshot, and the prepare-side clear at service-full-cycle-preparation.ts:152-155 also drops the 429 retryAtMs cooldown. grok keeps its last-good snapshot through the same auth-read error, so this is a behavioral regression rather than an intentional policy.
Technical details
# Auth-read errors are treated as account changes
## Affected sites
- `src/main/rate-limits/cursor-credential-identity.ts:5` — returns `null` for both `missing` and `error`.
- `src/main/rate-limits/service/service-full-cycle-preparation.ts:152-155` — clears `state.cursor` + cooldown on any key mismatch.
- `src/main/rate-limits/service/service-full-cycle-application.ts:230-234` — mismatches when the second read errors, discarding the result.
## Required outcome
- An `error` read must leave `this.cursorCredentialKey` and `state.cursor` untouched and must not discard the in-flight result; only a different valid hash or a genuine `missing` should count as a change.
- `cursorAuthConfigured` should not flip to `false` on a transient error if the previous read was `ok`.
- Add a regression test with `readCursorAuthSession` resolving `{ status: 'error' }`.Reuse the usage service and footer for Cursor monthly allowances. Adapt paired-host preference compatibility from stablyai#20469. Co-authored-by: Tauri-EPO <[email protected]> Co-authored-by: Mihail Vratchanski <[email protected]> Co-authored-by: Codex <[email protected]> (cherry picked from commit 72d5f98)
|
I have a local Cursor usage prototype and would like to contribute its independent hardening parts here rather than open a competing PR: fork implementation. The review points worth retaining are credential-fingerprint isolation (an account change must not reuse another account's quota), Protocol/source attribution to steipete/CodexBar (MIT), #20469 and #18119 must be retained when extracting code. I have not revalidated live account/API behavior or rendered UI in this contribution round. This is a source-level contribution note, prepared with Codex. |
|
Heads up — I've opened #22633, which brings Cursor usage tracking together from this PR and the other open attempts (#8669, #11780, #13837, #16815, #18119, #20469, #21833). You're credited as a co-author on the commit; your work is in there. The one thing I changed structurally: none of the open PRs read the macOS Keychain, and that's where Could you try it on your account and tell me if the numbers are right? There's an installable build here: macOS is signed and notarized, so it installs through Orca's updater. Windows is unsigned — grab What I'd love checked, since I couldn't: the live numbers on a working paid plan. The only Cursor account on this machine has an expired token, so I verified the credential discovery and every error path end-to-end, but never saw real percentages render. If the pools (Cursor Models / Other Models / On-demand) and the plan total match what cursor.com/dashboard shows you, that's the confirmation I'm missing. If they don't, tell me what you see versus the dashboard and I'll fix it. Also useful if you're on a plan shape I couldn't test: unlimited/Ultra, on-demand enabled, teams, or the older request-quota billing. |
|
Update: new build, please use this one instead — The build I linked earlier has been deleted, because review found three bugs in it that would have hit you directly:
Same ask as before, and the same one thing I still can't verify myself: do the numbers match your cursor.com dashboard? Install instructions are unchanged — macOS through Orca's updater, Windows via |
|
Hi @nwparker! Tested on Windows with an active Cursor Pro account — everything renders cleanly and the live numbers match my cursor.com dashboard perfectly:
Here are the live screenshots on Windows (both Compact and Detailed modes): Compact ModeDetailed ModeBy the way, seeing how cleanly you consolidated If you or the team are interested in bringing Antigravity usage into the footer status bar next, I'd be more than happy to open a PR or collaborate on upstreaming it! |
|
This is exactly the test I couldn't run — thank you. A live Pro account on Windows covers three things I only had unit tests for: the Attribution — agreed, and it's now in the PR description. The Your four hardening points — I checked each against the branch rather than assuming:
So I think the hardening you flagged is already covered. If your fork has something beyond those four, point me at the specific hunk and I'll pull it in with attribution. Antigravity — out of scope here, yes. This PR is one provider and is at the point of merging; folding in a second provider with a different transport (local Connect-RPC to the language server) would mean re-reviewing the whole thing. It sounds genuinely useful though, and the provider seam this adds should make it a much smaller change to land on its own — |



ELI5
Cursor users can see their monthly subscription usage in Orca's existing footer and Usage popover. Detailed mode labels Cursor Models and Other models separately; Compact shows the most consumed reported pool. It follows the existing used/remaining preference and visibility controls.
What Changed
Why
No Cursor footer implementation is merged in the inspected upstream main (fe4237c). This builds on the closest existing work, #16815, with additional regression fixes and current-main schema integration. Remote compatibility adapts #18119. Credit is retained in the commit trailers.
The new regression tests failed against the reused implementation for credential leakage in errors, missing 429 handling, redirects, pool-only responses, cross-account stale data, late logout responses, and Compact presentation, then passed with the corrections.
Linked Issue
Related to #15516 (footer portion only) and #20067. This does not close the broader Accounts-pane/WSL request. Other inspected proposals: #8669, #13837, #16815, #18119; #11780 was closed without merging.
Visual Proof
Playwright captured these directly from a hidden Electron renderer on Windows. The same isolated test profile is used throughout. Percentages are synthetic fixtures, not personal account data. Before shows the unconfigured/absent meter; after seeds the configured Cursor snapshot. No screenshot files are committed.
Testing
pnpm buildpassed, including all typecheck projects, relay/CLI/desktop/web output and platform-native build.pnpm run check:code-quality:changed -- --base HEADpassed: zero new findings across all five checks.ORCA_BACKGROUND_LAUNCH=1.AI Disclosure
Implemented and reviewed with OpenAI Codex (GPT-6).
Review
Agent skill upstream boundary
Notes
The personal-account dashboard endpoint is undocumented and may change. Authentication currently requires the CLI's auth.json on the serving runtime. See docs/readme/cursor-usage.md for scope and failure behavior. Native OS credential stores, IDE SQLite credentials, account management, and workspace-specific WSL/SSH accounts remain outside this footer change.
Author
X/Twitter handle: not provided.
Checklist