Skip to content

fix(menubar): stop a removed Anthropic quota from pinning the card age - #160

Merged
prakersh merged 1 commit into
mainfrom
fix/menubar-anthropic-plan-change
Oct 23, 2026
Merged

prakersh merged 1 commit into
mainfrom
fix/menubar-anthropic-plan-change

Conversation

@prakersh

Copy link
Copy Markdown
Contributor

Summary

  • After a Max -> Pro downgrade the Anthropic usage API stops reporting the per-model weekly quota. The menubar kept that quota's last-seen time for up to 24h, so the card showed "20h" while every quota it displayed was seconds old.
  • A quota missing from the payload is now dropped as soon as a newer API poll came back without it (API polls carry every quota the plan has). If no API poll succeeded since (429s, outage), the existing 24h memory still applies so the card cannot look fresher than its data.
  • The poll time is truncated to seconds to match payload precision, and statusline-only mode skips the check (an old API poll says nothing about the current plan, and the lookup would scan every statusline row).

Test plan

  • New tests: quota omitted by a newer API poll unpins at once; missing quota with no newer poll stays remembered (sub-second poll time); statusline mode ignores an old API poll
  • Each new test fails without its fix
  • ./app.sh --test (race) and go vet ./... pass
  • Verified locally on a real Max -> Pro downgrade: Anthropic card went from "20h" to "now"

After a Max -> Pro downgrade the usage API stopped reporting a per-model
weekly quota. The menubar remembered its last-seen time for up to 24h, so
the Anthropic card read "20h" while every quota it showed was seconds old.

A quota missing from the payload is now dropped at once when a newer API
poll came back without it - API polls carry every quota the plan has. With
no newer poll (API failing) the bounded memory still applies, so the card
cannot look fresher than its data. Statusline-only mode skips the check.
@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/web/menubar.go 84.61% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@prakersh
prakersh merged commit 07cbf4a into main Oct 23, 2026
24 checks passed
@prakersh
prakersh deleted the fix/menubar-anthropic-plan-change branch October 23, 2026 11:58
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