V1.0.0: An invite delivered after an instance update drops the update from the attendee's copy

Issue Description

An organizer creates a weekly series with a local attendee, then right away moves one instance (a PUT adding an override with RECURRENCE-ID). Stalwart queues two iMIP mails for the attendee: the invite (METHOD:REQUEST, master, SEQUENCE:0) and the update (METHOD:REQUEST, only the moved instance, SEQUENCE:1). They can be delivered in either order. When the update arrives first, the invite that follows replaces the attendee’s copy and the moved instance is gone.

Expected Behavior

RFC 5546 §2.1.5: revisions are ordered by SEQUENCE, so an older component should not replace a newer one. The attendee’s copy should keep the override (SEQUENCE:1) when the invite (SEQUENCE:0) arrives after it, and end up with the master plus the moved instance, the same as when the invite arrives first.

Actual Behavior

Order of arrival Attendee’s copy afterwards
invite, then update master + moved instance
update, then invite master only

Both mails are in the Inbox with X-Spam-Status: No in both orders, so iTIP ingest runs for both.

Reproduction Steps

  1. Fresh stalwartlabs/stalwart:v1.0.0 container, RocksDB, internal directory. Create an organizer and attendees A, B and C on one domain.
  2. As the organizer, PUT a weekly series (RRULE:FREQ=WEEKLY;BYDAY=TU, SEQUENCE:0) with A as attendee. Then PUT the same object with an override that moves one instance two hours later.
  3. A receives the two iMIP mails. Copy their text/calendar parts, with A’s address replaced by B’s (and by C’s).
  4. Over authenticated submission (port 465, as the organizer), send B the update, then 2 s later the invite. Send C the invite, then the update.
  5. GET B’s and C’s copies. C has the master and the override; B has only the master. Same result in 3 of 3 runs.

Stalwart Version

v1.x

Installation Method

Docker

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

Additional Context

In our CI, an organizer that moves an instance right after creating the series loses the move for one attendee in about 1 run in 4. We did not test whether 0.16 ingests the same way. It also sends iMIP through the task queue, but our 0.16 CI never hit it.

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

The cause is in the server source, not in your setup. I haven’t run your repro.

In crates/groupware/src/scheduling/inbound.rs, itip_process_message handles METHOD:REQUEST in two steps:

  1. Per-component merge. For each component in the incoming iTIP message that also exists in the attendee’s copy, it compares SEQUENCE. If the incoming one is lower, it returns ItipError::OutOfSequence. That check works as RFC 5546 describes.
  2. Full-update cleanup. If the incoming message contains the master (InstanceId::Main), it treats the message as a full update. It then emits MergeAction::RemoveComponent for every instance in the stored copy that the message doesn’t contain. This step has no SEQUENCE comparison.

In your “update, then invite” order, the stored copy has the master plus the override at SEQUENCE:1. The late invite carries only the master at SEQUENCE:0. The master comparison fails, so I’d expect OutOfSequence. But the override isn’t in the invite, and I can’t tell from this excerpt whether the cleanup step still runs. That would explain your result, so it’s worth checking.

The other order (invite, then update) works because the update has no master, so the cleanup never runs.

The “update arrives first” case also depends on how the attendee’s copy is created when the update lands with no existing event. I haven’t traced that path. The delivery order itself comes from the iMIP task queue sending the two messages independently. I didn’t confirm whether anything orders them.

This looks like a real bug. I’m not aware of a workaround on the Stalwart side. A human will follow up here.

Relevant code: crates/groupware/src/scheduling/inbound.rs, itip_process_message, the ICalendarMethod::Request branch.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Hi Dominik,

When a REQUEST carrying the master arrived, the attendee side treated it as a full replacement and removed every stored instance missing from it, without comparing SEQUENCE. So when the moved instance (SEQUENCE:1) landed first, the older invite (SEQUENCE:0) wiped it, which is exactly the RFC 5546 §2.1.5 case you quoted.

An instance missing from such a REQUEST is now removed only when its SEQUENCE isn’t higher than the incoming master’s. In your test, B ends up with the master plus the moved instance, the same as C. A newer series update that drops the override still removes it. The fix ships in the next weekly Stalwart release.