fix: Bug - Sending files and attachment issues (cross-transport auto-download race)

Re-queue attachment auto-downloads when the chat message arrives, since
file-announce (WebRTC) can beat chat-message (websocket) and the announce-time
pass gives up on an unknown room. Gate stalled-download resets on chunk-progress
staleness so an active transfer is never cancelled mid-stream, which deadlocked
the retry against the sender's active-transfer dedupe.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-12 21:26:59 +02:00
co-authored by Cursor
parent 0078c320a5
commit 497033aff0
7 changed files with 118 additions and 16 deletions
@@ -382,7 +382,8 @@ export class AttachmentManagerService {
if (shouldResetStalledAttachmentDownload(
attachment,
this.transfer.hasPendingRequest(messageId, attachment.id)
this.transfer.hasPendingRequest(messageId, attachment.id),
Date.now()
)) {
this.transfer.cancelRequest(messageId, attachment);
} else if ((attachment.receivedBytes ?? 0) > 0) {