matrix-org / matrix-org/matrix-rust-sdk

Events lose sender profile after member leaves DM room

Open
#6,026 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

While testing reactions in a DM room, I ran into an unexpected behavior around sender profile resolution.

When the other participant leaves the room, previously received MessageLike events lose their resolved sender profile. The timeline item still references the sender MXID, but the associated profile data becomes empty:

```
EventTimelineItem {
sender: "@user:matrix.org",
sender_profile: Ready(
Profile {
display_name: None,
display_name_ambiguous: false,
avatar_url: None,
},
),
...
}
```

If the same user later rejoins the room, the SDK immediately rehydrates the profile information for the existing event, without the event itself changing:

```
EventTimelineItem {
sender: "@user:matrix.org",
sender_profile: Ready(
Profile {
display_name: Some("Display name"),
display_name_ambiguous: false,
avatar_url: None,
},
),
}
```

The same phenomenon was observed for state events. However, in that case, the sender’s display name is still available inside the event payload itself:

```
TimelineItem {
kind: Event(
EventTimelineItem {
sender: "@26uwjdyxbamf96wxty:...",
sender_profile: Ready(
Profile {
display_name: None,
display_name_ambiguous: false,
avatar_url: None,
},
),
timestamp: 2026-01-12T16:32:01.301,
content: MembershipChange(
RoomMembershipChange {
user_id: "@26uwjdyxbamf96wxty:...",
content: Original {
content: RoomMemberEventContent {
avatar_url: None,
displayname: Some(
"My user name...",
),
is_direct: None,
membership: "join",
third_party_invite: None,
blurhash: None,
reason: None,
join_authorized_via_users_server: None,
},
prev_content: Some(
RoomMemberEventContent {
avatar_url: None,
displayname: Some(
"My user name...",
),
is_direct: Some(
true,
),
membership: "invite",
third_party_invite: None,
blurhash: None,
reason: None,
join_authorized_via_users_server: None,
},
),
},
change: Some(
InvitationAccepted,
),
},
),
kind: Remote(
RemoteEventTimelineItem {
event_id: "$Udq8Xaz846b1XYLZQr5aa8ktJoHBXIoexusJta6cR7U",
transaction_id: None,
read_receipts: {},
is_own: false,
is_highlighted: false,
encryption_info: None,
origin: Pagination,
..
},
),
is_room_encrypted: false,
},
),
...
},
```

This was reproduced while testing directly against MatrixSDKFFI, the timeline example of the Matrix Rust SDK, and the same behavior can be observed in Element X, which relies on MatrixSDKFFI internally. The issue still occurs even if the two users share other rooms.

What’s confusing is that other timeline items (for example membership-related events) continue to expose the sender’s display name even after the user leaves the room. This makes reactions appear to be handled differently from other event types.

Is this loss of sender profile data an intentional design decision? From my understanding, it has a lot to do with the way the SDK parse the RoomMember event, and ignore the previous content, despite the fact it has the informations needed when a member leaves a room.
If not, we would be interested in retaining this information for our own use cases. Is this something the SDK would be open to supporting?

Thanks.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the behavior in MatrixSDKFFI or the Matrix Rust SDK timeline example, comparing MessageLike events with membership-related state events after a member leaves. Inspect RoomMember event parsing and handling of previous content, then determine whether sender profiles should remain available and define a regression check for the expected profile data.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.