Skip to content

Add on-screen text alert option for quota warnings#1692

Open
SAASEmpiree wants to merge 2 commits into
steipete:mainfrom
SAASEmpiree:feature/quota-warning-onscreen-alert
Open

Add on-screen text alert option for quota warnings#1692
SAASEmpiree wants to merge 2 commits into
steipete:mainfrom
SAASEmpiree:feature/quota-warning-onscreen-alert

Conversation

@SAASEmpiree

@SAASEmpiree SAASEmpiree commented Jun 21, 2026

Copy link
Copy Markdown

Summary

Adds a toggleable "Show on-screen text alert" setting right next to the existing "Play notification sound" checkbox in the Quota warning notifications section.

When enabled, crossing a session or weekly warning threshold presents a transient, centered text card on screen showing the provider, window, and remaining percentage (reusing the existing quota-warning notification copy). It is modeled on the existing ScreenConfettiOverlayController: a borderless, click-through NSPanel above all spaces that auto-dismisses after ~4.5s and never steals focus or blocks the user's work.

Off by default to stay non-intrusive.

Implements the request in #1691.

Proof

Built and run locally on macOS 26, from a freshly built CodexBar app. No personal data is shown.

Settings — the new "Show on-screen text alert" checkbox sits directly under "Play notification sound":

Quota warning settings showing the new "Show on-screen text alert" checkbox

The centered on-screen alert it produces (auto-dismisses after ~4.5s):

Centered on-screen quota warning card: "Claude — Session quota low / 20% left. Reached your 20% session warning threshold."

The alert was triggered via a local-only preview shortcut to capture the screenshot, but it renders through the exact QuotaWarningAlertOverlayController code path used on a real threshold crossing. The "▶ Preview on-screen alert" button is not part of this PR.

What changed

  • Setting: new quotaWarningOnScreenAlertEnabled bool (UserDefaults key quotaWarningOnScreenAlertEnabled, default false), wired through SettingsStoreState, SettingsStore, SettingsStore+Defaults, the loader, and menu observation — mirroring quotaWarningSoundEnabled exactly.
  • UI: a .checkbox Toggle in GlobalQuotaWarningSettingsView, with a new localization key quota_warning_onscreen_alert = "Show on-screen text alert" (en).
  • Overlay: new QuotaWarningAlertOverlayController + a small SwiftUI card (icon + title + body, .regularMaterial background, subtle spring-in). Centered on the main screen.
  • Trigger: SessionQuotaNotifier.postQuotaWarning(...) gains an onScreenAlertEnabled parameter and shows the overlay when set; UsageStore passes the new setting. Protocol + the two test spies updated to match.

Build & testing

  • swift buildbuild complete, app links cleanly with the change.
  • Verified the UI and overlay behavior on a freshly built bundle (see Proof above).
  • Note on environment: built with Command Line Tools only (no full Xcode), so I could not run make test / swiftformat / swiftlint locally — the SwiftUI @Entry/#Preview macro plugins and the swift-testing module for the Linux test target aren't available here. Code follows the existing style (4-space indent, ≤120 cols, explicit self). Happy to adjust to whatever CI/format flags.

Notes / open questions

  • Only the English string is added; other *.lproj files fall back to English via L(). Glad to add translations or follow whatever localization sync flow you prefer.
  • The overlay is intentionally click-through + auto-dismiss (matching the confetti overlay). If you'd prefer click-to-dismiss or a different lifetime/position, easy to tweak.
  • I can drop the CHANGELOG.md entry if you'd rather handle release notes through your own release flow — just say the word.

Adds a toggleable "Show on-screen text alert" setting next to the existing
"Play notification sound" checkbox in the Quota warning notifications section.

When enabled, crossing a session or weekly warning threshold presents a
transient, centered text card on screen (provider, window, and remaining %),
modeled on the existing confetti overlay: a borderless, click-through panel
that auto-dismisses and never steals focus. Off by default.

Closes steipete#1691

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@clawsweeper

clawsweeper Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed June 20, 2026, 9:12 PM ET / 01:12 UTC.

Summary
The PR adds an off-by-default on-screen quota-warning alert setting, persists it in UserDefaults, renders a centered click-through AppKit/SwiftUI overlay, and wires it through existing quota warning delivery.

Reproducibility: not applicable. this is a feature PR rather than a broken existing behavior. Current main lacks the alert toggle, and the PR screenshots show the new settings row and overlay rendering.

Review metrics: 2 noteworthy metrics.

  • Diff scope: 11 files, +196/-8. The change spans settings persistence, notification delivery, AppKit/SwiftUI overlay code, localization, and tests.
  • Proof media: 2 screenshots. The attached images show the new checkbox and rendered overlay, while the live threshold-trigger path is still unshown.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #1691
Summary: This PR is the implementation candidate for the linked on-screen quota-warning alert feature request.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Get maintainer sign-off for the new screen-visible quota alert behavior.

Mantis proof suggestion
A short macOS visual proof would add confidence that the persisted setting triggers the alert from an actual quota-warning path, not only a preview shortcut. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis visual task: verify the quota-warning settings checkbox and centered auto-dismissing alert on a real threshold crossing in a freshly built CodexBar app.

Risk before merge

  • [P1] The PR adds a new persisted feature/config surface and a screen-visible alert, so maintainer product sign-off remains needed before merge.
  • [P1] The overlay reuses account-aware quota-warning copy when personal info is visible; this is opt-in and inherits existing redaction, but maintainers should accept the privacy/UX tradeoff.
  • [P1] The screenshots prove the settings row and overlay rendering, but not the full persisted setting to real threshold-crossing path.
  • [P1] The contributor reports swift build and local app proof, while AGENTS.md still asks for make test and make check after code changes.

Maintainer options:

  1. Get product sign-off before merge (recommended)
    Have a maintainer explicitly accept the opt-in screen-visible quota warning and privacy/UX tradeoff before landing the feature.
  2. Ask for threshold-path proof
    Request a short recording or diagnostic run showing an actual quota threshold crossing with the setting enabled if maintainers want stronger runtime proof.
  3. Pause the feature
    Hold or close this PR with the linked feature request if CodexBar should keep quota warnings limited to existing system notifications, sound, and menu indicators.

Next step before merge

  • [P2] The remaining decision is whether maintainers want the opt-in screen-visible quota warning and privacy/UX tradeoff, not a narrow code repair.

Security
Cleared: No concrete security or supply-chain defect was found; the screen-visible account-aware copy remains a maintainer privacy/UX sign-off risk.

Review details

Best possible solution:

If maintainers accept the feature, land the off-by-default overlay after normal validation and keep the linked feature request paired with this PR until merge.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is a feature PR rather than a broken existing behavior. Current main lacks the alert toggle, and the PR screenshots show the new settings row and overlay rendering.

Is this the best way to solve the issue?

Unclear until maintainer sign-off. The implementation shape is narrow and reuses existing warning copy, but accepting a new screen-level alert and privacy surface is a product decision.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3f3e2f4a112a.

Label changes

Label justifications:

  • P3: This is a low-urgency optional quota-warning UX feature rather than a broken current workflow.
  • merge-risk: 🚨 other: Merging would add a new screen-visible alert and privacy/UX surface that CI cannot decide for maintainers.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected screenshots show the after-change settings checkbox and centered alert card from a freshly built app, which is sufficient visible proof for this UI change though not full threshold-path proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected screenshots show the after-change settings checkbox and centered alert card from a freshly built app, which is sufficient visible proof for this UI change though not full threshold-path proof.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected screenshots show the after-change settings checkbox and centered alert card from a freshly built app, which is sufficient visible proof for this UI change though not full threshold-path proof.
Evidence reviewed

What I checked:

  • Repository policy read: AGENTS.md was read fully; its validation, UI/runtime proof, release-owned changelog, and focused Swift testing guidance apply to this PR review. (AGENTS.md:1, 3f3e2f4a112a)
  • No maintainer notes found: No .agents/maintainer-notes files were present for the touched settings, notification, or overlay paths. (3f3e2f4a112a)
  • VISION sign-off context: VISION.md lists new features and privacy-affecting behavior as needing sign-off, which applies to a new screen-visible quota alert surface. (VISION.md:8, 3f3e2f4a112a)
  • Current main lacks alert toggle: Current main's GlobalQuotaWarningSettingsView exposes session, weekly, threshold fields, and quotaWarningSoundEnabled but no on-screen alert setting. (Sources/CodexBar/QuotaWarningSettingsViews.swift:33, 3f3e2f4a112a)
  • PR adds settings toggle: The PR head adds a checkbox bound to quotaWarningOnScreenAlertEnabled directly below the existing sound setting. (Sources/CodexBar/QuotaWarningSettingsViews.swift:39, c3ee1ac3e484)
  • PR default is off: The new UserDefaults key falls back to false, preserving current default behavior for existing and fresh installs unless the user opts in. (Sources/CodexBar/SettingsStore.swift:586, c3ee1ac3e484)

Likely related people:

  • Alekstodo: Targeted git -S history shows commit 18eb73d added quota warning controls and markers, including the settings and notification surfaces this PR extends. (role: introduced threshold warning behavior; confidence: high; commits: 18eb73dde236; files: Sources/CodexBar/QuotaWarningSettingsViews.swift, Sources/CodexBar/SessionQuotaNotifications.swift, Sources/CodexBar/SettingsStore.swift)
  • steipete: Local current-main history and blame attribute the v0.37.0 release base and current main quota-warning files to Peter Steinberger, and the linked request asks for maintainer sign-off from steipete. (role: recent area contributor and release integrator; confidence: high; commits: 33a5f4362eab, 3f3e2f4a112a; files: Sources/CodexBar/QuotaWarningSettingsViews.swift, Sources/CodexBar/SessionQuotaNotifications.swift, Sources/CodexBar/UsageStore+QuotaWarnings.swift)
  • raflyazf: Targeted git -S history shows commit ee96d84 added account-aware quota-warning copy, which is the text this overlay reuses. (role: notification copy contributor; confidence: medium; commits: ee96d84fc0b8; files: Sources/CodexBar/SessionQuotaNotifications.swift, Tests/CodexBarTests/QuotaWarningNotificationLogicTests.swift)
  • zats: Targeted git -S history shows commit dab7f79 added the existing full-screen confetti overlay pattern that this PR models. (role: adjacent overlay contributor; confidence: medium; commits: dab7f7929283; files: Sources/CodexBar/ScreenConfettiOverlayController.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8cc47e6ea9

ℹ️ 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".

Comment on lines +60 to +61
try? await Task.sleep(for: .seconds(Self.overlayLifetime))
self?.dismiss()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid dismissing replacement alerts from canceled tasks

When another warning arrives while an overlay is visible, show cancels the previous dismissalTask before assigning the replacement window; because this task swallows CancellationError from Task.sleep and then still calls dismiss(), the canceled old task can resume after the new window is stored and immediately close the new alert. This is reachable for back-to-back session/weekly threshold crossings in one refresh, so the on-screen alert can flash and disappear instead of staying up for 4.5 seconds; return on cancellation or gate dismissal to the task/window that scheduled it.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels Jun 21, 2026
SAASEmpiree added a commit to SAASEmpiree/CodexBar that referenced this pull request Jun 21, 2026
@SAASEmpiree

SAASEmpiree commented Jun 21, 2026

Copy link
Copy Markdown
Author

Here's the new option in context — built and tested locally on macOS 26.

Settings — the new "Show on-screen text alert" checkbox sits directly under "Play notification sound":

Quota warning settings showing the new "Show on-screen text alert" checkbox

The alert itself — when enabled, crossing a session/weekly threshold presents a centered, click-through text card that auto-dismisses after ~4.5s:

Centered on-screen quota warning card: "Claude — Session quota low / 20% left. Reached your 20% session warning threshold."

ℹ️ Note: the "▶ Preview on-screen alert" button visible in the settings screenshot is a local-only testing shortcut I added to trigger the overlay on demand for these screenshots — it is not part of this PR. The PR adds only the checkbox; the alert fires automatically on threshold crossings.

SAASEmpiree added a commit to SAASEmpiree/CodexBar that referenced this pull request Jun 21, 2026
@SAASEmpiree

Copy link
Copy Markdown
Author

@clawsweeper re-review

Added real-behavior proof to the PR body: screenshots of the new Show on-screen text alert checkbox and the centered auto-dismissing overlay, captured from a freshly built CodexBar app (macOS 26).

@clawsweeper

clawsweeper Bot commented Jun 21, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 21, 2026
- QuotaWarningAlertOverlayController: bail out of the auto-dismiss task when
  it has been cancelled by a newer alert, so back-to-back session/weekly
  warnings don't tear down the replacement overlay early.
- Remove the CHANGELOG.md entry; release notes are release-owned in this repo
  (kept the context in the PR body instead).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@SAASEmpiree

Copy link
Copy Markdown
Author

Thanks for the thorough review! Addressed both findings in c3ee1ac:

  • [P2] Overlay dismissal race (QuotaWarningAlertOverlayController.swift): the auto-dismiss task now returns early when it has been cancelled by a newer alert (guard !Task.isCancelled else { return }), so back-to-back session/weekly warnings keep the latest card visible for the full ~4.5s instead of tearing it down immediately.
  • [P3] Changelog: removed the CHANGELOG.md entry — release notes stay in the PR body for the release flow.

The remaining items are maintainer product decisions for @steipete (opt-in screen-visible alert + privacy tradeoff). For context: the overlay reuses the exact same copy as the existing system notification, and the account name is already redacted upstream — quotaWarningAccountDisplayName returns nil when hidePersonalInfo is enabled (UsageStore+QuotaWarnings.swift:96), so no account identity is shown in that mode.

@SAASEmpiree

Copy link
Copy Markdown
Author

@clawsweeper re-review

Pushed c3ee1ac addressing both findings: fixed the overlay dismissal-task cancellation race (QuotaWarningAlertOverlayController.swift) and removed the CHANGELOG.md entry.

@clawsweeper

clawsweeper Bot commented Jun 21, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant