Conversations: merged rows stay on 'Merging…' until the app restarts when the push doesn't reach the running app
Product impact
- Primary loop layer: Memory
- [x] Involves data loss, failed capture, or broken sync/trust
Describe the bug
After a merge, the involved rows stay on "Merging…" until the merge_completed push reaches the running app. The
local mergingConversationIds set is cleared only by onMergeCompleted, which listens to
MergeNotificationHandler.onMergeCompleted, and by clearUserData (sign-out). Pull to refresh does not clear it.
When the push never reaches the UI isolate, the rows stay stuck: while merging they cannot be selected, long-pressed or swiped, and the merged result doesn't appear, until the app is restarted. That happens when notifications are off, when a push is lost, and when the push arrives while the app is in the background. The background FCM handler runs in its own isolate, so its broadcast has no listener in the app's isolate.
To reproduce
- Select two conversations → Merge.
- Either switch notifications off first, or send the app to the background until the merge finishes.
- Return to Conversations and pull to refresh.
Current behavior
The rows keep the pulsing "Merging…" state and stay locked until the app restarts.
Expected behavior
The rows settle once the server finishes the merge, with or without the push: the survivor replaces them and the removed ones disappear.
Evidence
lib/providers/conversation_provider.dart:1922:onMergeCompletedis the only place (besides sign-out at:294) that removes ids frommergingConversationIds.lib/providers/conversation_provider.dart:273: it runs only from the push stream.lib/main.dart:152: the background handler broadcastsmerge_completedfrom the background isolate.
Suggested fix
After starting a merge, also poll the involved conversations until none is merging (bounded), then apply the same result as the push, or hand the rows back to a list refresh.
Fix available
Fixed with tests on the fork branch design/v2-step0-tokens (043db6c3cc, conversation_provider_merge_watch_test.dart, 5 cases). It will be linked from the draft PR.
Found while testing the Omi v2 Flutter restyle on an iPhone, then confirmed against main at 32c2ed22cf.
Submitted fix in PR #21417 with comprehensive unit tests for merge settling without push delivery.