Skip to content

feat(rate-limits): add Cursor usage tracking - #13837

Closed
dominikzabcik wants to merge 3 commits into
stablyai:mainfrom
dominikzabcik:feat/cursor-usage-tracking
Closed

dominikzabcik wants to merge 3 commits into
stablyai:mainfrom
dominikzabcik:feat/cursor-usage-tracking

Conversation

@dominikzabcik

Copy link
Copy Markdown
Contributor

Summary

Shows Cursor plan usage in the status bar, usage roster, Stats, and Accounts when the machine running Orca is signed into Cursor IDE.

Auth matches CodexBar: read cursorAuth/accessToken (and optional cachedEmail) from Cursor’s state.vscdb, call cursor.com/api/usage-summary + /api/auth/me, map:

  • Monthly → plan totalPercentUsed
  • Auto / API → named buckets (autoPercentUsed / apiPercentUsed)

Toggle lives under Appearance → status bar, same pattern as Grok.

Screenshots

  • Status bar chip: Auto · API (verbose) / plan % (compact)
  • Usage detail: Auto, API, Monthly
  • Stats → Cursor usage
  • Settings → Accounts → Cursor

Please attach screenshots from a signed-in Cursor IDE session before marking ready for review.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Covered: auth/JWT parsing, fetcher mapping (monthly + Auto/API), service refresh, session DB paths (macOS/Linux/Windows), status-bar verbose buckets, tooltip sections, Stats pane, Accounts section, stale-token copy, localization catalog keys, exhaustive failureKind switches.

Focused suite used during development:

pnpm test \
  src/main/rate-limits/cursor-auth.test.ts \
  src/main/rate-limits/cursor-fetcher.test.ts \
  src/main/cursor-accounts/status.test.ts \
  src/main/rate-limits/service.test.ts \
  src/shared/cursor-session-paths.test.ts \
  src/renderer/src/components/stats/CursorUsagePane.test.tsx \
  src/renderer/src/components/settings/CursorAccountsSection.test.tsx \
  src/renderer/src/components/status-bar/tooltip.test.ts \
  src/renderer/src/components/status-bar/provider-segment-monthly-window.test.tsx \
  src/renderer/src/components/status-bar/usage-error-copy.test.ts

Manual: signed-in Cursor IDE on macOS → status bar + detail + Stats + Accounts refresh.

Note

Full pnpm typecheck / pnpm test / pnpm build should be confirmed green before marking ready; lint + localization catalog verify already passed after follow-up fixes.

AI Review Report

Reviewed against Grok/Gemini usage providers and Orca contribution rules (cross-platform paths, provider-neutral status bar, no .d.ts types, STYLEGUIDE/shadcn for UI).

Checked:

  • macOS / Linux / Windows state.vscdb path resolution (path.join, APPDATA, XDG_CONFIG_HOME)
  • Verbose chip allowlist so Auto/API are not filtered out as Gemini-only bucket names
  • Fetch queue drain for fetchCursorOnly alongside existing provider cycles
  • Stale-token copy points at Cursor IDE sign-in (not generic “agent sessions”)
  • UI reuses existing status-bar / Stats / Accounts patterns
  • Type-aware oxlint exhaustiveness on Cursor failureKind switches
  • Localization catalog keys synced into en.json

Fixed during review: dropped fake Weekly lane; restored Auto/API buckets; verbose-bar allowlist + monthly fallback; Accounts/Stats locale keys; exhaustive switches; catalog sync.

SSH / remote: usage is read from Cursor’s local IDE session on the host running Orca (same class as Grok CLI auth). It does not read Cursor state from an SSH remote.

Security Audit

  • Reads only Cursor globalStorage keys (accessToken, cachedEmail) from the local SQLite DB; no write path
  • Session cookie is built in-process for cursor.com API calls; token is not logged
  • IPC: status + refresh only; no arbitrary path/command execution
  • No new deps
  • Follow-up: none required for v1

Notes

  • v1 out of scope: browser cookie import, multi-account switcher, on-demand spend as primary meter, historical usage events, attributing Cursor agent runs
  • Docs: docs/reference/cursor-usage-tracking.md
  • X: (add your handle)

Made with Cursor

@dominikzabcik
dominikzabcik marked this pull request as ready for review August 11, 2026 15:59
@dominikzabcik
dominikzabcik force-pushed the feat/cursor-usage-tracking branch from 47bda5e to b649eba Compare August 11, 2026 16:01
@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Added Cursor authentication from platform-specific session databases, authenticated rate-limit fetching, and service refresh orchestration. Exposed account and refresh APIs through IPC and preload layers. Added Cursor account settings, usage analytics, status-bar usage, search metadata, localization, web fallbacks, persisted status-bar migration, tests, and reference documentation.

Merge Risk: 🟡 Moderate · up to a3dfb

The PR adds Cursor usage tracking across authentication, API fetching, status bar, Stats, and Accounts. Merge readiness is currently moderate because full typecheck, test, and build checks are still unchecked, while locale catalog entries and database-read error handling need correction or explicit acceptance to avoid misleading setup guidance and incomplete validation.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the feature and testing, but it omits the required linked issue and complete visual proof, and several template sections remain incomplete. Add the required ELI5, What Changed, Why, Linked Issue, Visual Proof, AI Disclosure, Review, and Checklist sections, including attached UI evidence and test status.
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 60 functions across 51 files. (6 skipped: 3 unsupported, 3 over the file limit.) Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the primary change: adding Cursor usage tracking to rate limits.
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.

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: 8


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 364a119d-1d99-4b36-9759-d001e05c38f8

📥 Commits

Reviewing files that changed from the base of the PR and between a0a654c and b649eba98de21baf37f017283b274883937e796b.

📒 Files selected for processing (47)
  • .gitignore
  • docs/reference/cursor-usage-tracking.md
  • src/main/cursor-accounts/status.test.ts
  • src/main/cursor-accounts/status.ts
  • src/main/ipc/cursor-accounts.ts
  • src/main/ipc/rate-limits.ts
  • src/main/ipc/register-core-handlers.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/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/renderer/src/components/settings/AppearanceWindowSidebarSection.tsx
  • src/renderer/src/components/settings/CursorAccountsSection.test.tsx
  • src/renderer/src/components/settings/CursorAccountsSection.tsx
  • src/renderer/src/components/settings/accounts-search.ts
  • src/renderer/src/components/settings/appearance-status-bar-cursor-toggle-search.ts
  • src/renderer/src/components/settings/appearance-status-bar-search.ts
  • src/renderer/src/components/settings/appearance-status-bar-ssh-toggle-search.ts
  • src/renderer/src/components/stats/CursorUsagePane.test.tsx
  • src/renderer/src/components/stats/CursorUsagePane.tsx
  • src/renderer/src/components/stats/StatsPane.tsx
  • src/renderer/src/components/stats/stats-search.ts
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/provider-segment-monthly-window.test.tsx
  • 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.test.ts
  • src/renderer/src/components/status-bar/usage-error-copy.ts
  • src/renderer/src/components/status-bar/usage-provider-settings-target.test.ts
  • src/renderer/src/components/status-bar/usage-provider-settings-target.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/store/slices/rate-limits.ts
  • src/renderer/src/store/slices/ui.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/cursor-session-paths.test.ts
  • src/shared/cursor-session-paths.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 thread docs/reference/cursor-usage-tracking.md Resolved
Comment thread docs/reference/cursor-usage-tracking.md Resolved
Comment on lines +100 to +123
function readItemFromStateDb(dbPath: string, key: string): string | null {
let db: SyncDatabase.Database | null = null
try {
db = new SyncDatabase(dbPath, { readonly: true, fileMustExist: true })
const row = db.prepare('SELECT value FROM ItemTable WHERE key = ?').get(key) as
| { value?: string }
| undefined
const value = row?.value
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : null
} catch {
return null
} finally {
db?.close()
}
}

export function readCursorAuthSession(): CursorAuthReadResult {
const dbPath = resolveCursorGlobalStateDbPath()
if (!existsSync(dbPath)) {
return { status: 'missing' }
}
const accessToken = readItemFromStateDb(dbPath, CURSOR_ACCESS_TOKEN_KEY)
if (!accessToken) {
return { status: 'missing' }

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not map database read failures to missing authentication.

Line 109 converts every database open and query failure to null. Lines 121-123 then report the state as missing. A locked, corrupt, or permission-denied existing database therefore appears as a signed-out user.

Return a read-error result from readItemFromStateDb, map it to CursorAuthReadResult.status: 'error', and add a regression test.

Comment thread src/main/rate-limits/cursor-fetcher.ts Resolved
Comment thread src/main/rate-limits/cursor-fetcher.ts Resolved
Comment on lines +10005 to +10022
"CursorAccountsSection": {
"a1b2c3d4e5": "Cursor",
"f6e5d4c3b2": "Shows plan usage from your Cursor IDE sign-in (globalStorage state database).",
"0d8e77bc40": "Cursor docs",
"ad47a33f72": "Loading…",
"b2c3d4e5f6": "Signed in",
"b36fa2c908": "Signed in. Orca reads the Cursor IDE session stored on disk.",
"f08c41de73": "Session expired — sign in to Cursor on the computer running Orca, then click Refresh usage.",
"e5f6a7b8c9": "Not signed in to Cursor",
"f6a7b8c9d0": "Open Cursor and sign in, then click Refresh usage here.",
"3325d996cb": "Refresh usage",
"a8f3e2c1b4": "Plan usage",
"b7e2d9f0a3": "Same plan usage % as the Cursor dashboard.",
"c6d1a8f4e2": "Resets {{when}}",
"d5e0b7c3a1": "Plan {{pct}}%",
"e4f1c8d2b0": "Auto {{pct}}%",
"f3a2d9e1c7": "API {{pct}}%"
},

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Sync the CursorAccountsSection description with the component's current fallback text.

b7e2d9f0a3 in en.json still reads "Same plan usage % as the Cursor dashboard.". src/renderer/src/components/settings/CursorAccountsSection.tsx (Line 165) passes the fallback "Same plan / Auto / API % as the Cursor dashboard." for this same key. Because the catalog value overrides the inline fallback at runtime, users see the stale, less accurate description that omits the Auto/API breakdown shown by the new badges.

Update this catalog entry to match the component's current text, or run the locale sync tooling so the key and text stay aligned.

📝 Proposed fix
-          "b7e2d9f0a3": "Same plan usage % as the Cursor dashboard.",
+          "b7e2d9f0a3": "Same plan / Auto / API % as the Cursor dashboard.",
Based on learnings, "generate locale keys as the first 10 characters of the SHA-1 hash of `:` ... Reuse the same generated key whenever identical source text appears".
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"CursorAccountsSection": {
"a1b2c3d4e5": "Cursor",
"f6e5d4c3b2": "Shows plan usage from your Cursor IDE sign-in (globalStorage state database).",
"0d8e77bc40": "Cursor docs",
"ad47a33f72": "Loading…",
"b2c3d4e5f6": "Signed in",
"b36fa2c908": "Signed in. Orca reads the Cursor IDE session stored on disk.",
"f08c41de73": "Session expired — sign in to Cursor on the computer running Orca, then click Refresh usage.",
"e5f6a7b8c9": "Not signed in to Cursor",
"f6a7b8c9d0": "Open Cursor and sign in, then click Refresh usage here.",
"3325d996cb": "Refresh usage",
"a8f3e2c1b4": "Plan usage",
"b7e2d9f0a3": "Same plan usage % as the Cursor dashboard.",
"c6d1a8f4e2": "Resets {{when}}",
"d5e0b7c3a1": "Plan {{pct}}%",
"e4f1c8d2b0": "Auto {{pct}}%",
"f3a2d9e1c7": "API {{pct}}%"
},
"CursorAccountsSection": {
"a1b2c3d4e5": "Cursor",
"f6e5d4c3b2": "Shows plan usage from your Cursor IDE sign-in (globalStorage state database).",
"0d8e77bc40": "Cursor docs",
"ad47a33f72": "Loading…",
"b2c3d4e5f6": "Signed in",
"b36fa2c908": "Signed in. Orca reads the Cursor IDE session stored on disk.",
"f08c41de73": "Session expired — sign in to Cursor on the computer running Orca, then click Refresh usage.",
"e5f6a7b8c9": "Not signed in to Cursor",
"f6a7b8c9d0": "Open Cursor and sign in, then click Refresh usage here.",
"3325d996cb": "Refresh usage",
"a8f3e2c1b4": "Plan usage",
"b7e2d9f0a3": "Same plan / Auto / API % as the Cursor dashboard.",
"c6d1a8f4e2": "Resets {{when}}",
"d5e0b7c3a1": "Plan {{pct}}%",
"e4f1c8d2b0": "Auto {{pct}}%",
"f3a2d9e1c7": "API {{pct}}%"
},

Source: Learnings

Comment on lines +7 to +12
const previous = process.platform
Object.defineProperty(process, 'platform', { value: 'darwin' })
expect(resolveCursorGlobalStateDbPath({}, '/Users/dev')).toBe(
'/Users/dev/Library/Application Support/Cursor/User/globalStorage/state.vscdb'
)
Object.defineProperty(process, 'platform', { value: previous })

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
file="$(fd -t f 'cursor-session-paths\.test\.ts$' . | head -n 1)"
printf '%s\n' "FILE: $file"
cat -n "$file"
printf '\n--- related platform mutations ---\n'
rg -n -C 3 'process\.platform|resolveCursorGlobalStateDbPath|afterEach|beforeEach' "$file"
printf '\n--- test configuration references ---\n'
rg -n '"(test|test:|vitest|jest|mocha)|vitest|jest' package.json pnpm-lock.yaml yarn.lock package-lock.json 2>/dev/null | head -80 || true

Repository: stablyai/orca

Length of output: 10603


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- Vitest configuration ---'
config="$(fd -t f 'vitest\.config\.ts$' config . | head -n 1)"
printf 'FILE: %s\n' "$config"
cat -n "$config" | sed -n '1,220p'
printf '\n--- suite-level isolation/concurrency settings ---\n'
rg -n -C 2 'sequence|concurrent|pool|isolate|fileParallelism|maxWorkers|minWorkers|restoreMocks|setupFiles' config src package.json
printf '\n--- standalone control-flow probe ---\n'
node - <<'JS'
let platform = 'linux'
function run(assertionThrows) {
  const previous = platform
  platform = 'darwin'
  try {
    if (assertionThrows) throw new Error('assertion failure')
  } finally {
    // This models the proposed safe cleanup.
    platform = previous
  }
}
try { 
  const previous = platform
  platform = 'darwin'
  throw new Error('assertion failure')
  platform = previous
} catch {}
console.log(JSON.stringify({withoutFinally: platform}))
run(false)
console.log(JSON.stringify({withFinally: platform}))
JS

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- config/vitest.config.ts ---'
cat -n config/vitest.config.ts | sed -n '1,220p'
printf '\n--- relevant test-runner settings only ---\n'
rg -n 'sequence|concurrent|pool|isolate|fileParallelism|maxWorkers|minWorkers|restoreMocks|setupFiles|test:' config/vitest.config.ts package.json
printf '\n--- standalone control-flow probe ---\n'
node - <<'JS'
let platform = 'linux'
try {
  const previous = platform
  platform = 'darwin'
  throw new Error('assertion failure')
  platform = previous
} catch {}
const withoutFinally = platform
const run = (throws) => {
  const previous = platform
  platform = 'win32'
  try {
    if (throws) throw new Error('assertion failure')
  } finally {
    platform = previous
  }
}
run(true)
console.log(JSON.stringify({ withoutFinally, afterFinally: platform }))
JS

Repository: stablyai/orca

Length of output: 6992


🏁 Script executed:

#!/bin/bash
set -eu
node - <<'JS'
const descriptorBefore = Object.getOwnPropertyDescriptor(process, 'platform')
const previous = process.platform
let withoutFinally
try {
  Object.defineProperty(process, 'platform', { value: 'darwin' })
  try {
    throw new Error('assertion failure')
  } catch {}
  withoutFinally = process.platform
} finally {
  Object.defineProperty(process, 'platform', {
    value: previous,
    configurable: descriptorBefore?.configurable,
    enumerable: descriptorBefore?.enumerable,
    writable: descriptorBefore?.writable
  })
}
let restoredByFinally
try {
  Object.defineProperty(process, 'platform', { value: 'win32' })
  try {
    throw new Error('assertion failure')
  } finally {
    Object.defineProperty(process, 'platform', {
      value: previous,
      configurable: descriptorBefore?.configurable,
      enumerable: descriptorBefore?.enumerable,
      writable: descriptorBefore?.writable
    })
  }
} catch (error) {
  console.error(error)
  process.exitCode = 1
}
restoredByFinally = process.platform
console.log(JSON.stringify({ withoutFinally, restoredByFinally }))
JS

Repository: stablyai/orca

Length of output: 721


Restore process.platform in a finally block.

If an assertion fails, the restore statement is skipped. Later tests can then run with the simulated platform. Apply the same protection to lines 16–26 and 30–35.

@@ -0,0 +1,33 @@
import { homedir } from 'node:os'
import { join } from 'node:path'

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does the XDG Base Directory Specification require XDG_CONFIG_HOME to be an absolute path?

💡 Result:

Yes, the XDG Base Directory Specification requires XDG_CONFIG_HOME to be an absolute path [1][2]. The specification explicitly states that all paths set in the environment variables defined by the spec (which includes XDG_CONFIG_HOME) must be absolute [1][3]. Furthermore, it directs that if an implementation encounters a relative path in any of these variables, it should consider the path invalid and ignore it [1][4][5].

Citations:


🏁 Script executed:

#!/bin/sh
set -eu
file=$(git ls-files | grep -Fx 'src/shared/cursor-session-paths.ts')
cat -n "$file"
printf '\nPath API availability:\n'
node - <<'JS'
const path = require('node:path')
for (const value of ['config', '~/.config', '/home/user/.config', '']) {
  console.log(JSON.stringify({ value, isAbsolute: path.isAbsolute(value), joined: path.join(value || '/fallback/.config', 'Cursor', 'User', 'globalStorage', 'state.vscdb') }))
}
JS

Repository: stablyai/orca

Length of output: 1851


Reject relative XDG_CONFIG_HOME values.

Line 29 accepts relative values such as config. Use the fallback path unless XDG_CONFIG_HOME is absolute.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@nwparker nwparker removed the P2 label Aug 19, 2026
dominikzabcik and others added 3 commits August 21, 2026 12:04
Read Cursor IDE session from state.vscdb and surface plan, Auto, and API
usage in the status bar, Stats, and Accounts settings.

Co-authored-by: Cursor <[email protected]>
Match Claude's explicit unused-case breaks so type-aware oxlint passes.

Co-authored-by: Cursor <[email protected]>
Add missing en.json entries required by localization-catalog verify.

Co-authored-by: Cursor <[email protected]>
@dominikzabcik
dominikzabcik force-pushed the feat/cursor-usage-tracking branch from 2807426 to a3dfbc0 Compare August 21, 2026 10:04
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 37d3116a-09cc-477e-962e-7d89d3df837b

📥 Commits

Reviewing files that changed from the base of the PR and between 59892a2 and a3dfbc0.

📒 Files selected for processing (56)
  • .gitignore
  • docs/reference/cursor-usage-tracking.md
  • src/main/cursor-accounts/status.test.ts
  • src/main/cursor-accounts/status.ts
  • src/main/ipc/cursor-accounts.ts
  • src/main/ipc/rate-limits.ts
  • src/main/ipc/register-core-handlers.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/rate-limit-service-test-harness.ts
  • src/main/rate-limits/service-account-target-selection.test.ts
  • src/main/rate-limits/service-inactive-account-previews.test.ts
  • src/main/rate-limits/service-live-claude-usage.test.ts
  • src/main/rate-limits/service-minimax-usage.test.ts
  • src/main/rate-limits/service-refresh-orchestration.test.ts
  • src/main/rate-limits/service-window-activation.test.ts
  • src/main/rate-limits/service.ts
  • src/preload/api-types.ts
  • src/preload/api/agent-account-api.ts
  • src/preload/api/agent-usage-api.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/renderer/src/components/settings/AppearanceWindowSidebarSection.tsx
  • src/renderer/src/components/settings/CursorAccountsSection.test.tsx
  • src/renderer/src/components/settings/CursorAccountsSection.tsx
  • src/renderer/src/components/settings/accounts-search.ts
  • src/renderer/src/components/settings/appearance-status-bar-cursor-toggle-search.ts
  • src/renderer/src/components/settings/appearance-status-bar-search.ts
  • src/renderer/src/components/settings/appearance-status-bar-ssh-toggle-search.ts
  • src/renderer/src/components/stats/CursorUsagePane.test.tsx
  • src/renderer/src/components/stats/CursorUsagePane.tsx
  • src/renderer/src/components/stats/StatsPane.tsx
  • src/renderer/src/components/stats/stats-search.ts
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/provider-segment-monthly-window.test.tsx
  • 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.test.ts
  • src/renderer/src/components/status-bar/usage-error-copy.ts
  • src/renderer/src/components/status-bar/usage-provider-settings-target.test.ts
  • src/renderer/src/components/status-bar/usage-provider-settings-target.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/store/slices/rate-limits.ts
  • src/renderer/src/store/slices/ui.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/cursor-session-paths.test.ts
  • src/shared/cursor-session-paths.ts
  • src/shared/persisted-ui-state-types.ts
  • src/shared/rate-limit-types.test.ts
  • src/shared/rate-limit-types.ts
  • src/shared/status-bar-defaults.ts
  • src/shared/ui-chrome-types.ts
🚧 Files skipped from review as they are similar to previous changes (53)
  • src/main/rate-limits/service-window-activation.test.ts
  • src/main/rate-limits/service-live-claude-usage.test.ts
  • src/shared/rate-limit-types.test.ts
  • src/renderer/src/components/settings/AppearanceWindowSidebarSection.tsx
  • src/shared/ui-chrome-types.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
  • src/renderer/src/store/slices/rate-limits.ts
  • src/main/ipc/cursor-accounts.ts
  • src/main/rate-limits/service-account-target-selection.test.ts
  • src/renderer/src/components/status-bar/usage-provider-settings-target.test.ts
  • src/shared/status-bar-defaults.ts
  • src/preload/api/agent-usage-api.ts
  • src/renderer/src/components/status-bar/tooltip.test.ts
  • src/main/rate-limits/rate-limit-service-test-harness.ts
  • src/preload/api-types.ts
  • .gitignore
  • src/renderer/src/components/settings/accounts-search.ts
  • src/main/rate-limits/service-inactive-account-previews.test.ts
  • src/main/rate-limits/service-minimax-usage.test.ts
  • src/renderer/src/components/status-bar/provider-segment-monthly-window.test.tsx
  • src/main/ipc/register-core-handlers.ts
  • src/preload/api/agent-account-api.ts
  • src/renderer/src/components/settings/appearance-status-bar-search.ts
  • src/main/rate-limits/service-refresh-orchestration.test.ts
  • src/renderer/src/components/stats/StatsPane.tsx
  • src/shared/rate-limit-types.ts
  • src/main/cursor-accounts/status.ts
  • src/main/rate-limits/cursor-fetcher.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/renderer/src/components/status-bar/usage-error-copy.ts
  • src/shared/cursor-session-paths.test.ts
  • docs/reference/cursor-usage-tracking.md
  • src/renderer/src/store/slices/ui.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts
  • src/renderer/src/components/status-bar/usage-error-copy.test.ts
  • src/renderer/src/components/settings/appearance-status-bar-ssh-toggle-search.ts
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
  • src/main/ipc/rate-limits.ts
  • src/renderer/src/components/stats/CursorUsagePane.test.tsx
  • src/main/rate-limits/cursor-fetcher.ts
  • src/shared/persisted-ui-state-types.ts
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/shared/cursor-session-paths.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/components/stats/stats-search.ts
  • src/main/cursor-accounts/status.test.ts
  • src/renderer/src/components/stats/CursorUsagePane.tsx
  • src/renderer/src/components/settings/appearance-status-bar-cursor-toggle-search.ts
  • src/main/rate-limits/cursor-auth.test.ts
  • src/renderer/src/components/settings/CursorAccountsSection.test.tsx
  • src/preload/index.ts
  • src/renderer/src/components/status-bar/usage-provider-settings-target.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment on lines +65 to +70
{translate('auto.components.settings.CursorAccountsSection.a1b2c3d4e5', 'Cursor')}
</h3>
<p className="text-xs text-muted-foreground">
{translate(
'auto.components.settings.CursorAccountsSection.f6e5d4c3b2',
'Shows plan usage from your Cursor IDE sign-in (globalStorage state database).'

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Generate the required locale keys.

The locale keys use placeholder-like values such as a1b2c3d4e5. Generate each key from the first 10 SHA-1 characters of <filePath>:<text>. Add the generated entries to src/renderer/src/i18n/locales/en.json. Then run pnpm bootstrap:locale-catalog to propagate translations.

Based on learnings: “generate locale keys as the first 10 characters of the SHA-1 hash of <filePath>:<text>” and add keys to en.json before running pnpm bootstrap:locale-catalog.

Also applies to: 80-80, 100-100, 106-120, 126-134, 153-153, 159-165, 172-203

Source: Learnings

@taehyunkim3

taehyunkim3 commented Aug 27, 2026 •

Copy link
Copy Markdown

I prepared three follow-up commits based exactly on this PR's current head a3dfbc0f:

  1. Accuracy, compatibility, and stale-account refresh guard:
    taehyunkim3@2ab42a97c
  2. Match Cursor's dashboard model pools and remove the synthetic monthly total:
    taehyunkim3@3640561f1
  3. Compact UI labels to Cursor / Other:
    taehyunkim3@049c47f25

Branch:
https://github.com/taehyunkim3/orca/tree/cursor-pr-followup

Verification:

  • 12 focused test files, 101/101 passed
  • pnpm tc
  • changed-code quality gate: 0 new findings
  • git diff --check
  • no Antigravity changes

Cherry-pick in order: 2ab42a97c 3640561f1 049c47f25

image

@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.

@dominikzabcik
dominikzabcik deleted the feat/cursor-usage-tracking branch September 28, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants