Skip to content

Feature request: Support for message retention policies (m.room.retention) #367

@referi

Description

@referi

I would like to request support for message retention policies in Tuwunel, as defined in MSC1763: Add message retention policy to the specification (which has been merged into the Matrix specification and is implemented in servers like Synapse).

Currently, it is possible to set the m.room.retention state event in a room (e.g., {"max_lifetime": 60000} for 1 minute retention) using client developer tools (/devtools). The event is accepted and appears in the room state.

However, old messages are never automatically purged from the database, regardless of the configured max_lifetime value. This suggests that while the server accepts the state event, it does not actually process or act upon it.
Steps to reproduce

Create or join a room where you have sufficient permissions

Send /devtools in the room

Send a custom state event with:

    Type: m.room.retention

    Content: {"max_lifetime": 60000} (1 minute)

Send several test messages

Wait more than 1 minute

Restart the Tuwunel server (to potentially trigger background jobs)

Observe that all messages still exist in the room

Expected behavior

After the max_lifetime period has passed, messages older than that period should be automatically purged from the server's database and no longer be available to any client (in accordance with server-side retention policies).
Actual behavior

Messages remain indefinitely, regardless of the retention policy set in the room state.
Environment

Tuwunel version: [your version here]

Deployment method: Docker / native

Server configuration: Default, no retention-related settings in tuwunel.toml

Additional context

I have checked the admin bot commands (!admin help) and there are no commands related to retention or purge jobs. The only purge-related functionality I could find was for media (!admin media), not for historical room events.

This feature would be extremely valuable for:

Privacy-focused servers that want to automatically delete old messages

Servers with limited storage

Testing and development environments

Compliance with data retention regulations

Questions for discussion

Is there any plan to implement retention policy support in Tuwunel?

If not, would the project be open to contributions implementing MSC1763?

Are there any alternative ways to achieve automatic message deletion that I may have missed?

Thank you for considering this feature request!

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or functionality that didn't exist.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions