Skip to content

fix(polling): hold IMAP's cursor at a refused email and tighten polling test fidelity - #10747

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/polling-release-review
Dec 3, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/polling-release-review

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • IMAP: when a refusal that holds until a person acts (spent usage limit, suspended account) lands after earlier emails in the batch completed, the poller now saves each mailbox's UID cursor up to the email before the refused one and returns skipped, instead of counting a failure and moving past the refused emails. IMAP UIDs are ordered per mailbox, so nothing is dropped and nothing completed is re-run (Gmail and Outlook cursors can't stop mid-batch, so they keep counting it as an item failure)
  • The held poll keeps the previous lastCheckedTimestamp, or pins the first poll's 24h search window, so the since search still reaches the held email when the refusal lifts; it records the poll as a success, since the connection and earlier emails worked
  • Fetched emails are sorted ascending by UID per mailbox, since IMAP doesn't guarantee FETCH response order
  • auto-disable.integration.ts checks the cleared config with toEqual (toMatchObject matched nested objects as a subset, so leftover backoff keys would have passed)
  • The polling utils mock's outage check now matches production asOrchestrationError: OutboundAdmissionError is an outage, and a PayloadSizeLimitError stops the walk

Type of Change

  • Bug fix

Testing

  • imap.test.ts: refused email after a completed one (cursor saved at the completed UID, success recorded), refusal on the first email of a later mailbox (that mailbox keeps its stored UID), first-poll window pinned
  • auto-disable.integration.ts against real Postgres
  • Red/green: reverted each guard (the hold, the pinned window, the success mark, the backoff clearing for the integration assertion) and watched its test fail
  • Ran the webhook suites (683 tests), check:test-patterns, check:comment-hygiene, check:explicit-any, check:utils, check:file-names; CI runs type-check and the full audit suite

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Dec 3, 2026 10:45pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/webhooks/polling/imap.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit ceecf6f into staging Dec 3, 2026
152 of 154 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/polling-release-review branch December 3, 2026 23:44

This branch was previously deployed

1 inactive deployment
Preview — 2c9d38c9 Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant