Skip to content

Cursor: Total / Auto / API usage bars + totalPercentUsed preference#579

Open
Rag30 wants to merge 3 commits intosteipete:mainfrom
Rag30:feat/cursor-usage-bars
Open

Cursor: Total / Auto / API usage bars + totalPercentUsed preference#579
Rag30 wants to merge 3 commits intosteipete:mainfrom
Rag30:feat/cursor-usage-bars

Conversation

@Rag30
Copy link

@Rag30 Rag30 commented Mar 20, 2026

Summary

  • Labels: Session/weekly column labels aligned with Cursor’s dashboard: Total, Auto (Composer), API (tertiary bar enabled in provider metadata).
  • CursorStatusSnapshot: Adds autoPercentUsed / apiPercentUsed; maps them to UsageSnapshot secondary / tertiary bars.
  • Primary %: Prefer API totalPercentUsed when present so the headline matches Cursor’s own “Total” bar (including Pro/subscription cases where dollar ratio isn’t the right headline).
  • Tests: CursorStatusProbeTests updated for the new snapshot fields and totalPercentUsed behavior.

@Rag30 Rag30 marked this pull request as ready for review March 20, 2026 00:22
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 006c7ba7b3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let resolvedOnDemandUsed = self.onDemandUsedUSD
let resolvedOnDemandLimit = self.onDemandLimitUSD

// Provider cost snapshot for on-demand usage

Choose a reason for hiding this comment

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

P2 Badge Preserve Cursor's on-demand allowance when spend is still $0

This change repurposes secondary to autoPercentUsed, so the only remaining way to surface Cursor's on-demand budget is providerCost, but that snapshot is still created only when resolvedOnDemandUsed > 0 (Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:273-305). CursorProviderImplementation.appendUsageMenuEntries also returns early when providerCost is nil (Sources/CodexBar/Providers/Cursor/CursorProviderImplementation.swift:92-100). On a fresh billing cycle—or any account that has an on-demand limit but has not spent against it yet—the app now shows Total/Auto/API and no on-demand allowance at all, so users lose the ability to verify whether they have extra usage available until after the first charge lands.

Useful? React with 👍 / 👎.

Comment on lines +15 to +16
opusLabel: "API",
supportsOpus: true,

Choose a reason for hiding this comment

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

P2 Badge Route Cursor's new API lane through menu-bar metric selection

Enabling supportsOpus here exposes a tertiary Cursor bar, but the status-item plumbing still ignores tertiary windows: the metric picker only offers Automatic/Primary/Secondary/Average (Sources/CodexBar/PreferencesProvidersPane.swift:278-290), and both StatusItemController.menuBarMetricWindow and UsageStore.menuBarMetricWindowForHighestUsage only consider primary and secondary (Sources/CodexBar/StatusItemController.swift:124-148, Sources/CodexBar/UsageStore+HighestUsage.swift:28-52). For accounts where apiPercentUsed is the constrained quota—for example, named-model API usage reaches 100% while Total is still comfortably below the cap—the new API bar is visible only inside the detail card, while the menu-bar percent and highest-usage selection continue to report a healthy value.

Useful? React with 👍 / 👎.

@ratulsarna
Copy link
Collaborator

Ran this branch and seeing different numbers in the app vs the web dashboard. Any ideas why?

image image

@ratulsarna ratulsarna added the question Further information is requested label Mar 20, 2026
@Rag30
Copy link
Author

Rag30 commented Mar 20, 2026

@ratulsarna Root cause was mostly misreading the usage-summary JSON: plan limit is often dollars in cents, not a usage cap, plus Auto/API come back as either fractions or percents. Normalizing those and built “Total” from the Auto+API instead of trusting a naive ratio or totalPercentUsed when it disagrees. Do you mind testing it out again and letting me know if it worked for you? Tried on 3 different computers but never saw a differential as high as your screenshot

@ratulsarna
Copy link
Collaborator

Please split this PR. The current changes include more than Cursor fixes.

Rag30 added 3 commits March 21, 2026 13:14
…erence

- Labels: Total, Auto (Composer), API; enable tertiary bar in metadata
- CursorStatusSnapshot: autoPercentUsed / apiPercentUsed; map to secondary/tertiary
- Prefer API totalPercentUsed for primary when present (matches Cursor UI)
- Update CursorStatusProbeTests

Extracted from main without Codex multi-account changes (base: pre-codex merge).

Made-with: Cursor
- Emit providerCost when on-demand limit > 0 even if spend is $0
- Add MenuBarMetricPreference.tertiary and MenuBarMetricWindowResolver
- Automatic mode uses max(primary, secondary, tertiary) only for Cursor
- Highest-usage exclusion all-lanes-100% only for Cursor automatic
- Gemini and other providers keep primary ?? secondary automatic behavior

Made-with: Cursor
@Rag30 Rag30 force-pushed the feat/cursor-usage-bars branch from df27f35 to 9b9f410 Compare March 21, 2026 17:14
@Rag30
Copy link
Author

Rag30 commented Mar 21, 2026

@ratulsarna sorry about that, pushed another branch by mistake. Last update on this branch includes cursor only changes.

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

Labels

changes requested question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants