[BUG] Incremental sync warns "no stored highest_uid" on every round for folders with no new mail
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
Research direction
The bug is in crates/core/src/archive/imap/download/flow.rs. Start at the incremental branch that logs "no stored highest_uid" (around line 1293, where get_max_uid is called) and at the reconcile step (around line 1108) that keeps None. Done means that when no new mail is fetched, the max UID found by get_max_uid is persisted, so the warning no longer repeats on the next round.
Written by the indexing model from the issue text.
Description
Version
2.3.2 (Docker rustmailer/bichon:2.3.2)
Steps to Reproduce
- Use an IMAP account (Gmail here) whose folders were archived by an older version, before
highest_uidwas stored for each mailbox. - Upgrade to 2.3.2 and let the periodic incremental sync run.
- Watch the log for a folder that gets no new mail, such as a rarely used label.
Issue Description
Every sync round logs a warning for each of those folders, and it never stops: about 375 warnings an hour across around 30 folders for me. Folders that do get new mail save a highest_uid and stop warning. Archiving still works: the fallback finds the right start UID.
What I think causes it: in crates/core/src/archive/imap/download/flow.rs, when local_mailbox.highest_uid is None, the incremental path takes the start UID from ENVELOPE_MANAGER.get_max_uid(...) (around line 1293). But the function returns Ok(new_max_uid.or(local_mailbox.highest_uid)). With no new mail, both are None, so it returns None. Reconcile keeps None (new_highest_uid.or(local_mailbox.highest_uid), around line 1108), so the next round takes the fallback again.
Suggested fix: when no new mail is fetched, return the max UID that get_max_uid found, e.g. new_max_uid.or(local_mailbox.highest_uid).or(local_max_uid). Reconcile then saves it once, and both the warning and the repeated index query stop.
Screenshots or Logs (optional)
One round for an affected folder (account and mailbox names shortened):
WARN bichon_core::archive::imap::download::flow: incremental: no stored highest_uid, falling back to Tantivy get_max_uid account_id=… mailbox=…
INFO bichon_core::imap::executor: [account …][mailbox …] fetch_new_mail: enumerate UIDs via UID FETCH 13329:*
INFO bichon_core::imap::executor: fetch_new_mail_range: UID FETCH result account_id=… mailbox=… start_uid=13329 found=0 skipped_oversized=0
INFO bichon_core::archive::imap::download::flow: reconcile: computed highest_uid for mailbox account_id=… mailbox=…
INFO bichon_core::archive::imap::download::flow: reconcile: persisting mailbox state account_id=… mailbox=…
For comparison, a folder that does have a stored value:
INFO bichon_core::archive::imap::download::flow: reconcile: computed highest_uid for mailbox account_id=… mailbox=[Gmail]/Sent Mail local_highest=3447 new_highest=3447
INFO bichon_core::archive::imap::download::flow: reconcile: persisting mailbox state account_id=… mailbox=[Gmail]/Sent Mail highest_uid=3447
In the real log the mailbox names are your email addresses, so I replaced them with …. Keep them that way when you post. The line numbers are from upstream main as of this morning; if someone has changed flow.rs since, adjust them.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 91
- Avg merge
- 14h 54m
- Merged PRs (30d)
- 6
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rustmailer/bichon
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
rustmailer/bichon#331 · 8 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
rustmailer/bichon#409 · 4 comments ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
rustmailer/bichon#407 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 22/100
rustmailer/bichon#403 · 2 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 52/100
rustmailer/bichon#402 · 1 comment ·
All issues in rustmailer/bichon
Similar issues
-
bug UI
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
wardian-app/Wardian#1746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jlcodes99/cockpit-tools#3125 ·
Maintainers usually reply within 2 days
-
bug user-sprint
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Vondor/KassenSturz#967 ·
Maintainers usually reply within 1 day
-
area/ci
Difficulty 1/5 Under an hour Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
ImageGen generate-batch aborts valid JSONL jobs containing a Unicode line separator in poster textOpenbug imagen skills
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day