From b0154b09d80a50329261a6e2839007afb171bc8f Mon Sep 17 00:00:00 2001 From: iequidoo Date: Thu, 26 Mar 2026 15:34:46 -0300 Subject: [PATCH 1/2] feat: Log received message sort timestamp This way it's easier to debug issues like `MsgsNoticed` not emitted for a chat. --- src/receive_imf.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 55c98da763..300025fc52 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -2354,7 +2354,7 @@ RETURNING id info!( context, - "Message has {icnt} parts and is assigned to chat #{chat_id}." + "Message has {icnt} parts and is assigned to chat #{chat_id}, timestamp={sort_timestamp}." ); if !chat_id.is_trash() && !hidden { From cac9f3d383342132abd0c6a83f59792735d85414 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Thu, 26 Mar 2026 16:23:10 -0300 Subject: [PATCH 2/2] fix: When receiving MDN, mark all preceding messages as noticed, even having same timestamp (#7928) This fixes flaky JSON-RPC `test_multidevice_sync_seen`. --- src/receive_imf.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 300025fc52..6de0e7ca72 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -1010,11 +1010,11 @@ UPDATE config SET value=? WHERE keyname='configured_addr' AND value!=?1 && msg.chat_visibility == ChatVisibility::Archived; updated_chats .entry(msg.chat_id) - .and_modify(|ts| *ts = cmp::max(*ts, msg.timestamp_sort)) - .or_insert(msg.timestamp_sort); + .and_modify(|pos| *pos = cmp::max(*pos, (msg.timestamp_sort, msg.id))) + .or_insert((msg.timestamp_sort, msg.id)); } } - for (chat_id, timestamp_sort) in updated_chats { + for (chat_id, (timestamp_sort, msg_id)) in updated_chats { context .sql .execute( @@ -1023,12 +1023,13 @@ UPDATE msgs SET state=? WHERE state=? AND hidden=0 AND chat_id=? AND - timestamp