commet icon indicating copy to clipboard operation
commet copied to clipboard

Outbound Megolm keys not distributed to bridge bot devices in encrypted rooms

Open foxing-quietly opened this issue 8 months ago • 2 comments

Describe the bug

In encrypted rooms with a mautrix bridge bot, Commet does not share its outbound Megolm session keys with the bridge bot's device. The bridge bot cannot decrypt messages sent from Commet. Element works correctly in the same rooms with the same account.

This means:

  • Messages sent from Commet are not bridged (bridge bot responds: "Your message was not bridged: the bridge hasn't received the decryption keys")
  • Bridge bot commands (e.g. help) sent from Commet are not processed, since the bridge can't decrypt them
  • Messages sent from Element in the same room are bridged successfully
  • Incoming messages from Telegram users via the bridge are visible in Commet — so Commet can receive and decrypt the bridge bot's keys, just not the other way around

To Reproduce

  1. Have an encrypted room with a mautrix bridge bot (mautrix-telegram in my case)
  2. Open the room in both Commet and Element
  3. Send a message from Element → message is bridged successfully
  4. Send a message from Commet → bridge bot responds with decryption key error
  5. Receive a message from Telegram → visible in both Element and Commet

Expected behavior

Commet should distribute its outbound Megolm keys to all trusted devices in the room, including bridge bot devices — matching Element's behavior.

Additional context

  • Bridge: mautrix-telegram (Go rewrite) with self_sign: true enabled, so the bridge bot's device is cross-signed
  • Homeserver: Tuwunel
  • /discardsession does not resolve the issue
  • The bridge bot does not need user-level verification in Element for key sharing to work — Element shares keys with it based on the cross-signing trust chain alone
  • This may be related to how mautrix bridges encrypt all messages using the bridge bot's device on behalf of ghost users (the sender/device owner mismatch described in MSC4350). Element shows a cosmetic red shield warning for this but still shares keys; Commet may be excluding the bridge bot's device from outbound key distribution based on this mismatch.
Device Information

Device Platform: linux Version: v0.4.1 Git Hash: c2ee370d18c822673b24b6579842a01b971b1584 Detail: flatpak Build Timestamp: 1772620823192 (March 4, 2026)

System Info Name: GNOME Version: 48 (Flatpak runtime) Display Server: x11 Desktop Environment: x11

foxing-quietly avatar Mar 31 '26 19:03 foxing-quietly

Strange...I came back and logged in again and now the bot is working... I have no idea why. I'm not sure if I should close this issue or not or leave it open in case other's are encountering something similar.

As far as I can tell nothing was updated.

UPDATE: It looks like I need to use '!tg discard-megolm-session' with the bot and then log out and log in with commet, and then after taking several minutes to send the first message commet sends it and the bridge accepts it.

foxing-quietly avatar Mar 31 '26 20:03 foxing-quietly

Thanks.Definitely,I have the same issue.Just keep it open unless this bug was successfully fixed 😊

Funeralsawa avatar Apr 21 '26 10:04 Funeralsawa