Repository navigation
Conversation
sandhose
force-pushed
the
quenting/fix-forget-oob
branch
from
November 10, 2026 16:03
377f0aa to
fb83f1d
Compare
`RoomMemberHandler.forget` raised a 400 when the user's membership was
anything but `leave` or `ban`, and read that membership from the room's
current state. A remote invite, or a knock on a room the server is not
in, is an out-of-band membership: an outlier that never enters the room
state. The lookup returned nothing, the guard did not fire, and
`POST /rooms/{roomId}/forget` returned 200 and hid the room from every
sync flavour while the invite or knock was still pending on the remote
side. A server in the room returns 400 for the same call.
`forget` now reads the membership from `local_current_membership`
alone. For a local user that table is written in the same transaction
as `current_state_events`, from the same delta, and additionally for
out-of-band memberships. The room's current state is deleted when the
server leaves the room. The two can therefore only disagree in the
out-of-band direction (room state empty, `local_current_membership`
holding the invite or knock), so the room-state lookup adds nothing.
`forget` is only called for local users, which
`get_local_current_membership_for_user_in_room` requires.
A user who rejected the invite or rescinded the knock has a `leave`
there and can still forget. The internal callers (`forget_rooms_on_leave`,
deactivation, room shutdown) forget after the leave is persisted, so they
are unaffected. The error message and errcode are unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Usuxv8JofVGciXVtxbdTtr
sandhose
force-pushed
the
quenting/fix-forget-oob
branch
from
November 17, 2026 17:56
fb83f1d to
3c02f52
Compare
This branch has not been deployed
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.
More internal context here
/rooms/{roomId}/forgethas to fail while the user is still invited or knocking. It does when the server is in the room (400), but for an invite or knock in a room the server is not in it returned 200 and hid the room from every sync flavour, while the invite stayed pending on the other side.RoomMemberHandler.forgetread the membership from the room's current state, which an out-of-band invite or knock never enters. It now readslocal_current_membership, which is written in the same transaction ascurrent_state_eventsand also for out-of-band memberships.forgetis only called for local users, so the room-state lookup was redundant. A rejected invite or rescinded knock is aleavethere and can still be forgotten.ForgetOutOfBandMembershipTestCaseintests/handlers/test_room_member.py: a pending remote invite and a pending knock get 400 (200 on develop), and forgetting after rejecting the invite still works.Pull Request Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01Usuxv8JofVGciXVtxbdTtr