Repository navigation
fix(cursor): keep the card's reset date when the usage ledger answers empty - #372
Open
Relightstar wants to merge 1 commit into
Open
Relightstar wants to merge 1 commit into
Relightstar wants to merge 1 commit into
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since Cursor's subscription rework,
GetCurrentPeriodUsagecan answer 200 with noplanUsageand 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 — whichGetPlanInfostill 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
GetPlanInfofor the cycle (cached an hour, like the plan name) and return the two pool windows with the realresetsAt,used: 0anddisplay: "% 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 onceplanUsagereturns.Evidence
Observed 2026-10-24/25 on an individual Pro account (non-enterprise, since 2025-01,
isEnterpriseUser: false):GetCurrentPeriodUsagecall — bare or with IDE client headers, before and after real completion traffic through the plugin — returned the zero-length period above; neverplanUsage.GetMe/GetPlanInfo/GetHardLimithealthy on the same token;cursor.com/api/usage-summaryneeds a web session the CLI token doesn't have.planUsageempties 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
packages/cursorsuite: 291 pass, 0 fail (bun 1.4.2)🤖 Generated with Claude Code