Skip to content

MSC4140: Cancellable delayed events#4140

Open
toger5 wants to merge 201 commits into
mainfrom
toger5/expiring-events-keep-alive
Open

MSC4140: Cancellable delayed events#4140
toger5 wants to merge 201 commits into
mainfrom
toger5/expiring-events-keep-alive

Conversation

@toger5

@toger5 toger5 commented May 7, 2024

Copy link
Copy Markdown

Rendered

This could also supersede MSC2228 (by making it possible to send a redaction with the /send endpoint. This is the case as mentioned here)

Implementations

Known differences between current implementations and the proposal

  • The implementations use the error code M_MAX_DELAY_EXCEEDED and a response property max_delay when the server refuses to schedule an event because the requested delay is too large. The proposal has since switched to the error code M_INVALID_PARAM and publishes the maximum allowed delay in the m.delayed_events capability (so that clients can discover it ahead of making the request).
  • The implementations use the existing endpoints /send and /state with a new query parameter delay for scheduling delayed events. The proposal has since switched to a dedicated endpoint PUT /_matrix/client/v3/rooms/{roomId}/delayed_event/{eventType}/{txnId} where the delay is included in the request body.

Implementations in Element Call via the Widget API

These are only informational and shouldn't be relevant for the proposal process. The MSC doesn't depend on widgets and widgets are themselves not part of the spec.


SCT stuff:

checklist

FCP not yet started

Blocked: #4140 (comment)

toger5 added 2 commits May 7, 2024 18:52
Signed-off-by: Timo K <toger5@hotmail.de>
Signed-off-by: Timo K <toger5@hotmail.de>
@toger5 toger5 force-pushed the toger5/expiring-events-keep-alive branch from 2bc07c4 to 0eb1abc Compare May 7, 2024 17:03
Signed-off-by: Timo K <toger5@hotmail.de>
@toger5 toger5 force-pushed the toger5/expiring-events-keep-alive branch from 0eb1abc to 8bf6db7 Compare May 8, 2024 15:49
Signed-off-by: Timo K <toger5@hotmail.de>
Comment thread proposals/4140-expiring-events-with-keep-alive-endpoint.md Outdated
Comment thread proposals/4140-expiring-events-with-keep-alive-endpoint.md Outdated
Comment thread proposals/4140-expiring-events-with-keep-alive-endpoint.md Outdated
Comment thread proposals/4140-expiring-events-with-keep-alive-endpoint.md Outdated
Comment thread proposals/4140-expiring-events-with-keep-alive-endpoint.md Outdated
Comment thread proposals/4140-expiring-events-with-keep-alive-endpoint.md Outdated
Comment thread proposals/4140-expiring-events-with-keep-alive-endpoint.md Outdated
Comment thread proposals/4140-expiring-events-with-keep-alive-endpoint.md Outdated
Comment thread proposals/4140-expiring-events-with-keep-alive-endpoint.md Outdated
Signed-off-by: Timo K <toger5@hotmail.de>
@turt2live turt2live changed the title Draft for expiring event PR MSC4140: Expiring events with keep alive endpoint May 9, 2024
@turt2live turt2live added proposal A matrix spec change proposal. Process state. A-Client Server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels May 9, 2024
@toger5 toger5 force-pushed the toger5/expiring-events-keep-alive branch from 3e54c2a to c82adf7 Compare May 10, 2024 17:54
Signed-off-by: Timo K <toger5@hotmail.de>
@toger5 toger5 force-pushed the toger5/expiring-events-keep-alive branch from c82adf7 to 54fff99 Compare May 10, 2024 18:08
toger5 added 3 commits May 13, 2024 16:56
…is used to trigger on of the actions

