Re-tell the delivery key when a told peer writes unsealed

Mirror of the iOS change: the poll path un-marks a toldPeer whose
message arrived unsealed — their copy of our key is gone, and the next
send re-tells it. Same staleness class, and same cure, as the avatar
marker.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Paul Hitt
2026-08-28 17:44:05 -04:00
co-authored by Claude Fable 5
parent 4e6aedf5f0
commit b6557d6409
@@ -613,6 +613,19 @@ class Conversations(
val fromUser = opened?.claimedFromUser ?: message.fromUser
val content = Content.parse(plaintext)
consumeControl(fromUser, content)
// 🔴 An UNSEALED message from a contact we have told our
// delivery key means their copy is gone — a reinstall wiped
// it. Sealing to us requires that key, and a peer who holds
// it seals everything. Un-mark them so the next send re-tells
// it; until then the relay sees their sender on every message
// they write us. Worst case: one redundant control envelope.
if (!sealed && fromUser != 0L) {
vault.loadDelivery()?.let { d ->
if (fromUser in d.toldPeers) {
vault.saveDelivery(d.copy(toldPeers = d.toldPeers - fromUser))
}
}
}
out += Received(message.id, fromUser, fromDevice, content,
sealed = sealed, at = message.createdAt)
} catch (_: Exception) {