Saved messages (self-chat) shows another 1:1 chat's messages #71

Open
opened 2026-12-02 01:07:44 +00:00 by ann · 1 comment
Owner

Reported by og9jcr2gy in discuss@conference.another.im (2026-12-02, Android, app 0.9.0-rc6 / libtacky 1.3.0-rc8; also seen on many earlier versions). Owner asked to investigate and reproduce.

Symptom: the Saved messages chat (the self-chat) periodically shows, besides the user's real saved notes, messages of an ordinary 1:1 chat with someone else — both the peer's incoming messages (with the peer's avatar) and the user's own replies. Screenshots: the Saved chat and the 1:1 chat show the same conversation. Differences seen in the Saved copy: own messages have a single tick (no read eye / no double tick), the call rows ("answered on another device", "missed call") are absent, and some timestamps differ by several minutes (01:22 in Saved vs 01:28 in the 1:1 chat; 01:30 vs 01:38).

Hypotheses to check:

  1. MAM catch-up / history paging of the self-chat queries the account's own archive with with=<own bare JID>; on ejabberd (and maybe Prosody) every message in the archive matches that filter (each is to or from the own bare JID), so other chats' messages get stored into the self-chat.
  2. Carbons / sent-message handling files a message whose to or from resolves to the own bare JID (e.g. a missing/odd to, a carbon of a message to another own resource) into the self-chat.
  3. A UI-side list mix-up (stale rows of the previous chat) — less likely given the differing ticks/timestamps.

Ask: reproduce on the integration rig (ejabberd + Prosody): two accounts chat; the user's second device catches up / scrolls Saved messages; check what lands in the self-chat. Add a regression test; fix in libtacky if confirmed.

Filed by GLaDOS for контрадмиралъ кончак in discuss@conference.another.im, 2026-12-02.

Reported by og9jcr2gy in discuss@conference.another.im (2026-12-02, Android, app 0.9.0-rc6 / libtacky 1.3.0-rc8; also seen on many earlier versions). Owner asked to investigate and reproduce. **Symptom:** the Saved messages chat (the self-chat) periodically shows, besides the user's real saved notes, messages of an ordinary 1:1 chat with someone else — both the peer's incoming messages (with the peer's avatar) and the user's own replies. Screenshots: the Saved chat and the 1:1 chat show the same conversation. Differences seen in the Saved copy: own messages have a single tick (no read eye / no double tick), the call rows ("answered on another device", "missed call") are absent, and some timestamps differ by several minutes (01:22 in Saved vs 01:28 in the 1:1 chat; 01:30 vs 01:38). **Hypotheses to check:** 1. MAM catch-up / history paging of the self-chat queries the account's own archive with `with=<own bare JID>`; on ejabberd (and maybe Prosody) every message in the archive matches that filter (each is to or from the own bare JID), so other chats' messages get stored into the self-chat. 2. Carbons / sent-message handling files a message whose `to` or `from` resolves to the own bare JID (e.g. a missing/odd `to`, a carbon of a message to another own resource) into the self-chat. 3. A UI-side list mix-up (stale rows of the previous chat) — less likely given the differing ticks/timestamps. **Ask:** reproduce on the integration rig (ejabberd + Prosody): two accounts chat; the user's second device catches up / scrolls Saved messages; check what lands in the self-chat. Add a regression test; fix in libtacky if confirmed. _Filed by GLaDOS for контрадмиралъ кончак in discuss@conference.another.im, 2026-12-02._
ann referenced this issue from a commit 2026-12-02 01:57:47 +00:00
Author
Owner

Investigation (GLaDOS, 2026-12-02), branch fix/selfchat-leak (not merged):

  • Root cause (code, proven by a failing unit test): when libtacky pages a 1:1 chat from the account's own archive (history, goto, search, fetch → ParseResultNode in message.tcl), it files every returned message under that chat without checking it is between us and that chat. Rooms and contacts' archives already have such a check. So any Saved-messages page (with=<own bare JID>) that brings back other messages files them into Saved — matching every detail of the report (peer avatar, single ticks, archive timestamps, no call rows).
  • Not reproduced end to end: ejabberd 26.09, Prosody 13, Openfire 5.1.2 and MongooseIM all filter with=<own JID> correctly on the rig; catch-up, paging, jump-by-date, OMEMO with 2–3 devices and history/0 stayed clean. What made the page return foreign messages in the field is still unknown (prod server patches? an app-side path?).
  • Tests: 135ae233f — unit message-history-self-chat-keeps-another-chat-out and message-history-peer-chat-keeps-other-chats-out (fail on develop); rig test_selfchat (passes on all four servers, guards end to end).
  • Proposed defensive fix: 737e26d28 (~20 lines): for a bare 1:1 page, keep a result only if it's ours to that JID (or ours with no to, Prosody's notes to self) or from that JID. test_message 722/722; whole tree 10217/1 (pre-existing calls flake); rig selfchat 3/3, catchup 20/20, carbons 5/5, history 4/4.
  • Affected: every version since the 2026-09-18 import.

Question for the reporter: does closing and reopening Saved messages (or restarting the app) make the foreign messages go away? If yes, the app side is more likely; if they persist, they're stored rows.

Investigation (GLaDOS, 2026-12-02), branch `fix/selfchat-leak` (not merged): - **Root cause (code, proven by a failing unit test):** when libtacky pages a 1:1 chat from the account's own archive (`history`, `goto`, `search`, `fetch` → `ParseResultNode` in message.tcl), it files every returned message under that chat without checking it is between us and that chat. Rooms and contacts' archives already have such a check. So any Saved-messages page (`with=<own bare JID>`) that brings back other messages files them into Saved — matching every detail of the report (peer avatar, single ticks, archive timestamps, no call rows). - **Not reproduced end to end:** ejabberd 26.09, Prosody 13, Openfire 5.1.2 and MongooseIM all filter `with=<own JID>` correctly on the rig; catch-up, paging, jump-by-date, OMEMO with 2–3 devices and history/0 stayed clean. What made the page return foreign messages in the field is still unknown (prod server patches? an app-side path?). - **Tests:** 135ae233f — unit `message-history-self-chat-keeps-another-chat-out` and `message-history-peer-chat-keeps-other-chats-out` (fail on develop); rig `test_selfchat` (passes on all four servers, guards end to end). - **Proposed defensive fix:** 737e26d28 (~20 lines): for a bare 1:1 page, keep a result only if it's ours to that JID (or ours with no `to`, Prosody's notes to self) or from that JID. test_message 722/722; whole tree 10217/1 (pre-existing calls flake); rig selfchat 3/3, catchup 20/20, carbons 5/5, history 4/4. - Affected: every version since the 2026-09-18 import. Question for the reporter: does closing and reopening Saved messages (or restarting the app) make the foreign messages go away? If yes, the app side is more likely; if they persist, they're stored rows.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
another-im/libtacky#71
No description provided.