Skip to content

Reintroduce #19714 - Send a SSS response immediately if the config has changed#19792

Merged
erikjohnston merged 10 commits into
developfrom
erikj/sss_immediately
Jun 8, 2026
Merged

Reintroduce #19714 - Send a SSS response immediately if the config has changed#19792
erikjohnston merged 10 commits into
developfrom
erikj/sss_immediately

Conversation

@erikjohnston

@erikjohnston erikjohnston commented May 20, 2026

Copy link
Copy Markdown
Member

Reintroduces #19714, after being reverted in #19784.

Fix #18844
Fix #19783
Fix #18880

This PR also adds a fix so that we don't always return immediately when using the e2ee extension.

bnjbvr and others added 4 commits May 20, 2026 13:54
…re new results to sync (#19714)

This fixes the bug described in #19713 (and double-checked against the
SDK integration test, which now passes with this change). A sync
response must be returned immediately if a room subscription
configuration change caused a new non-empty response (checked with `if
response` in the code) to be produced.

Fixes #19713.
Fixes #18844.

---------

Co-authored-by: Erik Johnston <erik@matrix.org>
Comment thread synapse/types/handlers/sliding_sync.py Outdated

@reivilibre reivilibre left a comment

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.

Thanks!

Comment thread changelog.d/19792.bugfix Outdated
Comment thread changelog.d/19792.bugfix Outdated
Comment thread synapse/types/handlers/sliding_sync.py Outdated
Comment on lines +304 to +314
# Note that "signed_curve25519" is always returned in key count responses
# regardless of whether we uploaded any keys for it. This is necessary until
# https://github.com/matrix-org/matrix-doc/issues/3298 is fixed.
#
# Also related:
# https://github.com/element-hq/element-android/issues/3725 and
# https://github.com/matrix-org/synapse/issues/10456
default_otk = self.device_one_time_keys_count.get("signed_curve25519")
more_than_default_otk = len(self.device_one_time_keys_count) > 1 or (
default_otk is not None and default_otk > 0
)
#
# This is why we don't incorporate `device_one_time_keys_count`
# (or `device_unused_fallback_key_types`) into the
# `__bool__` check.

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.

This seems more like a workaround than a fix. Ideally, we would immediately respond if these things changed. The risk is that the one-time keys could be exhausted without the users /sync waking up and knowing to add more. We should at-least add a FIXME here and justification for why we think it's fine.

@reivilibre reivilibre Jun 1, 2026

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.

(I guess that justification would be that 30s is a short window of staleness and that we have fallback keys available.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've noted that this is not the ideal situation in 2edfbe2

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.

We can do better:

  • There should be a FIXME in the comment to clearly point out the wrong-ness
  • We should explain the risk and the justification for why we think its fine.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

591f8c7 has a fixme and roughly says why its fine for the changes to be delayed

Comment thread tests/rest/client/sliding_sync/test_extension_e2ee.py
Follow on from #19714, where we should have had an extra comment and
test.

Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
@erikjohnston

Copy link
Copy Markdown
Member Author

I've merged in #19734

@MadLittleMods MadLittleMods left a comment

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.

(approved in terms of the specific review things I pointed out)

Comment thread synapse/types/handlers/sliding_sync.py Outdated
Co-authored-by: Eric Eastwood <erice@element.io>
@erikjohnston erikjohnston merged commit 8c9b1ff into develop Jun 8, 2026
50 of 51 checks passed
@erikjohnston erikjohnston deleted the erikj/sss_immediately branch June 8, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

4 participants