Skip to content

[29.0] Prevent Sales Order Agent from skipping emails moved into monitored folders - #11098

Open
tomasevicst wants to merge 1 commit into
releases/29.0from
bugs/648911_SOA_Folder_Monitoring_Skip_Emails_29.x
Open

[29.0] Prevent Sales Order Agent from skipping emails moved into monitored folders#11098
tomasevicst wants to merge 1 commit into
releases/29.0from
bugs/648911_SOA_Folder_Monitoring_Skip_Emails_29.x

Conversation

@tomasevicst

@tomasevicst tomasevicst commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What & why

Stop advancing Earliest Sync At after email polling. Moved emails retain their original received timestamp, so advancing this value could permanently exclude them from later retrieval.

The configured Start Date remains the retrieval lower bound, while Graph excludes emails already categorized as processed. Added regression tests for empty and under-full polling.

Linked work

Fixes AB#649176

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)

Risk & compatibility

Low risk. No schema, API, setup, or connector changes. Existing Start Date behavior during setup, reactivation, and mailbox changes remains unchanged. Previously processed emails continue to be excluded server-side by their Outlook category.

@tomasevicst
tomasevicst requested a review from a team September 5, 2026 20:57
@tomasevicst
tomasevicst requested a review from a team as a code owner September 5, 2026 20:57
@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 Team: SCM GitHub request for SCM area labels Sep 5, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Sep 5, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Accept with Suggestions

What this PR does

The change stops email polling from overwriting Earliest Sync At after retrieval, so folder monitoring keeps the configured lower bound instead of moving it to the time of an empty or under-full poll. This addresses the reported race where a message is moved into the monitored folder after polling, but keeps its older receivedDateTime and is then filtered out forever. The remaining category-exclude filter still prevents already imported messages from being fetched again, and the approach matches the analogous folder-polling pattern that uses a stable lower bound for moved messages.

Problem-solution fit

Fit: Strong

The bug is caused by using a moving receivedDateTime watermark for folder polling. The diff removes that runtime advancement from the retrieval flow, while setup-time lower-bound behavior remains unchanged.

Suggestions

S1 (🟠 Moderate): Add tests for moved-folder polling
No test file changed with this production change. Please add a regression test for a message that enters the monitored folder after an empty or under-full poll, and assert it is discovered without creating a duplicate for already processed mail.

Risk assessment and necessity

Risk: Folder polling can now query from the configured Earliest Sync At on each run, so older unprocessed messages in that window may be seen again until the processed category is applied. The request is still bounded by the existing maximum count and category filter. There are no schema, public API, event publisher, or BaseApp dependencies in this change.

Necessity: The deleted update is the path that made eligible moved messages permanently invisible after a successful empty poll. Keeping a stable lower bound is required for monitored folders because moving a message does not change its original received time.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11098 round=1 by=alexei-dobriansky at=2026-09-06T00:17:16Z lastSha=01e6f258980de97ee4a2147a5f361d1a3389431b reviewKey=2196f6dd3acfe6a41834991e1d91984e5c7b96aaca249d09ae0b11981c86d1ae suggestions=S1@1f0e1b8e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Team: SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants