fix(sync): tolerate PERMANENTFLAGS IMAP errors#13178
Conversation
Treat IMAP STATUS PERMANENTFLAGS failures as custom flags being unsupported instead of aborting account synchronization. Some servers, including iCloud, can fail this status query while regular mailbox sync otherwise works. Fixes: nextcloud#12506 Assisted-by: Amp:gpt-5-codex Signed-off-by: Niklas Arnitz <narnitz@churchtools.de> Amp-Thread-ID: https://ampcode.com/threads/T-019f140d-88ab-73ec-bbae-9b54eec909f1 Co-authored-by: Amp <amp@ampcode.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fad1196795
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| 'mailbox' => $mailbox, | ||
| ]); | ||
|
|
||
| return false; |
There was a problem hiding this comment.
Re-throw transient IMAP failures instead
If status() fails with a transient Horde exception such as SERVER_READERROR or DISCONNECT, this now downgrades the failure to “permflags unsupported”. In the tag/untag path (tagMessagesWithClient()), that makes the caller skip the IMAP addFlag/removeFlag block but still update tagMapper locally, so a user-visible tag change can be reported as successful even though the server was not updated. Please only suppress the specific PERMANENTFLAGS server response this fix targets and keep connection/authentication failures propagating.
Useful? React with 👍 / 👎.
Summary
STATUS PERMANENTFLAGSfailures as custom flags being unsupported instead of aborting account syncMotivation
Some IMAP servers can return an error for the
PERMANENTFLAGSstatus query while regular mailbox sync otherwise works. On iCloud this causes account sync to abort withCould not get message flag options from IMAP: IMAP error reported by serverand can also trigger the log spam reported in #12506.If the server cannot report permanent flag support, Mail can safely continue with custom keyword sync disabled for that mailbox.
Fixes #12506