Skip to content

fix(mac): keep (today, all) cache fresh for menubar title and tab labels#94

Merged
AgentSeal merged 1 commit into
mainfrom
fix/menubar-today-cache-staleness
Apr 18, 2026
Merged

fix(mac): keep (today, all) cache fresh for menubar title and tab labels#94
AgentSeal merged 1 commit into
mainfrom
fix/menubar-today-cache-staleness

Conversation

@AgentSeal
Copy link
Copy Markdown
Collaborator

@AgentSeal AgentSeal commented Apr 18, 2026

Summary

Bug reported live: Mac menubar title and agent tab strip show stale costs when the user is viewing the Today period and a specific provider (e.g., Claude tab). Hero section updates correctly, but menubar icon + tab labels lag.

Root cause: startRefreshLoop() only called refreshQuietly(period: .today) when the selected period was NOT Today. On Today, only the currently-viewed payload refreshed, leaving (today, all) stale. That's the cache both the menubar title and tab labels read from.

Fix: drop the guard, always refresh (today, all) every cycle.

Validator verdict

Fresh-session validator checked:

  • Fix matches description ✓
  • No concurrent-fetch races ✓
  • Reactive propagation wired (menubar + tab strip will pick up fresh values) ✓
  • All edge cases (empty cache, offline, rapid tab switching, non-Today periods) safe ✓
  • Zero MUST-FIX items

Flagged one polish issue (duplicate CLI spawn when user is on Today+All) as non-blocking. Follow-up work.

Test plan

  • swift build clean
  • swift test passes 10/10
  • Package .app via mac/Scripts/package-app.sh, install locally, verify menubar title + tab labels update when provider cost changes
  • Tag mac-v0.7.4 after merge to ship to customers via npx codeburn menubar

The refresh loop previously skipped `refreshQuietly(.today)` when the
user was already viewing the Today period. That guard meant while the
user was on (today, claude) or any other non-.all provider, the
(today, all) cache went stale. The menubar title and the agent tab
strip both read from that cache, so they displayed stale costs while
the hero section (which reads the currently-viewed payload) showed
the correct fresh value.

Remove the guard so the (today, all) cache refreshes every cycle
regardless of the currently selected period/provider.

Shipped as mac-v0.7.4.
@AgentSeal AgentSeal merged commit 70f47f8 into main Apr 18, 2026
1 check 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.

2 participants