close
Skip to content

fix(latest event): mark a recoverable failure to send as a sending item#6016

Merged
bnjbvr merged 3 commits into
mainfrom
bnjbvr/sending-no-network-isnt-error
Jan 12, 2026
Merged

fix(latest event): mark a recoverable failure to send as a sending item#6016
bnjbvr merged 3 commits into
mainfrom
bnjbvr/sending-no-network-isnt-error

Conversation

@bnjbvr
Copy link
Copy Markdown
Contributor

@bnjbvr bnjbvr commented Jan 12, 2026

In the send queue, failures to send can be classified into two
categories:

  • permanent failures (e.g. invalid parameters)
  • recoverable failures (e.g. network is down; server responded with a
    transient error code)

The latest event system would classify all the failures as "cannot be
sent", which is slightly incorrect if the failure was recoverable. In
this case, we should still consider the local event as being sent, as
the system should try to send it some time soon.

I think this should fix element-hq/element-x-android#5885, I'll ask for some confirmation from one of the people who could repro the issue.

@bnjbvr bnjbvr requested a review from a team as a code owner January 12, 2026 14:36
@bnjbvr bnjbvr requested review from Hywan and removed request for a team January 12, 2026 14:36
@bnjbvr bnjbvr changed the title Bnjbvr/sending no network isnt error fix(latest event): mark a recoverable failure to send as a sending item Jan 12, 2026
Comment on lines +887 to +895
if *is_recoverable {
// If the room send queue error is recoverable, the send queue may retry to send
// it in a short while, so the event should still be considered
// sending. Leave it to that, at this point.
buffer_of_values_for_local_events.mark_is_sending_from(transaction_id);
} else {
// If the error isn't recoverable, mark as a true "cannot be sent".
buffer_of_values_for_local_events.mark_cannot_be_sent_from(transaction_id);
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix.

Copy link
Copy Markdown
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch! I believe it indeed fixes a bug. I left a small comment, but I'm approving ahead of time to save one review trip.

Comment thread crates/matrix-sdk/src/latest_events/latest_event.rs Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 12, 2026

Codecov Report

❌ Patch coverage is 95.83333% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.94%. Comparing base (7b16a32) to head (3364225).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rates/matrix-sdk/src/latest_events/latest_event.rs 95.23% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6016   +/-   ##
=======================================
  Coverage   88.94%   88.94%           
=======================================
  Files         357      357           
  Lines       99111    99146   +35     
  Branches    99111    99146   +35     
=======================================
+ Hits        88155    88189   +34     
+ Misses       6977     6975    -2     
- Partials     3979     3982    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

… sending

In the send queue, failures to send can be classified into two
categories:

- permanent failures (e.g. invalid parameters)
- recoverable failures (e.g. network is down; server responded with a
  transient error code)

The latest event system would classify all the failures as "cannot be
sent", which is slightly incorrect if the failure was recoverable. In
this case, we should still consider the local event as being sent, as
the system should try to send it some time soon.
@bnjbvr bnjbvr force-pushed the bnjbvr/sending-no-network-isnt-error branch from 0eeb084 to 3364225 Compare January 12, 2026 15:07
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jan 12, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing bnjbvr/sending-no-network-isnt-error (0eeb084) with main (b1ca2bb)

Summary

✅ 50 untouched benchmarks

@bnjbvr
Copy link
Copy Markdown
Contributor Author

bnjbvr commented Jan 12, 2026

@jmartinesp confirmed (thanks!) this fixes the symptoms observable in element-hq/element-x-android#5885. Merging now!

@bnjbvr bnjbvr merged commit 387df77 into main Jan 12, 2026
53 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/sending-no-network-isnt-error branch January 12, 2026 15:36
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.

Pending message is shown as "Message failed to send" in the room list

2 participants