Skip to content

Fix Google Calendar archive cleanup reliability#1706

Open
martin-forge wants to merge 3 commits intocallumalpass:mainfrom
martin-forge:codex/fix-1695-google-calendar-archive-reliability
Open

Fix Google Calendar archive cleanup reliability#1706
martin-forge wants to merge 3 commits intocallumalpass:mainfrom
martin-forge:codex/fix-1695-google-calendar-archive-reliability

Conversation

@martin-forge
Copy link

Fixes #1695.

What this changes

  • await Google Calendar cleanup during toggleArchive() instead of firing it and forgetting it
  • make deleteTaskFromCalendar() return success/failure and only clear googleCalendarEventId after a confirmed delete or a 404/410
  • preserve the pre-archive event ID across archive moves so deletion still has the identifier it needs
  • keep auto-archive queue items pending when the task is archived locally but Google cleanup still has to be retried
  • retry Google cleanup for already-archived tasks that still have a lingering Google Calendar link

Why

The previous flow could archive a task locally while the Google event remained behind, and on some failure paths the local googleCalendarEventId could be cleared anyway. That leaves an orphaned event with no local pointer for retry.

This PR makes the archive flow retry-safe: local archive can still succeed, but the event ID is preserved until Google deletion actually succeeds, and the auto-archive queue keeps retrying cleanup while the link remains.

Tests

  • npx jest tests/unit/services/TaskService.test.ts --runInBand
  • npx jest tests/unit/issues/issue-google-calendar-archive-reliability.test.ts --runInBand

I also validated the patch on a clean upstream copy after generating the release notes bundle required for typecheck/build in this repo.

@martin-forge martin-forge force-pushed the codex/fix-1695-google-calendar-archive-reliability branch from fea5663 to 2619966 Compare March 17, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Archived tasks can remain on Google Calendar and orphan their event ID

1 participant