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

MSC4267: Automatically forgetting rooms on leave #4267

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions proposals/4267-auto-forget.md
Copy link
Member

Choose a reason for hiding this comment

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

Implementation requirements:

  • Client
  • Server

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# MSC4267: Automatically forgetting rooms on leave
Copy link
Member

@ara4n ara4n Mar 11, 2025

Choose a reason for hiding this comment

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

This looks very sensible to me, fwiw. I don't think we need further proof of implementation between 2x servers, given it's also pretty trivial to envisage how it'd work; I suggest we FCP it.


Matrix discriminates between "leaving" and "forgetting" a room.
[`/_matrix/client/v3/rooms/{roomId}/leave`] stops a user participating in a room
but still allows them to retrieve history. A subsequent call to
[`/_matrix/client/v3/rooms/{roomId}/forget`] then stops the user from being able
to retrieve history.

Clients don't always differentiate these two operations in their UI and may only
offer leaving without forgetting a room. Thus, some servers automatically forget
rooms when a user leaves them in order to more aggressively free up their
resources. One example of this is the [`forget_rooms_on_leave`] config option in
Synapse.

The present proposal seeks to standaradize this proprietary behaviour.

## Proposal

When a user leaves a room, either through
[`/_matrix/client/v3/rooms/{roomId}/leave`] or by being kicked or banned,
Servers MAY automatically forget the room – as if the user had called
[`/_matrix/client/v3/rooms/{roomId}/forget`] themselves.

This can limit clients' options to maintain an archive of historic rooms (such
that they have left *without* forgetting them). Therefore, servers that
auto-forget rooms MUST advertise that they do so via an `m.forget_forced_upon_leave`
capability.

``` json5
{
"capabilities": {
"m.forget_forced_upon_leave": {
"enabled": true
}
}
}
```

A value of `true` means that the server performs auto-forget so that the client
cannot leave rooms without also forgetting them. A value of `false` means that
rooms will only be forgotten when the clients calls
[`/_matrix/client/v3/rooms/{roomId}/forget`].

When the capability is missing, clients SHOULD assume that the server does not
auto-forget.

## Potential issues

None.

## Alternatives

None.

## Security considerations

None.

## Unstable prefix

While this proposal is unstable, clients should refer to
`m.forget_forced_upon_leave` as `org.matrix.msc4267.forget_forced_upon_leave`.

## Dependencies

None.

[`/_matrix/client/v3/rooms/{roomId}/leave`]: https://spec.matrix.org/v1.13/client-server-api/#post_matrixclientv3roomsroomidleave
[`/_matrix/client/v3/rooms/{roomId}/forget`]: https://spec.matrix.org/v1.13/client-server-api/#post_matrixclientv3roomsroomidforget
[`forget_rooms_on_leave`]: https://github.com/element-hq/synapse/blob/12dc6b102f071eb2eb84f2cff4cf92903276ffbb/synapse/config/room.py#L88