Skip to content

Commit 4f26338

Browse files
alltheseasclaude
andcommitted
fix: relay confirmation before merge and welcome (MIP-02/MIP-03)
Rewrite add_member_device and remove_member_device to defer merge_pending_commit until after relay confirmation, matching MDK's documented ordering requirement. Before: merge locally → fire-and-forget publish → send welcomes After: create commit → return immediately → background: relay publish with retries → merge → send welcomes → UI update The Tauri command returns immediately (no UX blocking). A new publish_event_with_retries helper provides 5-attempt exponential backoff matching pika core's pattern. This prevents permanent group state divergence when all relays reject the commit, and ensures welcomes reference a commit that is actually available on relays (MIP-02). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a8bb6bf commit 4f26338

3 files changed

Lines changed: 344 additions & 160 deletions

File tree

src-tauri/src/commands/mls.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,7 @@ pub async fn invite_member_to_group(
653653
.await
654654
.map_err(|e| format!("Task join error: {}", e))??;
655655

656-
// Sync participants array after adding members
657-
sync_mls_group_participants(group_id).await?;
656+
// Participant sync happens inside the background task after merge completes
658657

659658
Ok(())
660659
}
@@ -681,8 +680,7 @@ pub async fn remove_mls_member_device(
681680
.await
682681
.map_err(|e| format!("Task join error: {}", e))??;
683682

684-
// Sync participants array after removing member
685-
sync_mls_group_participants(group_id).await?;
683+
// Participant sync happens inside the background task after merge completes
686684

687685
Ok(())
688686
}

0 commit comments

Comments
 (0)