Signed-off-by: Timo K <toger5@hotmail.de>
Signed-off-by: Timo K <toger5@hotmail.de>
Add event type to the body
Add event id template variable
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
toger5 and others added 2 commits May 31, 2024 09:20
Co-authored-by: Andrew Ferrazzutti <af_0_af@hotmail.com>
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Comment thread proposals/4140-delayed-events-futures.md Outdated
Johennes and others added 8 commits June 3, 2026 13:34
The bulk lookup no longer includes finalised delayed events, so note
that the returned items won't have fields exclusive to finalised events.
The bulk lookup no longer includes finalised delayed events, so don't
include it in the regex of endpoints that may discard a finalised event
upon retrieving it.  Now only the single-item lookup may do this.
Comment thread proposals/4140-delayed-events-futures.md Outdated

#### `delay_id` in `unsigned` event data
The `delay_id` of a sent delayed event MUST be included in the resulting room event's `unsigned` data
if, and only if, the client being given the event is authenticated as the event's sender.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you help me understand this, please ? The unsigned data is part of the PDU sent to the room, correct ? Its content does not depend on the client receiving it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The unsigned data is part of the PDU sent to the room, correct ? Its content does not depend on the client receiving it.

Not quite; servers can restrict which fields of a persisted event that a client may receive. Prior art is how various CS-API endpoints withhold an event's transaction ID from all but the user who sent the event. This is codified in the spec as responses that include a transaction_id field "if the client being given the event is the same one which sent it."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I see. It would be helpful if the spec (and also this MSC) were a bit more clear on how this is done. As it's currently specified, this result could be achieved by putting the field in the PDU and then having the homeserver filter it out if needed when sending it to the client; or by not putting it in the PDU, and having the homeserver add it if needed when sending it to the client.

If I understand you correctly, it should be the first one ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If I'm not mistaken, PDUs are solely for server-server communication, and thus they don't need to carry delay_ids at all due to delayed events not being federated.

As it's currently specified, this result could be achieved by putting the field in the PDU and then having the homeserver filter it out if needed when sending it to the client

This is pretty much how it's done in Synapse now, except the event is stored as ad-hoc internal representation instead of a "formal" PDU. When formatting the event in responses, the server decides which fields to include depending on the user requesting it.

Comment thread proposals/4140-delayed-events-futures.md
to be consistent with how most other specced timestamp-valued fields
have a name ending in `_ts`

The body for requests to this endpoint is a JSON object containing the following fields:

- `delay` - Required. A positive non-zero number of milliseconds the homeserver should wait before sending the event.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there any interest in renaming this to delay_ms, to make it crystal clear that the value is in milliseconds?

If this were to be renamed, then so too should the delay field in responses to the GET endpoints.

Additionally, the max_delay in the new capability would then benefit from being renamed to max_delay_ms.

For comparison, the names of most other specced millisecond-valued fields/parameters end with _ms, with the following exceptions:

  • the unsigned.age field in events (ref)
  • the timeout query parameter for /sync (ref)
    • Amusingly, there is also a parameter named timeout_ms used by the Content Repository module (ref)
  • the info.duration field in m.audio & m.video events (ref)
  • the lifetime field in m.call.invite and m.call.negotiate events (ref)
  • the timeout body parameter in /typing/{userId} (ref)
  • The last_active_ago field in m.presence events (ref)


### Alternative to `running_since` field

Some alternatives for the `running_since` field on the `GET` response are:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At the risk of bikeshedding, how does scheduled_at sound? Or at least something suffixed with _at, which the spec uses for a few other timestamp-valued fields.

I also feel that scheduled_at is less likely than scheduled_ts to be misinterpreted as the intended send time of the event, and thus is a good opportunity to put scheduled in the name, which is an existing keyword used elsewhere in this module, instead of having to introduce a new term (like "running" or "created").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00-weekly-pings Tracking for weekly pings in the SCT office. 00 to make it first in the labels list. A-Client Server Client-Server API A-VOIP implementation-needs-checking The MSC has an implementation, but the SCT has not yet checked it. Process state. kind:feature MSC for not-core and not-maintenance stuff matrix-2.0 Required for Matrix 2.0 (note: do not rename - used in reports/links) proposal A matrix spec change proposal. Process state.

Projects

Status: Proposed for FCP readiness

Development

Successfully merging this pull request may close these issues.