Add configurable quota warning notifications#433
Add configurable quota warning notifications#433DaddioTime wants to merge 3 commits intosteipete:mainfrom
Conversation
Notifies users before quota depletion at configurable thresholds (default 50% and 20% remaining). Tracks primary (session) and secondary (weekly) windows independently per provider. Warnings fire once per threshold crossing and auto-reset when quota recovers.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0caa0aa4f7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Move lastKnownSecondaryRemaining update into a defer block so it always runs — even on early return when notifications are disabled — while still executing after processWarningWindow during normal flow.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e95004f0b6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| scoped | ||
| } | ||
| await MainActor.run { | ||
| self.handleQuotaWarningTransition(provider: provider, snapshot: labeled) |
There was a problem hiding this comment.
Reset warning state when selected token account changes
This path applies quota-warning transitions to whichever token account is currently selected, but the warning baselines/fired-threshold state in UsageStore are keyed only by provider/window. If a user switches from one account to another with a very different remaining quota, the first refresh can look like a large downward crossing and emit false warning notifications even though no quota was consumed on the newly selected account.
Useful? React with 👍 / 👎.
|
Is this optional? I dont want this anywhere near me. |
|
@bald-ai Yes, completely optional. Default is false. |
Prevents false warning notifications when switching between accounts with different remaining quotas by clearing baselines and fired thresholds on account change.
Notifies users before quota depletion at configurable thresholds (default 50% and 20% remaining). Tracks primary (session) and secondary (weekly) windows independently per provider. Warnings fire once per threshold crossing and auto-reset when quota recovers.