Cursor: Total / Auto / API usage bars + totalPercentUsed preference#579
Cursor: Total / Auto / API usage bars + totalPercentUsed preference#579Rag30 wants to merge 3 commits intosteipete:mainfrom
Conversation
There was a problem hiding this comment.
💡 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 |
There was a problem hiding this comment.
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 👍 / 👎.
| opusLabel: "API", | ||
| supportsOpus: true, |
There was a problem hiding this comment.
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 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 |
|
Please split this PR. The current changes include more than Cursor fixes. |
…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
Made-with: Cursor
df27f35 to
9b9f410
Compare
|
@ratulsarna sorry about that, pushed another branch by mistake. Last update on this branch includes cursor only changes. |


Summary
CursorStatusSnapshot: AddsautoPercentUsed/apiPercentUsed; maps them toUsageSnapshotsecondary / tertiary bars.totalPercentUsedwhen present so the headline matches Cursor’s own “Total” bar (including Pro/subscription cases where dollar ratio isn’t the right headline).CursorStatusProbeTestsupdated for the new snapshot fields andtotalPercentUsedbehavior.