fix(reactions): leave unsent messages out of the reaction refresh - #1676
Merged
Merged
Conversation
A pending or failed send is stored with messageId = -(now), and MessageList collects every row's id for the refresh. One in a batch fails the MessageId rule (>= 1) for the whole getReactionSummariesByIds request, so a failed send in the newest 60 rows blocked the open/resume refresh for that chat until it was retried or deleted. Seen in the log of Bugsnag 6ac2ccde396a2e952063917a: "message_ids[0].value: must be greater than or equal to 1" a second after a send failed. ReactionRefreshPlanner now drops ids below 1 in both entry points. The real id arrives with the server echo and pages in as a new id.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A pending or failed send is stored with
messageId = -(now), andMessageList.newestFirstMessageIds()collects every row's id for the reaction refresh. One negative id fails theMessageIdrule (>= 1) for the wholegetReactionSummariesByIdsbatch. A failed send in the newest 60 rows therefore blocked the open/resume refresh for that chat until the send was retried or deleted. The new-rows hook also sent the unsent row's id on its own as soon as it appeared.Seen in the log of Bugsnag 6ac2ccde396a2e952063917a (2026.9.4):
ValidationException: message_ids.message_ids[0].value: must be greater than or equal to 1, a second after a send failed withDenied. Deobfuscated, the stack runsChatViewModel(RefreshReactionIds) →ReactionsDelegate.refreshReactions→ChatMessagingController→ChatMessagingService.ReactionRefreshPlannernow drops ids below 1 ininitialWindowandforLoadedPage. The window filters before it takes, so it still covers 60 real messages. An unsent message has no reactions to fetch; its real id arrives with the server echo and pages in as a new id.iOS is unaffected: its unsent rows use
MessageID.unassigned(UInt64.max).Related: #1671 fixes the crash in the same event.