Skip to content

Make sure calling /context on an out-of-band membership event doesn't 500#19959

Open
ara4n wants to merge 3 commits into
developfrom
matthew/context-oob-membership
Open

Make sure calling /context on an out-of-band membership event doesn't 500#19959
ara4n wants to merge 3 commits into
developfrom
matthew/context-oob-membership

Conversation

@ara4n

@ara4n ara4n commented Jul 14, 2026

Copy link
Copy Markdown
Member

An out-of-band membership event (e.g. an invite or knock received over federation) is an outlier with no stream position or state group, so computing surrounding events or state for it fails with 'No state group for unknown or outlier event'.

Visibility already permits the user to see their own out-of-band membership events, and clients legitimately fetch them, e.g. to render a push notification for an invite after the server has already joined the user (auto-accepted knock). Return the event with an empty context instead of erroring.

This is helpful for clients trying to reason about knocks where they might call /context on a state event ID - for instance, Element X iOS's push extension (NSE) calls /context on every event ID it gets, so if you send a state event for autojoining a room you've knocked in, this would have 500'd.

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

An out-of-band membership event (e.g. an invite or knock received over
federation) is an outlier with no stream position or state group, so
computing surrounding events or state for it fails with 'No state group
for unknown or outlier event'. Visibility already permits the user to
see their own out-of-band membership events, and clients legitimately
fetch them — e.g. to render a push notification for an invite after the
server has already joined the user (auto-accepted knock). Return the
event with an empty context instead of erroring.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uk8aPxHn3BHCe52L226jdG
@ara4n
ara4n requested a review from a team as a code owner July 14, 2026 16:08
@ara4n ara4n changed the title Return an out-of-band membership event from /context instead of a 500 Make sure calling /context on an out-of-band membership event doesn't 500 Jul 14, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uk8aPxHn3BHCe52L226jdG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants