Repository navigation
fix(cursor): prefer GetCurrentPeriodUsage and label the real window - #190
Merged
CodeZeno merged 1 commit intoOct 25, 2026
Merged
Conversation
The dashboard usage-summary endpoint can report a stale monthly period with zero usage while Cursor itself shows the current allowance from its application service. Query GetCurrentPeriodUsage first and fall back to the summary, then derive the session window label from the returned billing-cycle bounds so a seven-day window is not displayed as the default five-hour one. Fixes CodeZeno#186
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
Cursor monitoring only read the dashboard
/api/usage-summaryendpoint, which can describe a stale monthly period with zero usage while Cursor itself shows the current allowance from its application service (see #186 for a side-by-side comparison: summary reported 0% for October 1–November 1,GetCurrentPeriodUsagereported ~7% in an October 19–26 window).GetCurrentPeriodUsage(bearer + empty JSON POST), and fall back to the dashboard summary when the internal endpoint is unavailable or returns no plan usage.planUsagewith snake_case aliases, flexible numeric types) and log the response keys when the expected shape is missing.billingCycleStart/billingCycleEndbounds via a new optionalsession_label(mirrorsweekly_label), so a seven-day window reads7dinstead of the default5h. Exposed to themes as{provider}.session.labeland used in the tray summary.Closes #186
Testing
cargo fmt --all -- --checkcargo test --locked— 568 passed (6 new tests, including the live response shape from Cursor shows 0% and monthly reset while GetCurrentPeriodUsage reports 7% in a weekly window #186: string epoch-millisecond bounds,planUsagepercentages, seven-day label derivation, fallback triggers for disabled/empty payloads, and bearer-token extraction from the cookie forms)cargo build --locked --releaseChecklist