Clear peer-scoped retry state on acks without a conversation

After force-quit -> relaunch the durable outbox is restored while the
in-memory conversation store is not. updateAcknowledgedMessageDeliveryStatus
gated the router-side clear on the conversation lookup, so a delivery ack
for a retried message was discarded and the already-delivered message
re-sent on every flush/auth event until the attempt cap marked it failed.

Always run the peer-scoped router clear (markDelivered(_:from:) only
terminalizes the acking peer's own queues); gate only the UI status
transition and the media-retry release on the conversation holding the
message, mirroring the Nostr path in
ChatPrivateConversationCoordinator.handleDelivered.

Also drop the dead allowedPeerIDs parameter on
MessageRouter.clearRetainedMessage (only ever called with nil; its filter
branch paired a scoped in-memory removal with an unscoped store tombstone)
and the redundant manual ==/hash on PeerMessageKey.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jack
2026-07-26 14:26:38 +02:00
co-authored by Claude Opus 4.8
parent a30c7078a2
commit ffc90fe771
4 changed files with 119 additions and 34 deletions
@@ -750,6 +750,7 @@ private final class PerfDeliveryContext: ChatDeliveryContext {
func notifyUIChanged() {}
func markMessageDelivered(_ messageID: String) {}
func markMessageDelivered(_ messageID: String, from peerIDs: Set<PeerID>) {}
func confirmPrivateMediaDelivery(_ messageID: String) {}
func isOutgoingPrivateMessage(_ messageID: String, toAny peerIDs: Set<PeerID>) -> Bool {
true
}