The current notification system is very complicated and the code is difficult to work with.
This is because we support a feature that allows the desktop to find its own notifications, which must somehow be merged with the remote notifications.
Unfortunately, due to data inconsistencies between nodes and delivery time race conditions, this code is super edge-casey and very hard to test reliably. I believe that this is causing some subtle bugs.
Simplification Proposal
For now, I suggest that we move to a model where the notification server is the only one responsible for finding and creating notifications. The desktop will not try to discover its own notifs from the p2p network. If the desktop can't reach the notify server, you won't get new notifs. And "read indications" will not sync until you connect to the notify server.
The Future
One day we can re-evaluate this whole system and make something which properly works on p2p primitives. This would require a new data model and will probably involve some tricks and optimizations that allow the system to work in a performant way.