Skip to content

Fix /sync failing when MSC4354 Sticky Events are enabled and the sync request filters out Ephemeral Data Units (EDUs).#19787

Merged
reivilibre merged 2 commits into
developfrom
rei/msc4354_sync_fix_ule
May 18, 2026
Merged

Fix /sync failing when MSC4354 Sticky Events are enabled and the sync request filters out Ephemeral Data Units (EDUs).#19787
reivilibre merged 2 commits into
developfrom
rei/msc4354_sync_fix_ule

Conversation

@reivilibre
Copy link
Copy Markdown
Contributor

@reivilibre reivilibre commented May 15, 2026

Fixes: #19779
Fixes: #19618

See also: #19786 (which would have caught this, but currently has too many findings to enable)

  1. Fix UnboundLocalError when MSC4354 is enabled in sync and all EDUs are filtered out

Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
@reivilibre reivilibre changed the title Fix /sync failing when [MSC4354 Sticky Events](https://github.com/matrix-org/matrix-spec-proposals/pull/4354) are enabled and the sync request filters out Ephemeral Data Units (EDUs). Fix /sync failing when MSC4354 Sticky Events are enabled and the sync request filters out Ephemeral Data Units (EDUs). May 15, 2026
@reivilibre reivilibre marked this pull request as ready for review May 15, 2026 14:49
@reivilibre reivilibre requested a review from a team as a code owner May 15, 2026 14:49
Comment thread synapse/handlers/sync.py
sticky_by_room: dict[str, list[str]] = {}
if self.hs_config.experimental.msc4354_enabled:
now_token, sticky_by_room = await self.sticky_events_by_room(
sync_result_builder, now_token, since_token
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To point this out more clearly, the problem is that now_token can be undefined when it's used here.

Comment thread changelog.d/19787.bugfix
@@ -0,0 +1 @@
Fix `/sync` failing when [MSC4354 Sticky Events](https://github.com/matrix-org/matrix-spec-proposals/pull/4354) are enabled and the sync request filters out Ephemeral Data Units (EDUs). No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like this was also reported at #19618

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.

Nicely spotted. fwiw I edited the description to add a second Fixes line as it seems GH doesn't pick up comma-separated ones.

@reivilibre reivilibre merged commit 4d0e4ff into develop May 18, 2026
110 of 116 checks passed
@reivilibre reivilibre deleted the rei/msc4354_sync_fix_ule branch May 18, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants