mirror of
https://github.com/karatektus/pl_mail.git
synced 2026-10-25 10:04:18 +00:00
A dead Google or Microsoft grant answers identically on every attempt, and it was going through the full retry ladder anyway: five CRITICAL log lines per calendar and three per mailbox, all the same sentence. That is how the one line that means something — this account needs reconnecting — stops being read at all. It is classified from the provider's own OAuth error code, which is the only place that can tell the two cases apart: the token endpoint answers 400 for a revoked refresh token and 400 for a malformed request, and `invalid_grant` is the vocabulary RFC 6749 defines for exactly this. A timeout, a 500 or a DNS failure carries no such code and is still retried, because a permanent classification is a decision never to try again. The Microsoft calendar driver had the opposite bug: it treated EVERY failed refresh as permanent, so a slow token endpoint wrote the account off when one more attempt would have worked. Nothing changes about how the user is told. OAuthTokenManager already records the failure on the account as it happens, and the Reconnect button in Settings comes from that rather than from the retries. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>