Skip to content

fix(cursor): keep the card's reset date when the usage ledger answers empty - #372

Open
Relightstar wants to merge 1 commit into
magpie-community:mainfrom
Relightstar:cursor-empty-ledger-reset-date
Open

Relightstar wants to merge 1 commit into
magpie-community:mainfrom
Relightstar:cursor-empty-ledger-reset-date

Conversation

@Relightstar

Copy link
Copy Markdown

Summary

Since Cursor's subscription rework, GetCurrentPeriodUsage can answer 200 with no planUsage and a zero-length period that tracks the clock:

{"billingCycleStart": "1792856329582", "billingCycleEnd": "1792856329582", "displayThreshold": 100}

(both timestamps equal the moment of the call, on every call). usage() then returns empty windows, so the card loses not only its percentages but also its reset date — which GetPlanInfo still answers correctly:

{"planInfo": {"planName": "Pro", "price": "$20/mo", "billingCycleEnd": "1793755328000", "planOwner": "PLAN_OWNER_STRIPE", "includedUsagePeriod": "INCLUDED_USAGE_PERIOD_MONTHLY"}}

When the ledger answers empty, ask GetPlanInfo for the cycle (cached an hour, like the plan name) and return the two pool windows with the real resetsAt, used: 0 and display: "% unknown" — the percents are unknown, not zero. No cycle known: empty windows, as before. The healthy path is unchanged, and the fallback retires by itself once planUsage returns.

Evidence

Observed 2026-10-24/25 on an individual Pro account (non-enterprise, since 2025-01, isEnterpriseUser: false):

  • Every GetCurrentPeriodUsage call — bare or with IDE client headers, before and after real completion traffic through the plugin — returned the zero-length period above; never planUsage.
  • GetMe / GetPlanInfo / GetHardLimit healthy on the same token; cursor.com/api/usage-summary needs a web session the CLI token doesn't have.
  • Cursor's status page green throughout; the card showed plan + email but no ring and no reset date, from the first call onwards (the ledger was never observed healthy for this account).
  • Third-party dashboard tools hit related planUsage empties in the same weeks (Paseo #2877, CodexBar #4545), so the root cause is Cursor-side and may clear on its own; the fallback keeps the card honest meanwhile.

Tests

  • an account the usage ledger answers empty keeps its reset date, its percents unknown
  • a ledger answered empty with no cycle to fall back to stays empty
  • packages/cursor suite: 291 pass, 0 fail (bun 1.4.2)

🤖 Generated with Claude Code

… empty

Cursor can answer GetCurrentPeriodUsage 200 with no planUsage and a
zero-length period (billingCycleStart == billingCycleEnd == now, on
every call). usage() then returns empty windows, dropping the card's
reset date too — which GetPlanInfo still answers. Fall back to
GetPlanInfo's billingCycleEnd (cached an hour, like the plan name) and
return the two pool windows with the real resetsAt, used 0 and
"% unknown": the percents are unknown, not zero. No cycle known:
empty windows, as before.

Co-Authored-By: Claude Code <noreply@anthropic.com>
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.

1 participant