fix(sidecar): resume truncated Gmail history via page token - #635
Open
cursor[bot] wants to merge 1 commit into
Open
fix(sidecar): resume truncated Gmail history via page token#635cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
When listNewMessageIds hits MAX_HISTORY_PAGES the cursor correctly stays frozen, but if pages 1-3 are already deduped the poller re-fetched them forever and never reached page 4+ — silently skipping new mail. Persist history_page_token (migration 32) once a truncated slice is fully worked; the next poll resumes from that nextPageToken with the same cursor. Clear the token on a complete listing or when a batch cap leaves unprocessed ids in the current slice. Co-authored-by: schmug <schmug@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ais-hub | 2490bb1 | Commit Preview URL Branch Preview URL |
Jul 20 2026, 11:03 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
agentic-inbox | 2490bb1 | Jul 20 2026, 11:04 AM |
schmug
marked this pull request as ready for review
July 20, 2026 11:39
Author
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
history_page_tokeninsidecar_state(migration 32) when a Gmail history listing hitsMAX_HISTORY_PAGESand the current slice is fully workednextPageTokeninstead of re-fetching pages 1–3 foreverWhy
listNewMessageIdscaps at 3 history pages and correctly freezes the cursor whentruncated: true. However, if pages 1–3 are already ingested (all deduped), every subsequent poll re-listed the same pages and never reached page 4+ — silently skipping new mail for busy mailboxes catching up after downtime.Concrete trigger: >3 pages of Gmail history since the cursor, with the first 3 pages already stored.
Test plan
npm testpasses locally (workspace-poll, gmail-client, sidecar-state)Notes for reviewer
Minimal fix scoped to the page-cap deadlock. Does not address the separate poll-lease TTL gap during very long batches (>5 min) — that remains a lower-likelihood race.