Skip to content

bug(android): original conversations remain after merged conversation appears #20603

Closed

Description

@aryanorastar

Report

Featurebase report “Conversation Merge Does Not Complete Correctly” (Marcio Vieira; Android, one requester): merging two or more recorded conversations stays in the “Merging…” state while the app remains open. After force-closing and reopening, the merged conversation appears, but the original separate conversations also remain in the list.

The stuck in-session state overlaps #19247, which tracks merge completion being dependent on a push reaching the running app. This issue tracks the distinct post-restart symptom: both the merged result and its source conversations remain visible. Do not assume whether this is server-side incomplete deletion or client-side stale listing without checking the records.

Expected

When a merge succeeds, the merged conversation appears and its source conversations no longer appear separately. The list should settle without restarting the app.

Investigation

  • Reproduce on a current Android build; test merge completion while app stays foreground, while backgrounded, and with notification delivery unavailable.
  • Compare server state and a fresh conversation-list API response against the app's visible list after restart.
  • Verify that source deletion completed before merge completion was reported, and that partial failures do not leave a misleading completed merged row.
  • Check cache/pagination refresh and event reconciliation; ensure retries are idempotent and preserve transcript/audio integrity.
  • Add regression coverage for the post-restart “merged + originals” state as distinct from Conversations: merged rows stay on 'Merging…' until the app restarts when the push doesn't reach the running app #19247's stuck local “Merging…” state.

Details needed

Android and Omi app versions, approximate merge date/time and timezone, whether a pull-to-refresh changes the list, and conversation IDs sent privately to support. Avoid sharing transcript or audio content in public comments.

Activity

  1. added
    bug
    needs-info
    p2
    on Oct 4, 2026
  2. featurebase-for-github commented on Oct 4, 2026

    @featurebase-for-github

    This issue is linked to our feedback platform. For feedback and updates, please visit this link.

  3. sprintstate commented on Oct 4, 2026

    @sprintstate

    I found a reproducible code-level false-success path relevant to this investigation. This is not confirmation of the reporter's root cause.

    On main f652ccbefc8ee7968464a9e7a544f6e34d433fba, the final document-deletion exception handler logs the failure and returns normally. The merge caller can consequently continue to manual_merge and the success notification even though a source document was not deleted.

    I tested the exact helper extracted from that revision, with all database/storage/memory effects mocked. Injecting RuntimeError("synthetic database unavailable") into the final delete produces AssertionError: RuntimeError not raised for both purge_sync_sources=True and False. No account data or live services were accessed, and I have not reproduced the Android report end to end. I also checked the overlapping open #15953 and #19978; their current patches do not propagate this final deletion failure.

    Would you approve a $25 USD bounty for a focused fix and regression coverage of this false-success path? Proposed scope: propagate authoritative source-document deletion failure, prevent the success notification/outcome in that case, and verify the existing failure-phase rule preserves the merged target once destructive source cleanup has begun. Best-effort artifact cleanup would keep its current policy. Full historical-record repair, durable retry design, and confirmation of the reporter's recovery remain separate work; this change alone should not close #20603.

    This is an AI-assisted proposal, not a completed PR or an approved reward. PayPal or my existing GitHub Sponsors listing can receive an agreed payout. Please confirm the scope and reward before implementation.

  4. sprintstate commented on Oct 5, 2026

    @sprintstate

    @josancamon19 Following my earlier bounty proposal, I now have a reviewable local prototype and regression tests for the specific source-deletion false-success path, based on 9a078331b421b23394af6781f44b983920f68d18.

    The new tests execute the actual merge worker and cleanup helpers with mocked I/O. Removing the fix gives 4 failed, 5 passed; restoring it gives 9 passed. They cover both deletion branches, failure on either source, preserving the merged target after cleanup starts, withholding success, and the existing best-effort artifact policy. Three adjacent test files also pass: 48 + 8 + 29 cases. The patch applies cleanly to the stated base.

    This remains a prototype, not a completed PR or confirmation of the Android reporter's root cause. Full repository checks and real endpoint testing remain unfinished; the offline harness currently needs Java, Redis-server and Typesense prerequisites. The Gist lists those limits. This change alone should not close #20603.

    Could you confirm whether this focused fix is an eligible $25 USD paid task, with PayPal payout, before I finish the remaining contribution checks? No reward or assignment is assumed.

  5. Dragonire9 commented on Oct 14, 2026

    @Dragonire9
    Contributor

    I have submitted the complete fix and hermetic regression test suite in PR #21525 (#21525).

    Summary of Changes:

    1. Root Cause: _delete_conversation_and_related_data in backend/utils/conversations/merge_conversations.py caught and logged exceptions during conversation document deletion without re-raising. The merge worker continued to record_capture_outcome('manual_merge') and send_merge_completed_message, leaving undeleted source conversations active alongside the merged target.
    2. Propagate Authoritative Deletion Failure: Re-raised exceptions from conversation document deletion so the merge worker enters _handle_merge_failure.
    3. Safe Failure Semantics:
      • Merged target is preserved (MergeFailurePhase.SOURCE_DELETION_STARTED) to prevent data loss after source cleanup has begun.
      • manual_merge outcome recording and FCM completion notifications are strictly withheld.
      • Source conversation statuses are reset back to completed.
      • Best-effort artifact cleanup (action items, photos, audio, vectors) remains non-blocking.
    4. Hermetic Regression Test Suite: Added backend/tests/unit/test_merge_source_delete_failure.py covering deletion propagation, target preservation, withholding of completion notification/outcome, sequential deletion requirements, and best-effort artifact handling.

    Payout Details:

    • PayPal: [email protected] / https://paypal.me/Dragonire9
  6. aryanorastar commented on Oct 26, 2026

    @aryanorastar
    CollaboratorAuthor

    Closing the technical issue as completed on main by #21417, merged in 2ea1cf8.

    The landed fix covers completion without push, restart recovery, durable same-target cleanup retry, and list/search/pagination/cache reconciliation. Concurrent completions now preserve both targets across offline reopening, with unrelated Undo rows and account/backend fences preserved. Authoritative source-deletion failure already propagates on main and withholds false merge success; #21525 is not required to supply that guard.

    The verified PR head f66450e is an ancestor of current main. Required CI passed, including 7,640 Dart tests (four skipped), backend shards and seeded journeys; focused local and Firestore-emulator recovery coverage is recorded in #21417. The main merge/cache/journal implementation retains that verified behavior.

    Backend deployment and mobile-release availability have not been verified in this closure. Those rollout checks and any historical-account recovery/customer confirmation remain tracked separately in Featurebase/Support. This closes the engineering defect without claiming that the customer's released build or historical records have already been repaired.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    androidbugconversationsmobileneeds-infop2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions