Skip to content

Calendar sync retries a revoked Google token forever instead of asking to reconnect #661

Closed

Description

@Valtora

When Google refuses a refresh token, its token endpoint answers 400 with error: invalid_grant and a description such as "Bad Request". _extract_error_text_from_payload (backend/services/calendar_service/text_utils.py) keeps only the description, so _classify_sync_failure never sees invalid_grant and marks the account "Needs attention" instead of "Reconnect required". The 15-minute sync and the push sweep then retry the refresh indefinitely, about ten token requests an hour per account. Settings shows only "Bad Request", and the dashboard keeps showing the calendar as it was at the last good sync.

Fix: classify token-endpoint failures on the OAuth error code (invalid_grant, interaction_required, consent_required, login_required, Microsoft's AADSTS invalid_grant included), and keep reconnect-required accounts out of the push sweep and the reconcile after a sync.

Ours

Activity

  1. self-assigned this
    on Oct 23, 2026
  2. added
    bugSomething isn't working
    severity:mediumImportant but with a workaround, or affects a subset of users.
    scope:backendBackend API and shared backend code.
    on Oct 23, 2026
  3. Valtora commented on Oct 23, 2026

    @Valtora
    OwnerAuthor

    Fixed by #667. A refused grant is now read from the OAuth error code and marks the account Reconnect required, and such accounts stop requesting tokens and leave the push sweep until they reconnect.

  4. added a commit that references this issue on Oct 23, 2026
    7a2ba97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingscope:backendBackend API and shared backend code.severity:mediumImportant but with a workaround, or affects a subset of users.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions