github →

New request

#17095: Messaging: Toggling Gmail folder sync ON doesn't backfill historical messages

We'll provision a sandbox, run an agent against the issue, and open a draft PR. You can pull the branch and iterate from there.

Issue
prio: medium

When a user toggles a Gmail folder/label to sync after initial account connection, historical messages in that folder are not imported.

Root cause: Gmail's syncCursor (historyId) is stored at the messageChannel level. The History API only returns changes after that historyId - it doesn't return messages that already existed in the folder.

Expected behavior: Toggling a folder ON should trigger a full fetch of that folder's existing messages via messages.list, then continue with incremental sync.

Affected providers: Gmail only. Microsoft and IMAP store syncCursor per-folder so they handle this correctly.

Assessmentadvisory
bug●● medium85% confidence

Gmail folder toggle fails to backfill messages because the channel-level sync cursor skips existing history when a new folder is enabled.

Likely files
  • packages/twenty-server/src/engine/core-modules
  • packages/twenty-server/src/database/typeorm/core/migrations/common
  • packages/twenty-shared/src/types
Create the request

This opens a fresh agent run and a draft PR for issue #17095.

Cancel