Skip to content

Add menubar quota notifications#313

Open
ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:feat/menubar-quota-notifications
Open

Add menubar quota notifications#313
ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:feat/menubar-quota-notifications

Conversation

@ozymandiashh
Copy link
Copy Markdown
Contributor

Summary

Adds optional local quota notifications to the macOS menubar app. The first notification surface is intentionally narrow: connected live-quota providers only, currently Claude and Codex, with alerts at the two thresholds people actually need to act on.

Behavior

  • adds a General Settings toggle for Quota alerts
  • requests macOS notification permission only when the user enables the toggle
  • evaluates connected quota summaries whenever the menubar store observes live quota changes
  • sends a local notification when a provider's worst quota window crosses:
    • 80%: early warning
    • 100%: limit reached / over limit
  • picks the worst quota window per provider, so Claude/Codex do not emit one alert for every sub-window in the same refresh
  • if usage jumps straight from below 80% to 100%+, sends only the 100% notification and marks the lower threshold too

Example notification:

Claude quota at 86%
Weekly usage has crossed 80%.

Dedupe / Spam Control

Alerts are deduplicated in UserDefaults by:

  • provider (claude, codex)
  • quota window label (5-hour, Weekly, etc.)
  • threshold (80, 100)
  • reset day

The reset token is day-based rather than exact timestamp-based so rolling windows that adjust their reset time do not produce repeated alerts during the same day. The coordinator also keeps an in-memory pending-key set so rapid observation refreshes cannot schedule the same notification twice before UserDefaults is written.

Old dedupe keys are pruned after 45 days.

Permission Handling

The app does not prompt from the background refresh path. Permission is requested only from Settings when the toggle is turned on. If notifications are later denied in System Settings, the toggle is disabled on the next settings sync and no hidden dedupe mark is written for undelivered alerts.

Validation

  • npm run build
  • npx vitest run (48 files / 663 tests)
  • swift build
  • git diff --check
  • Claude Opus 4.7 effort max: PASS

Notes

  • swift test still fails on the existing test-target/toolchain issue: no such module 'Testing' in mac/Tests/CodeBurnMenubarTests/CapacityEstimatorTests.swift.
  • npx tsc --noEmit still fails on the existing unrelated src/models-report.ts(151,13) TaskCategory type error.
  • Gemini 3.1 Pro Preview returned PASS after the permission-handling fix, but later repeated a false syntax finding that contradicts swift build by claiming @State / @Test were replaced with file paths. The checked files and build output confirm that finding is not real.

@AgentSeal AgentSeal added needs-testing needs-validation PR requires validation against real-world usage before review and removed needs-testing labels May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-validation PR requires validation against real-world usage before review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants