Repository navigation
fix(backend): cancel or re-arm a task reminder when it is checked off in a conversation - #14984
Conversation
… in a conversation
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @singhharsh1708 — verified this closes a real gap: set_action_item_status (PATCH /v1/conversations/{id}/action-items) was the one completion path that still didn't reconcile reminders after #7695.
What I checked:
backend/routers/conversations.py— the newsync_action_item_reminder(...)call sits inside the pre-existing mirrortry/except, structurally identical to the sibling description-update/delete mirror blocks in this file, and pulls each mirrored item's owndescription/due_atrather than assuming they match the conversation copy. Route contract and auth are untouched.backend/utils/notifications.py(unchanged context) —sync_action_item_remindersemantics line up with the fix intent:completed or not due_at→action_item_deletedata message (the client cancels the local reminder by id), open + dated →action_item_update(reschedule)._send_to_usercatches its own send errors and returns 0, so a notification failure can't fail the PATCH.backend/tests/unit/test_conversation_events_bounds.py— both new tests assert the full argument set in each direction (check-off →completed=Truewithdue_atpassed through; uncheck →completed=Falsere-arm) and fail on main withCalled 0 times. Good regression coverage.
One non-blocking note: all mirrored items share the single mirror try/except, so an unexpected exception while syncing one item would skip the mark + sync of the remaining items in that request. Rare in practice since the FCM layer swallows send errors, but a per-item try would make the mirror independent per task — fine as a follow-up.
Solid, narrowly scoped fix with the right tests. Leaving the merge decision to a maintainer.
🤖 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 need human response.
kodjima33
left a comment
There was a problem hiding this comment.
Confirmed bug still present on main, root cause explained, regression test added, CI green. 5/5.
Fixes #14983
set_action_item_status(thePATCH /v1/conversations/{id}/action-itemsroute the conversation detail page uses to check a task off) mirrored the new state onto the standalone action items but never touched their reminders. #7695 made the other completion paths callsync_action_item_reminder, so this was the one place where completing a task still left its reminder armed.Each mirrored item now also goes through
sync_action_item_reminderwith its own description anddue_at, so checking off cancels the reminder and unchecking a dated task schedules it again. The import is local inside the existingtry, like the other local imports in this router, so a failed notification send is logged and never breaks the status update.Two tests added to
tests/unit/test_conversation_events_bounds.py. On main both fail withExpected 'mock' to be called once. Called 0 times.With the fix they pass, as doestest_action_item_reminder_cancel_on_complete.py.Line-Count-Exception: backend/routers/conversations.py | 2249 -> 2257 | sync task reminders when a conversation task is checked off
Failure-Class: none