Skip to content

Hold back a notification flood from one sender - #21015

Open
photuris wants to merge 2 commits into
omacom:quattrofrom
photuris:feat/notification-flood-control
Open

photuris wants to merge 2 commits into
omacom:quattrofrom
photuris:feat/notification-flood-control

Conversation

@photuris

@photuris photuris commented Dec 1, 2026

Copy link
Copy Markdown

Part of #12262.

A sender in a loop (a crashing plugin, a script, a site) can fill the screen with cards until the 100-card cap. The notification daemon now gives each sender an allowance and folds the excess into one card.

  • Sender is the app name plus the source (the site, for a browser notification). Each gets 10 new cards at once, then one more every 3 seconds (Delivery.floodAdmit, an integer token bucket).
  • Excess is closed at its sender and written to history with reason flooded, as a silenced notification is, so the history key brings it back. Ephemeral ones (transient, notify-send, omarchy-action) are dropped, as under Do Not Disturb. One summary card per sender counts what was held back.
  • Critical notifications have an allowance of their own per sender: ordinary noise never costs a critical one its place, and a critical storm is bounded too.
  • Not charged: a replaces_id update, an identical copy that takes over a live card, a notification with a verification code, and anything Do Not Disturb or a fullscreen window already held back.
  • The summary card is the daemon's own: a sender cannot take it over by repeating its words, it is never persisted, and excess arriving while it is being dismissed does not bring it back.

Limits, stated in docs/notifications.md: there is no global limit beyond the existing 100 live cards, and a sender that changes its app name on every notification is not limited.

Testing

  • test/shell.d/notifications/logic.cjs (run by notifications-test.sh): the bucket arithmetic (burst, refill, a clock going back, pruning), the sender key, and the admission path against the fake model: excess held back and recorded, per app and per site, the critical allowance, free updates, copies and codes (with and without a token left, also for a card not yet inserted), ephemeral excess, Do Not Disturb and fullscreen spending nothing, the 100-card cap coming first, and the summary card under dismissal and impersonation.
  • In an Omarchy VM: 40 notifications from one app in about a second showed 10 cards and one summary, with 30 in history as flooded; another app's notification still appeared. On quattro the same storm shows 40 cards.

#16975 and #10157 (crash-card storms) are separate and touch Store.js and Markup.js, which this leaves alone.

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; both previous findings are fixed and no new actionable issues remain.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both previous findings are fixed and no new actionable issues remain.

Summary

Adds a separate notification allowance for each sender and for critical alerts. Excess notifications become history entries and update one summary card.

  • The notification daemon limits how quickly each sender can add new cards.

Reviews (2) · Last reviewed commit: "Translate flood summary in Toast and hol..." · Reviewed by Greptile

Comment thread shell/plugins/notifications/Service.qml Resolved
Comment thread shell/plugins/notifications/Service.qml Resolved
@chessing234

Copy link
Copy Markdown
Contributor

@dhh @omarchybot holding back a notification flood from one sender is in #21030.

The token bucket is 10, refilled one every 3s, with a separate bucket for criticals. The excess is one summary card and a flooded history reason. Do Not Disturb and fullscreen still record their own reasons and spend no tokens. A replacement of an existing id is not also treated as a duplicate, and a flood summary is skipped by the duplicate scan. Arrival sound from #18747 plays only for a card that was admitted.

node test/shell.d/notifications/logic.cjs passed. The shell test's state-directory case stops here on BSD chmod.

Please consider closing this as superseded only after #21030 is accepted. Leaving the close to you.

@omarchybot omarchybot added the enhancement New feature or request label Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants