You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ANCS: some old notifications come back without PreExisting on every reconnect and pop up again #346
What happens. On every new ANCS session the iPhone replays its Notification Center. Most entries carry PreExisting (0x04), but a few specific ones never do. They arrive as plain Added events, so tether pops them up as new on every reconnect. I logged each Added event without PreExisting whose Date attribute was more than 2 minutes old (24 sessions, 2026-11-23):
app
Date
flags
category
sessions seen
com.burbn.instagram
20261123T094814
0x10
0 Other
19 (over 11 h)
com.ledger.live
20261123T161938
0x10
9 BusinessAndFinance
12
de.zalando.lounge
20261123T180814
0x30
0 Other
7
com.apple.mobilemail
5 different
0x10 / 0x11
6 Email
1–2 each
The same entry keeps coming back unflagged session after session, until it's cleared on the phone. It's not random per session.
Every one of them has PositiveAction (0x10) set. That's not enough to explain it, though, since plenty of flagged entries have actions too.
They arrive in the replay burst right after subscribing, mixed in with the flagged ones.
I saw it live today: I ran a build from main, toggled Bluetooth on the phone, and Instagram, Ledger and Zalando Lounge popped up as "Just now" with content from hours earlier.
Possible rules (I'd like your take before writing code):
By Date: treat an unflagged Added as backlog when its Date is more than ~2 min old. It's simple, but Date is the phone's local wall clock with no zone, so a PC in another timezone or with a skewed clock would misjudge it, and some apps send no Date at all (those would be left as they are).
By replay burst: treat unflagged Added events in the burst right after subscribing as backlog. This needs no clock, but a genuinely new notification that lands in that same second would go to the list without a popup.
Both: suppress only when the event is in the replay burst and its Date is old. That has the fewest false positives, at the cost of a little more state.
I lean towards 3. Locally I've been running 1, and it has removed the repeat popups for me.
Thanks, this is exactly the data I was hoping for. It also shows that an assumption we made earlier is wrong: that iOS flags every replayed entry and only those.
I'd like to avoid a clock-based rule if we can. The Date has no timezone, the two clocks can drift, and the 2-minute cutoff would also hide a notification that was delivered while the link was down for more than 2 minutes. That's the case #339 set out to recover.
NotificationRegistry::store() already recognises a copy of something we've seen in an earlier session: same app, title, subtitle, body and Date. Right now it uses that only to keep the list free of duplicates, and on_notification still fires, so the popup goes out again. My suggestion:
store() returns whether it replaced a copy from an earlier session.
handle_response sets pre_existing = true in that case before calling on_notification.
The OTP publish in main.cpp should skip those too, so an old code isn't republished on every reconnect.
This needs no clock and can't hide anything genuinely new, since a new notification won't match on both content and Date. It covers your case: the same Instagram, Ledger or Zalando entry coming back unflagged session after session.
Two known gaps:
The registry lives in memory, so the first session after the daemon starts has nothing to compare against, and those entries would pop up once per login. If that's annoying in practice, your option 2 (treat the replay burst as backlog) makes sense for that first session only, since everything in that replay really is old.
Apps that send no Date can't be matched. That's the same as with option 1.
Could you try this against your log? If it removes the repeat popups the way option 1 did for you, a PR with a registry test would be great: an unflagged copy from an earlier session gets marked pre-existing, and a new one doesn't.
Tried it, and it works: after a daemon restart I toggled Bluetooth on the phone, and in the second session the registry caught all 6 unflagged replays (Ledger ×2, Zalando Lounge, WhatsApp, Whoop, Instagram). PR incoming.
On the first-session gap: in my log, 59 of 64 repeat popups were in the first session after a daemon start. My log is skewed because I restarted a lot while developing, but with #343 the daemon now also restarts at every logout, so it's once per login for everyone. If you're open to it, I'd follow up with your option-2-for-the-first-session idea as a separate PR.
Activity
zackb commentedon Nov 23, 2026
Thanks, this is exactly the data I was hoping for. It also shows that an assumption we made earlier is wrong: that iOS flags every replayed entry and only those.
I'd like to avoid a clock-based rule if we can. The Date has no timezone, the two clocks can drift, and the 2-minute cutoff would also hide a notification that was delivered while the link was down for more than 2 minutes. That's the case #339 set out to recover.
NotificationRegistry::store() already recognises a copy of something we've seen in an earlier session: same app, title, subtitle, body and Date. Right now it uses that only to keep the list free of duplicates, and on_notification still fires, so the popup goes out again. My suggestion:
This needs no clock and can't hide anything genuinely new, since a new notification won't match on both content and Date. It covers your case: the same Instagram, Ledger or Zalando entry coming back unflagged session after session.
Two known gaps:
Could you try this against your log? If it removes the repeat popups the way option 1 did for you, a PR with a registry test would be great: an unflagged copy from an earlier session gets marked pre-existing, and a new one doesn't.
fernando2393 commentedon Nov 23, 2026
Tried it, and it works: after a daemon restart I toggled Bluetooth on the phone, and in the second session the registry caught all 6 unflagged replays (Ledger ×2, Zalando Lounge, WhatsApp, Whoop, Instagram). PR incoming.
On the first-session gap: in my log, 59 of 64 repeat popups were in the first session after a daemon start. My log is skewed because I restarted a lot while developing, but with #343 the daemon now also restarts at every logout, so it's once per login for everyone. If you're open to it, I'd follow up with your option-2-for-the-first-session idea as a separate PR.