Auto-join rooms when a knock is accepted#19958
Open
ara4n wants to merge 4 commits into
Open
Conversation
When an invite arrives for a user who has a pending knock in that room (i.e. the knock was accepted), automatically join the user rather than making them accept the resulting invite by hand (#16307). Detected by the invited user's own knock membership event appearing in the invite's auth events, which holds for local and federated invites alike. On by default (the user already asked to join by knocking); can be disabled with auto_accept_invites.enabled_for_accepted_knocks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uk8aPxHn3BHCe52L226jdG
…d events Instantiating the InviteAutoAccepter by default registered a third-party- rules on_new_event callback on every homeserver, which (a) added a state fetch per new event, perturbing db txn counts and sliding-sync test expectations, and (b) exposed a latent bug: the callback dispatcher fetched events without allow_rejected=True, so a rejected federation event raised NotFoundError out of the notifier and broke event persistence. Make enabled_for_accepted_knocks default off (matching auto_accept_invites.enabled) and fix the dispatcher to skip rejected events, with a regression test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uk8aPxHn3BHCe52L226jdG
A server-initiated join lands on all the user's devices in the same sync instant, so each would otherwise eagerly download the MSC4268 room key bundle. Send the most recently active device an org.matrix.msc4509.key_bundle_claim to-device hint (MSC4509) so exactly one device claims eagerly; the rest defer until first needed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uk8aPxHn3BHCe52L226jdG
ara4n
force-pushed
the
matthew/auto-join-on-knock-accept
branch
from
July 15, 2026 15:51
0950350 to
b618cc4
Compare
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.
When an invite arrives for a user who has a pending knock in that room (i.e. the knock was accepted), automatically join the user rather than making them accept the resulting invite by hand. Detected by the invited user's own knock membership event appearing in the invite's auth events, which holds for local and federated invites alike.
On by default (the user already asked to join by knocking); can be disabled with
auto_accept_invites.enabled_for_accepted_knocks.Fixes #16307
Implements MSC4509
Caveat: apparently when enabled this adds +3 db txns (db_txn_count) to every single event processed, because it uses the
InviteAutoAcceptermodule which registers anon_new_eventthird-party-rules callback which in turn adds a state fetch per event.Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.