Skip to content

Google: stop the Tasks poll erroring on a disconnected account - #357

Merged
KrisBraun merged 1 commit into
mainfrom
fix-google-tasks-poll-missing-token
Aug 1, 2026
Merged

Google: stop the Tasks poll erroring on a disconnected account#357
KrisBraun merged 1 commit into
mainfrom
fix-google-tasks-poll-missing-token

Conversation

@KrisBraun

Copy link
Copy Markdown
Contributor

Symptom

Google Tasks has no webhooks, so its sync is a durable hourly poll. When the account's OAuth grant lapses or is revoked, the channel resolves no token and the poll threw an unhandled error — once an hour, multiplied by the queue's retries, for as long as the connection stayed disconnected.

That state is expected and already surfaced: resolving no token flags the connection for re-auth, so the app shows Reconnect and only the user can clear it. It's also specific to Tasks among this connector's products — mail and calendar are push-driven, and a revoked grant simply stops delivering notifications, so nothing keeps knocking.

Fix

periodicSyncBatchFn now fetches the token through a new non-throwing tryGetTokenFn (mirroring the mail module's existing tryGetApiFn) and ends the cycle quietly when there is none:

  • drops the in-flight cycle state and reports done, so the recurring schedule re-fires on its own and picks back up once the connection is restored;
  • leaves last_sync_time_ untouched, so the window skipped while disconnected is re-covered by the first successful cycle rather than silently lost;
  • leaves the channel enabled — this is not a teardown, unlike the deleted-task-list path, which still cancels the poll and archives links.

The initial backfill deliberately keeps using the throwing getTokenFn: the app shows a sync spinner until the backfill reports completion, so a silent early return there would leave it spinning forever.

Tests

Two cases added to src/tasks/sync.test.ts, both driven from a host whose integrations.get resolves null:

  • the poll returns { done: true }, clears only the cycle state, and does not cancel the schedule, archive links, disable the channel, advance last_sync_time_, or call the API;
  • the initial backfill still throws, guarding the spinner behaviour against a well-meaning future "make it quiet too".

Full connector suite: 369 passing.

Google Tasks has no webhooks, so its sync is a durable hourly poll. When the
account's OAuth grant lapses or is revoked, the channel resolves no token and
the poll threw an unhandled error — once an hour, multiplied by the queue's
retries, for as long as the connection stayed disconnected.
That state is expected and already surfaced: resolving no token flags the
connection for re-auth, so the app shows "Reconnect" and only the user can
clear it. It's also specific to Tasks among this connector's products — mail
and calendar are push-driven, and a revoked grant simply stops delivering
notifications, so nothing keeps knocking.
The poll now ends the cycle quietly instead. It drops the in-flight cycle
state and reports done; the recurring schedule re-fires on its own and picks
back up once the connection is restored. `last_sync_time_` is left untouched,
so the window skipped while disconnected is re-covered by the first successful
cycle rather than being silently lost, and the channel is left enabled — this
is not a teardown, unlike the deleted-task-list path.
The initial backfill deliberately keeps throwing: the app shows a sync spinner
until the backfill reports completion, and a silent early return there would
leave it spinning forever.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@KrisBraun
KrisBraun merged commit c30bbe3 into mainAug 1, 2026
1 check passed
@KrisBraun
KrisBraun deleted the fix-google-tasks-poll-missing-token branch August 1, 2026 17:50
Sign up for freeto 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.

1 participant

@KrisBraun