Repository navigation
fix(gmail): drop an expired history cursor instead of re-saving it every poll - #9343
Conversation
…ery poll Gmail answers history.list with 404 once the stored cursor ages out of its retained history and the client must full-sync. The fallback searched the inbox, then took the mailbox profile's historyId as the new cursor, but a quiet mailbox reports the expired id itself, so it was persisted again and every poll repeated the 404, search and profile calls with an ERROR log. The resync now never adopts the rejected cursor and drops it when nothing newer exists, so the webhook polls through search until matching mail supplies one. The expected 404 logs at info and other history errors at warn.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.
Turn on auto-fix | Re-trigger cubic
[Medium impact] The PR appears safe to merge; the latest test changes introduce no blocking issue. SummaryThe PR stops Gmail polling from saving a rejected history cursor again.
Reviews (2) · Last reviewed commit: "fix(gmail): type the polling test's work..." · Reviewed by Greptile |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.
Turn on auto-fix | Re-trigger cubic
Summary
history.listwith 404 once the storedhistoryIdages out of its retained history (typically at least a week); the sync guide says to full-sync.historyIdas the new cursor. A quiet mailbox reports the expired id itself, so it was saved again and every poll repeated the 404 + search + profile calls and an ERROR log.historyId, else the profile's, but never the rejected one; with no replacement the cursor is dropped and the webhook polls through search (the same mode a new webhook starts in) until matching mail supplies a cursor.pollWebhooknow persists the cursorfetchNewEmailsreturns instead of falling back to the old one, so a cleared cursor is actually removed.Type of Change
Testing
lib/webhooks/polling/gmail.test.ts: quiet mailbox drops the expired cursor; full sync finding mail resumes from that message; a moved-on mailbox resumes from its profile cursor. The first case fails on the previous code (re-saves the expired id) and passes with the fix.lib/webhooks/polling/suite: 56 passedcheck:test-patterns,check:comment-hygieneChecklist
test-auditauthoring gate)