Skip to content

fix(sidecar): persist history page token to unblock truncated Gmail history - #683

Closed
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-4df5
Closed

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-4df5

Conversation

@cursor

@cursor cursor Bot commented Aug 11, 2026

Copy link
Copy Markdown

Summary

  • Persist Gmail history.list nextPageToken in sidecar_state.history_page_token (migration 32) when the 3-page cap leaves more pages pending.
  • Resume pagination from the stored token on the next poll; clear the token when listing completes or on history-gap re-anchor.

Why

When listNewMessageIds hits MAX_HISTORY_PAGES with more pages pending, the poller correctly froze history_cursor but restarted at page 1 every poll. Once pages 1–3 were fully deduped, the cursor could never advance and mail on page 4+ was permanently lost during bursts.

Test plan

  • npm test passes locally (gmail-client, workspace-poll, sidecar-state — 60 tests)
  • Regression test: two-poll convergence resumes from stored page token and advances cursor

Notes for reviewer

Several draft PRs exist for the same fix; this is the minimal diff (7 files, migration 32).

Open in Web View Automation 

…istory

When listNewMessageIds hits the 3-page cap with more pages pending, the
poller froze history_cursor but restarted pagination at page 1 on every
subsequent poll. Once pages 1-3 were fully deduped the cursor could never
advance and mail on page 4+ was permanently lost.

Persist the dangling nextPageToken in sidecar_state (migration 32) and
resume from it on the next poll. Clear the token when the listing completes
or on history-gap re-anchor.

Co-authored-by: schmug <schmug@users.noreply.github.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ais-hub fa6c35c Commit Preview URL

Branch Preview URL
Aug 11 2026, 11:05 AM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
agentic-inbox fa6c35c Aug 11 2026, 11:06 AM

@schmug

schmug commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Closing as superseded by #686.

This is one of 24 near-identical PRs re-filed daily by an automation that has since been fixed. #686 carries the same Gmail history page-token change and is the one kept open, so no work is lost here.

@schmug schmug closed this Aug 23, 2026
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.

2 participants