Skip to content

fix: silent message loss after notification#7502

Draft
Rohit3523 wants to merge 3 commits into
developfrom
fix/message-loss-on-notification
Draft

fix: silent message loss after notification#7502
Rohit3523 wants to merge 3 commits into
developfrom
fix/message-loss-on-notification

Conversation

@Rohit3523

Copy link
Copy Markdown
Member

Proposed changes

Fixes three bugs that cause messages to arrive as push notifications but silently fail to appear in the chat view.

1. Encryption.decryptMessagesPromise.all kills entire db.write batch (E2E rooms)

Promise.all causes the entire db.write() callback to reject when any single message decryption throws. Promise.allSettled prevents one bad message from aborting the entire batch.

2. loadMissedMessages — fire-and-forget recursive pagination

The recursive call to load the next page was not awaited. If page 2+ fails (network timeout, server error), all subsequent messages are silently lost. Adding await ensures pages sequence correctly.

3. updateMessages / loadThreadMessagesdelete threadMessage.tmid corrupts input

The mutation runs before the msgsToCreate/msgsToUpdate closures execute during db.batch(), corrupting the original update array and thread-message update closures.

How to test or reproduce

  1. Enable E2E encryption. Send multiple messages — one failed decryption no longer aborts all writes.
  2. Have >50 unread messages, open via notification — all appear instead of only the first 50.
  3. Thread replies no longer corrupt the update array.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)

Checklist

  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

…on tap

1. decryptMessages Promise.all killed entire db.write batch when any
   single message threw during decryption. Switched to Promise.allSettled
   so one bad message can't abort all writes (affects E2E rooms).

2. loadMissedMessages recursive pagination was fire-and-forget (no await),
   so page 2+ silently failed. Added await so all pages are sequenced
   and rejections propagate visibly.

3. updateMessages and loadThreadMessages mutated the original update
   array's message objects with , corrupting
   tmid on references captured by msgsToCreate/msgsToUpdate closures.
   Removed the mutation — it was useless for the DB write and harmful
   to the input data.

closes issue with messages arriving as push notifications not appearing
in chat view (non-E2E: fire-and-forget pagination; E2E: batch abort).
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c71cc6ec-e2d6-422f-9e3d-b20bfb33b02d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Rohit3523
Rohit3523 deployed to approve_e2e_testing July 21, 2026 13:10 — with GitHub Actions Active
@Rohit3523
Rohit3523 deployed to ios_build July 21, 2026 13:14 — with GitHub Actions Active
@Rohit3523
Rohit3523 deployed to android_build July 21, 2026 13:14 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

iOS Build Available

Rocket.Chat 4.75.0.109386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant