Skip to content

fix(sidecar): resume Gmail history past page cap when pages are deduped - #673

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

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

Conversation

@cursor

@cursor cursor Bot commented Aug 3, 2026

Copy link
Copy Markdown

Summary

  • Persist history_page_token in sidecar_state (migration 32) when a Gmail history listing is truncated by the 3-page cap
  • Resume history fetches from the saved page token so page 4+ messages are ingested after pages 1–3 are fully deduped
  • Add regression test covering the two-poll deadlock scenario

Why

When Gmail history spans more than MAX_HISTORY_PAGES (3) and pages 1–3 are fully deduped, truncated=true froze the cursor forever. The poller re-fetched the same deduped pages every minute and never reached page 4+, causing silent message loss during mail bursts in Workspace sidecar mode.

Test plan

  • npm test passes locally (workspace-poll, gmail-client, sidecar-state suites)
  • New regression test: truncated + all-deduped → saves page token → resumed poll ingests tail and advances cursor

Notes for reviewer

Minimal fix: no config surface. history_page_token clears on cursor advance and history-gap re-anchor.

Open in Web View Automation 

…ed (#667)

When Gmail history spans more than MAX_HISTORY_PAGES (3) and pages 1–3 are
fully deduped, truncated=true froze the cursor forever and page 4+ messages
were never ingested — silent data loss during mail bursts.

Persist history_page_token in sidecar_state (migration 32) and pass it to
listNewMessageIds so the next poll resumes from the dangling pageToken
instead of re-fetching already-deduped pages.

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 a833cd4 Commit Preview URL

Branch Preview URL
Aug 03 2026, 11:04 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 a833cd4 Aug 03 2026, 11:05 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