Bug with chat notifications not showing up

I started having a look at this code, but I feel a big issue is around “expectations”

  • Is this about push notifications? (if it is are you using PWA or Discourse Hub App)
  • When people say “not being notified” do they mean “not notified about mentions in a push notification”?
  • Is the expectation to be notified about a @mention via push notification when you are already online?

There are a big family of what I would consider known issues that we can improve.

  1. In PWA if we try to push 3 times in 24 hours and fail (due to connectivity to message distributor or anything else) we will kill subscriptions and not alert the user about anything.
  2. In Hub push notifications are only available to Discourse hosted customers.
  3. There are some sequencing issues where a notification can go mission on edit of chat message cause we raise a push notification from within a transaction
  4. We have a 1 minute “Debounce” which is configurable, but confusing. I was just mentioned but I did not get a PN. push notification time window. This caused: @mention, I happen to visit the app within 60 seconds. No @mention.
  5. If you @mention a user on a channel they are not following, they will not get the mention. (by design)

To be honest @lindsey / @j.jaffeux / @pmusaraj I feel like “going loud” would probably result in removing the vast majority of issues people have and complaints we have seen over the years regarding chat notifications.

  • Always push @mention notifications right away (site default) sites that want a delay can configure.
  • Always push @mention notifications from ALL channels, only exclude channels that users explicitly mute (or have no permission to see) this aligns with the behavior on the forum.
  • There is something weird in update_message.rb that is publishing a message within a transaction. (in multi threaded envs this can go missing)
  • If we happen to have killed a subscription in a PWA, put a bit banner on the PWA saying - push notifications are not configured, would you like to configure them? Maybe only kill after 1 week / 2 weeks vs 1 day.
  • Push tags are deduped per channel, hostname-chat-mention-general … this is not ideal for mentions cause we collapse per channel and that can be confusing if 4 different people mentioned you at different times on the channel.
  • Always push notifications even if user is online (default) - allow users to override this behavior if they wish.
  • An icing on all this cake would be to support first class push notifications on all sites for people who have Discourse ID configured (via Discourse ID) - This would give hub a consistent feel across everything.

Basically take away lots of the “oops we should not have notified you logic” by default.


Turned off completely at Discourse upgrade, for self hosters can definitely be due to connectivity issues to the push gateway. Maybe upgrades on some servers take days, maybe its an intranet for 24 hours for some reason.


Relevant code (via Gemini 3 pro)

PWA Subscriptions being killed

The logic that kills subscriptions after 3 failures in 24 hours is located in the handle_generic_error method.

Push Notification Debounce / Online Check

The logic checking if a user is online (“debounce”) and skipping the push notification is centrally located here. This relies on SiteSetting.push_notification_time_window_mins.

Chat: Transaction Sequencing Issues

The UpdateMessage service wraps the publish step within a database transaction. This can cause race conditions where the notification job tries to read the message before the transaction commits.

Chat: Mentions on non-followed channels

The code explicitly filters for following: true when processing mentions for public channels, preventing notifications for users who don’t follow the channel.

Chat: Push Notification Tags

The tag generation logic that dedups notifications per channel (collapsing them) is defined here:

4 Likes