Skip to content

feat(status-bar): show Cursor included, Auto, and On-demand usage - #8669

Open
preschian wants to merge 1 commit into
stablyai:mainfrom
preschian:preschian/show-cursor-usage
Open

preschian wants to merge 1 commit into
stablyai:mainfrom
preschian:preschian/show-cursor-usage

Conversation

@preschian

@preschian preschian commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Show Cursor plan usage in the Orca status bar (same place as Claude/Codex/Grok), using the signed-in Cursor IDE account — no separate Orca login.

  • Reads Cursor auth from the IDE state.vscdb and fetches GetCurrentPeriodUsage
  • Compact meters: Included, Auto, and On-demand
  • Appearance toggle + default-on migration for existing profiles
  • Mapping matches Cursor’s own meters: totalPercentUsed → Included, autoPercentUsed → Auto, spendLimitUsage → On-demand (not displayMessage / apiPercentUsed)

Screenshots

Screenshot 2026-07-14 at 12 03 56

Status bar + detail popover showing Included, Auto, and On-demand meters from the signed-in Cursor IDE account.

Testing

  • pnpm lint (oxlint on changed files + switch-exhaustiveness, reliability gates, max-lines ratchet, localization catalog/coverage; full pnpm lint OOM’d once in this environment, gates above passed)
  • pnpm typecheck
  • pnpm test (Cursor auth/fetcher, visibility, gating, ui hydrate, client-ui tests passed; full suite had unrelated flaky timeouts in daemon shell-ready / SSH transport)
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Added cursor-auth / cursor-fetcher unit tests covering platform DB path, signed-out/missing token, Included/displayMessage mismatch, On-demand from spendLimitUsage (not apiPercentUsed), plus visibility/gating/store coverage.

AI Review Report

Reviewed usage field mapping, status-bar wiring, and auth path handling against CONTRIBUTING.

  • Cross-platform: Cursor DB path uses path.join with darwin / win32 / Linux branches; Windows locked-DB temp-copy fallback; no new shortcuts or metaKey hardcoding.
  • SSH/remote/local: Auth + fetch run in the desktop main process against the local Cursor IDE session (same pattern as other local OAuth usage meters); SSH worktrees do not change where Electron main runs.
  • Agents/integrations: Cursor-only provider behind explicit 'cursor' checks; other providers unchanged.
  • Performance: Reuses existing rate-limit poll / refresh-cursor path; no hot-path work beyond the shared poller.
  • UI quality: Reuses existing status-bar provider segment + Appearance toggle patterns; short bucket labels for compact bar.
  • Risks checked / fixed: Wrong Included % from displayMessage (removed as fallback); Auto must not use autoModelSelectedDisplayMessage; On-demand must not use apiPercentUsed; max-lines on appearance search (extracted ports entry); locale parity synced for es/ja/ko/zh.

Security Audit

  • Access token is read only from the local Cursor IDE SQLite DB and sent as Authorization: Bearer to Cursor’s usage API; it is not logged in status-bar errors (filesystem paths redacted).
  • No new IPC surface beyond extending the existing rate-limits refresh/state channel with a cursor provider.
  • No command execution, dependency adds, or secret persistence in Orca’s own store — Orca never runs Cursor login; it only reads the IDE session Cursor updates.

Notes

  • Requires Cursor IDE signed in on the same machine.
  • Packaged /Applications/Orca.app needs a build that includes this branch; local pnpm start / preview was used for verification.
  • X: @0xPresc

Made with Cursor

ELI5

The status bar can show Cursor plan usage (Included, Auto, On-demand) from your signed-in Cursor account. No separate Orca Cursor login is required.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds Cursor authentication and usage parsing from Cursor’s SQLite state database, including fallback snapshot reads. Integrates Cursor rate limits into service refresh cycles, IPC, preload APIs, renderer state, and web stubs. Extends shared types and UI schemas, adds Cursor status-bar visibility, bucket rendering, tooltips, settings migration, CLI gating, localized labels, and test coverage.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.64% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly names the main change: adding Cursor usage meters to the status bar.
Description check ✅ Passed The description includes all required sections and covers summary, screenshots, testing, review, security, and notes.

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/rate-limits/service.ts (1)

1120-1186: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Duplicated per-provider fetch-queue-coordination pattern keeps growing.

fetchCursorOnly() and runFetchCursorOnlyCycle() are near-verbatim copies of fetchGrokOnly()/runFetchGrokOnlyCycle(), and the same "queued fetch coordination" block is now duplicated identically across fetchAll(), fetchCodexOnly(), fetchClaudeOnly(), fetchGrokOnly(), and fetchCursorOnly() (5 copies). The comment at lines 745-747 already documents that a missing per-provider entry ("antigravity was omitted once") silently broke recovery — this duplication is the mechanism behind that recurring risk, and this PR adds another ~250 lines to an already ~1978-line file that requires an eslint-disable max-lines to compile clean.

Consider extracting a generic runProviderOnlyFetch(provider, cycleRunner) dispatcher that iterates the other queued flags by provider key instead of hand-listing each sibling check, so adding a future provider only requires one map entry instead of touching 5+ near-identical blocks.

As per coding guidelines: "Never disable max-lines via ESLint or oxlint, including line-specific variants."

Also applies to: 1835-1871

Source: Coding guidelines

🧹 Nitpick comments (1)
src/renderer/src/components/settings/appearance-status-bar-cursor-toggle-search.ts (1)

14-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use 10-character hash keys for localization.

Please replace the descriptive keys (cursorUsageTitle, cursorUsageDescription, cursorUsageKeyword) with 10-character hex hashes (e.g., c8a2b1c4e7). Based on learnings, when localizing user-facing strings inside settings components, use hash-based locale keys.

♻️ Proposed refactor
-    title: translate('auto.components.settings.appearance.search.cursorUsageTitle', 'Cursor Usage'),
+    title: translate('auto.components.settings.appearance.search.c8a2b1c4e7', 'Cursor Usage'),
     description: translate(
-      'auto.components.settings.appearance.search.cursorUsageDescription',
+      'auto.components.settings.appearance.search.d9f3e2a1b4',
       'Show Cursor included usage from the signed-in Cursor IDE account.'
     ),
     keywords: [
       ...translateSearchKeyword(
         'auto.components.settings.appearance.search.896eb53fd4',
         'status bar'
       ),
       ...translateSearchKeyword(
-        'auto.components.settings.appearance.search.cursorUsageKeyword',
+        'auto.components.settings.appearance.search.e1d2c3b4a5',
         'cursor'
       ),

Source: Learnings


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e21fb9df-8466-47e7-813f-b0dd6366d28a

📥 Commits

Reviewing files that changed from the base of the PR and between 0ab2e00 and fb56bb660d93294707312e026d51bd72f3aceb47.

📒 Files selected for processing (37)
  • src/main/ipc/rate-limits.ts
  • src/main/rate-limits/cursor-auth.test.ts
  • src/main/rate-limits/cursor-auth.ts
  • src/main/rate-limits/cursor-fetcher.test.ts
  • src/main/rate-limits/cursor-fetcher.ts
  • src/main/rate-limits/service.test.ts
  • src/main/rate-limits/service.ts
  • src/main/runtime/rpc/methods/client-ui-schemas.ts
  • src/main/runtime/rpc/methods/client-ui.test.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/AppearanceWindowSidebarSection.tsx
  • src/renderer/src/components/settings/appearance-status-bar-cursor-toggle-search.ts
  • src/renderer/src/components/settings/appearance-status-bar-ports-toggle-search.ts
  • src/renderer/src/components/settings/appearance-status-bar-search.ts
  • src/renderer/src/components/stats/GrokUsagePane.test.tsx
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/status-bar-agent-gating.test.ts
  • src/renderer/src/components/status-bar/status-bar-agent-gating.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
  • src/renderer/src/components/status-bar/tooltip.test.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
  • src/renderer/src/components/status-bar/usage-error-copy.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/store/slices/rate-limits.ts
  • src/renderer/src/store/slices/ui.test.ts
  • src/renderer/src/store/slices/ui.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/rate-limit-types.test.ts
  • src/shared/rate-limit-types.ts
  • src/shared/status-bar-defaults.ts
  • src/shared/types.ts

Comment on lines +141 to +145
grok: null,
cursor: null
}
private grokAuthConfigured = readGrokAuthSession().status === 'ok'
private cursorAuthConfigured = readCursorAuthSession().status === 'ok'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect the Cursor auth session reader for synchronous/blocking I/O patterns.
fd -a cursor-auth.ts src/main/rate-limits
cat -n src/main/rate-limits/cursor-auth.ts 2>/dev/null | sed -n '1,200p'
rg -n 'Sync|sleep|retry|while|setTimeout' src/main/rate-limits/cursor-auth.ts

Repository: stablyai/orca

Length of output: 6781


Avoid the synchronous Cursor auth read on the main process. readCursorAuthSession() uses DatabaseSync plus sync file copies/removals, so the Windows fallback still blocks the event loop on construction and each refresh cycle. Moving this off the main thread would prevent IPC/rendering stalls.

Read the signed-in Cursor IDE session and surface period usage meters
alongside other provider rate limits in the status bar.

Co-authored-by: Cursor <[email protected]>
@nwparker

Copy link
Copy Markdown
Contributor

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 cursor-agent 2026.06+ actually stores the session. On an up-to-date macOS install there's no ~/.cursor/auth.json at all, so the auth.json PRs find nothing, and the state.vscdb PRs find nothing for CLI-only users. #22633 reads keychain → auth.json → Cursor IDE in order, so it works either way.

Could you try it on your account and tell me if the numbers are right? There's an installable build here:

https://github.com/stablyai/orca-adhoc/releases/tag/v1.4.211-adhoc.20260924221219

macOS is signed and notarized, so it installs through Orca's updater. Windows is unsigned — grab orca-windows-setup.exe and run it once (SmartScreen will warn), and every switch after that works in-app. To go back, switch channels in Settings → Updates.

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.

@nwparker

Copy link
Copy Markdown
Contributor

Update: new build, please use this one instead —

https://github.com/stablyai/orca-adhoc/releases/tag/v1.4.211-adhoc.20260924232116

The build I linked earlier has been deleted, because review found three bugs in it that would have hit you directly:

  • An expired CLI token hid a valid Cursor IDE session. If you ever ran cursor-agent login and now work mainly in the IDE, the old build told you "sign-in expired" forever while a perfectly good session sat unused. A live session now wins regardless of where it's stored.
  • A null field in the response threw away the whole reading, so some accounts would have shown no usage at all.
  • Cursor's pools rendered with no number — icon and an empty bar. That one only showed up on a healthy account, which is exactly what I couldn't test.

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 orca-windows-setup.exe once past SmartScreen, Settings → Updates to go back.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants