Repository navigation
Conversation
📝 WalkthroughWalkthroughAdds 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)
✅ Passed checks (4 passed)
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
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 liftDuplicated per-provider fetch-queue-coordination pattern keeps growing.
fetchCursorOnly()andrunFetchCursorOnlyCycle()are near-verbatim copies offetchGrokOnly()/runFetchGrokOnlyCycle(), and the same "queued fetch coordination" block is now duplicated identically acrossfetchAll(),fetchCodexOnly(),fetchClaudeOnly(),fetchGrokOnly(), andfetchCursorOnly()(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 aneslint-disable max-linesto 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-linesvia 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 valueUse 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.tssrc/main/rate-limits/cursor-auth.test.tssrc/main/rate-limits/cursor-auth.tssrc/main/rate-limits/cursor-fetcher.test.tssrc/main/rate-limits/cursor-fetcher.tssrc/main/rate-limits/service.test.tssrc/main/rate-limits/service.tssrc/main/runtime/rpc/methods/client-ui-schemas.tssrc/main/runtime/rpc/methods/client-ui.test.tssrc/preload/api-types.tssrc/preload/index.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.tssrc/renderer/src/components/stats/GrokUsagePane.test.tsxsrc/renderer/src/components/status-bar/StatusBar.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.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/store/slices/rate-limits.tssrc/renderer/src/store/slices/ui.test.tssrc/renderer/src/store/slices/ui.tssrc/renderer/src/web/web-preload-api.tssrc/shared/rate-limit-types.test.tssrc/shared/rate-limit-types.tssrc/shared/status-bar-defaults.tssrc/shared/types.ts
| grok: null, | ||
| cursor: null | ||
| } | ||
| private grokAuthConfigured = readGrokAuthSession().status === 'ok' | ||
| private cursorAuthConfigured = readCursorAuthSession().status === 'ok' |
There was a problem hiding this comment.
🚀 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.tsRepository: 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]>
fb56bb6 to
b06c513
Compare
|
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 |
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.
state.vscdband fetchesGetCurrentPeriodUsagetotalPercentUsed→ Included,autoPercentUsed→ Auto,spendLimitUsage→ On-demand (notdisplayMessage/apiPercentUsed)Screenshots
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; fullpnpm lintOOM’d once in this environment, gates above passed)pnpm typecheckpnpm 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 buildAdded
cursor-auth/cursor-fetcherunit tests covering platform DB path, signed-out/missing token, Included/displayMessagemismatch, On-demand fromspendLimitUsage(notapiPercentUsed), plus visibility/gating/store coverage.AI Review Report
Reviewed usage field mapping, status-bar wiring, and auth path handling against CONTRIBUTING.
path.joinwith darwin / win32 / Linux branches; Windows locked-DB temp-copy fallback; no new shortcuts ormetaKeyhardcoding.'cursor'checks; other providers unchanged.displayMessage(removed as fallback); Auto must not useautoModelSelectedDisplayMessage; On-demand must not useapiPercentUsed; max-lines on appearance search (extracted ports entry); locale parity synced for es/ja/ko/zh.Security Audit
Authorization: Bearerto Cursor’s usage API; it is not logged in status-bar errors (filesystem paths redacted).cursorprovider.Notes
/Applications/Orca.appneeds a build that includes this branch; localpnpm start/ preview was used for verification.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.