fix(gateway): /compress destroys message identity, breaking dedup permanently #878

Closed
opened 2026-10-27 13:38:07 +00:00 by sam · 0 comments
Owner

applyCompress (session_commands.go:561-573) rebuilds retained head/tail turns as bare Message{From, Text}, dropping MessageID, SourceID and At. newMessageID with an empty SourceID returns a random UUID, so every protected message is deleted and re-inserted under a new identity with source_id NULL and _ts reset to now.

CONFIRMED by two independent reviewers, executed on BOTH backends. Before compress, redelivering tg-59 is a correct no-op (60 stays 60). After compress the same redelivery duplicates (24 -> 25). So archie-core-963's whole guarantee survives only until the first /compress -- after that, a Telegram 24h backlog replay on restart appends every surviving message a second time.

Also violates messaging-and-work-intake.md:88-90 (immutable application-generated MessageID) and 112-114 (immutable records), and dangles any branch-point correlation to the old IDs.

Blocks archie-core-963 and archie-core-0ua.


Imported from beads archie-core-1786637498907-345-c44f5f9e · GitHub #366 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08

applyCompress (session_commands.go:561-573) rebuilds retained head/tail turns as bare Message{From, Text}, dropping MessageID, SourceID and At. newMessageID with an empty SourceID returns a random UUID, so every protected message is deleted and re-inserted under a new identity with source_id NULL and _ts reset to now. CONFIRMED by two independent reviewers, executed on BOTH backends. Before compress, redelivering tg-59 is a correct no-op (60 stays 60). After compress the same redelivery duplicates (24 -> 25). So archie-core-963's whole guarantee survives only until the first /compress -- after that, a Telegram 24h backlog replay on restart appends every surviving message a second time. Also violates messaging-and-work-intake.md:88-90 (immutable application-generated MessageID) and 112-114 (immutable records), and dangles any branch-point correlation to the old IDs. Blocks archie-core-963 and archie-core-0ua. --- _Imported from beads `archie-core-1786637498907-345-c44f5f9e` · GitHub #366 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08_
sam added the mediumbug labels 2026-10-27 13:38:07 +00:00
sam self-assigned this 2026-10-27 13:38:07 +00:00
sam closed this issue 2026-10-27 13:38:07 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#878