Skip to content

fix: clear the Cursor auth-expired notice when there is no Cursor login - #412

Merged
chattymin merged 9 commits into
chattymin:mainfrom
Borisserz:fix/cursor-auth-expired-clears
Oct 5, 2026
Merged

chattymin merged 9 commits into
chattymin:mainfrom
Borisserz:fix/cursor-auth-expired-clears

Conversation

@Borisserz

Copy link
Copy Markdown
Contributor

Summary

Fixes #411. refreshCursorLimits() reset cursorLimitsAuthExpired only when a status came back. After a 401, logging out of Cursor or setting CURSOR_USAGE_API=0 makes fetch() return nil without throwing, so the "log in to Cursor again" notice stayed up until restart. The flag is now cleared on every non-throwing fetch. A nil result means there is nothing left to re-authenticate. A 401/403 still sets the flag, and other errors (network, etc.) still leave it alone.

Class sweep: Antigravity's fetch is non-optional, and the Claude auth-expiry paths already reset on success or skip, so only Cursor had this gap.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • Other:

UI changes

Before After
After a Cursor 401 and then logging out of Cursor, the Cursor tab keeps the "session expired" notice and a dimmed Official limits section until restart. The notice and section go away on the next refresh.

Validation

  • New UsageStoreTests.testCursorAuthExpiredClearsWhenThereIsNoCursorLoginAnymore uses a scripted provider: 401 first, then nil. It failed on unfixed main and passes now.
  • swift test --filter 'UsageStoreTests|CursorLimits': 84 tests, 0 failures.
  • Added a defect-log entry.

Checklist

  • swift build and swift test pass locally
  • PR title and description are written in English
  • UI changes are described above (before/after — images optional)
  • No copyrighted assets, secrets, or private tooling references are committed (see CONTRIBUTING)
  • Tests were added or updated for this change

chattymin and others added 9 commits September 29, 2026 11:49
…sets

Official limits are an account property, but the popover reaches them
only through a provider snapshot. Week and month totals reset at their
calendar boundaries, so a provider used last Friday has week = month = 0
on Monday (or after the 1st) and lost its tab and its limits section
while the limits were being fetched fine (chattymin#336).

Track the newest positive-token entry (lastUsage) in the shared
ProviderEnrichment.local and keep the snapshot while it is within the
7-day weekly quota window. Zero-token synthetic records do not count.
Extend enrichmentScanStart to cover the window and keep snapshots in
provider registration order, since carriers arrive in task-completion
order.
# Conflicts:
#	Sources/PokeTokenBar/Core/UsageStore.swift
#	docs/reference/defect-log.md
# Conflicts:
#	docs/reference/defect-log.md
@chattymin
chattymin merged commit 5ee12ee into chattymin:main Oct 5, 2026
2 checks passed
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.

Cursor "session expired" notice never clears after logging out of Cursor

2 participants