Repository navigation
fix(backend): cancel the source tasks' reminders when conversations are merged - #15177
Conversation
|
Bounty proposal for this fix: #15178 ($25 proposed). |
6d17f3a to
794a934
Compare
aryanorastar
left a comment
There was a problem hiding this comment.
Verified on 794a93427461.
Merge cleanup deletes each source's action items and never tells the client, so open dated source tasks keep their reminders next to the merged conversation's new ones. This head reads the source rows first and sends sync_action_item_reminder(..., completed=True, due_at=None) inside the existing try. Complementary to #15175 (swipe-delete) and #15180 (reprocess), not the same hole.
Units, hygiene, and hermetic E2E are green on this SHA. I am not merging.
|
Verified the fix end to end against the head — it closes a real gap in the merge cleanup and mirrors the conversation-delete semantics correctly. Noting the specifics: backend/utils/conversations/merge_conversations.py — backend/tests/unit/test_merge_source_delete_cancels_task_reminders.py — hermetic via the merge suite's import-isolation harness; covers the gating precisely (open dated task cancels with the exact kwargs, completed dated and undated tasks don't, a source with no open dated tasks sends nothing). The explicit restore of patched module attrs and the drop of the freshly imported merge modules in teardown is appreciated — that fixture hygiene keeps the unit suite order-independent. One non-blocking thought for a possible follow-up (not this PR): Checks are green on this head (backend unit suite, hermetic merge gate, sync cloud tasks gauntlet, hermetic e2e) and @aryanorastar's approval is already recorded. Good, narrow fix with the right tests. 🤖 Automated review on behalf of the maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
5/5 confidence: real bug (merging conversations deletes each source's dated tasks without cancelling their client-scheduled reminders, causing duplicate/stale reminders), same class as merged siblings (#15041/#15043/#14983/#15028), scoped with new regression tests that fail against origin/main, all CI green.
Summary
_delete_conversation_and_related_data(used by the conversation-merge cleanup) deletes every source conversation's action items but never tells the client, so each open dated source task keeps its scheduled reminder on the phone after the merge.Impact
Merging conversations creates a new conversation, processes it (which schedules fresh reminders for its tasks), and then deletes every source. The deleted source rows still own local notifications the mobile client scheduled from the reminder data message; the client cancels them only on the deletion data message (
app/lib/services/notifications/action_item_notification_handler.dart→handleDeletionMessage), so after a merge the user gets duplicate reminders for the same commitments, and reminders for tasks the merged extraction dropped altogether.Same class as the sibling paths fixed in #15041 (conversation cascade delete), #15043 (developer API delete), #14983/#14984 (checking a task off inside a conversation) and #15028/#15029 (MCP task writes).
Fix
Read the source's stored tasks before deleting them, then send
sync_action_item_reminder(..., completed=True, due_at=None)for each open dated row (the gating #15041 uses on the conversation-delete path). 16 lines in one function; the reminder import stays local like the other lazy imports in this module, and the delete itself still happens before the cancel is attempted.Tests
backend/tests/unit/test_merge_source_delete_cancels_task_reminders.py(new, hermetic, reusing the merge suite's import-isolation harness):Verification
Against
origin/mainmerge_conversations.pythe new positive test fails (sync_action_item_remindercalled 0 times).Failure-Class: none