Bug met chatmeldingen die niet verschijnen

We spent significant time over the last couple of years on chat notification reliability Alex.

When did you abandon Chat? @jordan-violet are you still experiencing the issue in the OP?

Thanks for your efforts Sam. For me personally the notifications worked most of the time, but would randomly drop out and require refreshing the Discourse page to get them working again - but historically have not worked at all, or worked sporadically, and definitely have a habit of being turned off completely at discourse upgrade.

We stopped using chat this week after adopting it at the start of 2023. Notifications in Google Chat just worked for the whole team including those who we’ve had regular issues with or never managed to make them work.

Hello @lindsey we are experiencing the same issue. Do you have any update from your side about the status and a potential fix?

Hi Micha,

can you try to make a more detailed report of when you are not getting the notifications please? There are a lot of cases (ios, android, pwa, discourse hub, desktop safari,chrome,firefox, which kind of notification: public channel?dm? thread? all? were you browsing when you should have received it?..)

1 like

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

It’s already something we have done a lot in last years, I removed a lot of the “smart” code, which is always hard to follow and prone to interrogations. But yes there are still various codepaths.

Obligatory infamous slack notification flowchart:

This is why I was asking for more details above, there are so many situations


2 likes

I would LOVE to see “going loud” as a system-wide preset.

“Sorry, I’m only seeing this message now — the push notifications didn’t work again. I want my Slack/Whatsapp/Signal/XYZ back”

This is by far the biggest issue we’re facing with our adoption of Discourse as an enterprise social intranet.

2 likes