microsoft / microsoft/entrabot
tools: Email poll silently drops mail when >50 messages arrive between polls
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
File: src/entrabot/tools/email_poll.py
Location: L113-L149
Category: data-loss
Priority: high
Description
poll_once uses $orderby=desc + $top=50 and advances cursor to max(receivedDateTime). When >50 messages arrived since cursor, only the 50 newest are returned; the older N are never fetched and the cursor jumps past them. Next poll's $filter gt returns 0 — those emails are lost permanently. Triggers after outage/restart or any burst (DL digest, vacation).
Suggested fix
Use $orderby asc and advance cursor to the OLDEST unprocessed boundary, or follow @odata.nextLink until the page count since cursor is exhausted. If a cap is needed, emit an explicit "skipped N" event so loss is observable.
Filed automatically by a thorough code-review pass over src/entrabot/ on 2026-06-13. Internal review id: #49.
Contributor guide
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.
Research direction
Read poll_once in src/entrabot/tools/email_poll.py, especially lines 113-149, to understand how ordering, the 50-message limit, and the cursor update interact. Exercise a burst of more than 50 messages after a cursor, then verify that all messages are processed and that the cursor cannot skip older mail permanently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100