Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC4171: Service members #4171

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
77 changes: 77 additions & 0 deletions proposals/4171-service-members.md
Copy link
Member Author

Choose a reason for hiding this comment

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

Apparently there was already a doc for this, probably should've looked for that before writing it myself 🙈 https://github.com/element-hq/element-meta/blob/develop/spec/functional_members.md

Copy link
Member

Choose a reason for hiding this comment

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

Probably just add this as a link somewhere in the MSC?

tulir marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# MSC4171: Service members
Copy link
Contributor

Choose a reason for hiding this comment

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

N.B. Element implements this in their "auditbot" integration, although the code is closed source.

Matrix has lots of bots for different use cases: simple chat bots, bridge bots,
administration bots, etc. Currently, such bots can't be added to DMs without
messing up the automatic room name and avatar calculation. [Canonical DMs] may
solve the issue eventually, but implementing those will likely take quite a
while due to the complexity of the system. This proposal is an intermediate
solution for bots before canonical DMs are fully implemented.

Copy link
Contributor

Choose a reason for hiding this comment

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

Of note is that this has been in use in Element since July 2021, so it's fairly well battle tested at this point.

[Canonical DMs]: https://github.com/matrix-org/matrix-spec-proposals/pull/2199

## Proposal
The proposed solution is a new state event: `m.member_hints`. The state event
has no state key and contains a field called `service_members` which is a list
of user IDs.

Any users (service members) listed there should not be considered when
computing the room name or avatar based on the member list. If the room only
tulir marked this conversation as resolved.
Show resolved Hide resolved
has two non-service members, then any additional DM-specific treatment should
be applied as well (for example, using 1:1 semantics for VoIP calls).

Servers SHOULD omit service members from the `m.heroes` section in `summary`
when calculating `/sync` responses. Clients MUST NOT expect that `m.heroes` is
the full list of users even when there are less than 5 members listed.

To prevent hiding encrypted message recipients, service members MUST still be
visible in the member list and membership events they send MUST be rendered if
other users' membership events are rendered.

Clients may include some special label for service members in the member list
tulir marked this conversation as resolved.
Show resolved Hide resolved
and/or other places in the room to make it clearer why they're not included in
the room name.

Any listed users who are not room members can be safely ignored. Simply being
on the list without actually being a room member has no special behavior.

tulir marked this conversation as resolved.
Show resolved Hide resolved
## Potential issues
Clients that don't support this MSC may still include the service members in
the room name calculation if they don't trust the `m.heroes` generated by the
server.

Clients that expect `m.heroes` to be a complete list for rooms with less than
5 members may be confused when the server omits service members. However, the
spec never mandated providing all members in small rooms, so this is not
technically a breaking change.

## Alternatives
Copy link
Contributor

Choose a reason for hiding this comment

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

also #4015 I think?

### Inverted user list
The state event could be inverted to list real members instead of service
members. This approach was not chosen for backwards-compatibility reasons: if
a user is invited with a client that doesn't know about this MSC, it's better
for bots to show up in the name than it is for real users to be hidden from the
name.
tulir marked this conversation as resolved.
Show resolved Hide resolved

While the use case in this MSC is primarily for DMs and small groups, an
inverted user list would completely prevent using the same event in larger
rooms, as the list would need to be updated on every join/leave. A list of bots
could be used for other purposes even in big rooms.

### Canonical DMs
The use cases of this proposal would be solved by canonical DMs. For example,
[MSC2199] defines "unimportant" users which would be excluded from room name
calculation and behave similar to service members in this proposal. However,
canonical DMs are much more complicated, while this proposal is relatively
simple to implement.

[MSC2199]: https://github.com/matrix-org/matrix-spec-proposals/pull/2199

## Security considerations
This MSC hides encrypted message recipients to some extent. However, as long as
the requirement to still show the members in the member list is followed, the
situation is no different than "hiding" members by injecting room name/avatar
events.

## Unstable prefix
Due to existing implementations, `io.element.functional_members` should be used
as the event type until this MSC is accepted. The field name (`service_members`)
is kept as-is.