Skip to content

fix(sidecar): resume truncated Gmail history via page token (#595) - #654

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

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

Conversation

@cursor

@cursor cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

Summary

  • Persist history_page_token in sidecar_state (migration 32) when a Gmail history listing hits the 3-page cap but still has a dangling nextPageToken.
  • Resume truncated history from the saved page token on the next poll instead of re-fetching pages 1–3 forever.
  • Clear the token on a complete listing, batch cap mid-slice, or history-gap re-anchor.

Why

When listNewMessageIds hits MAX_HISTORY_PAGES, the cursor correctly stays frozen — but if pages 1–3 are already deduped, the poller re-fetched them on every tick and never reached page 4+, silently skipping new mail for sidecar mailboxes. Fix was drafted in #595 but never merged to main.

Test plan

  • npm test passes locally (59 targeted tests: workspace-poll, gmail-client, sidecar-state)
  • New regression test covers the two-poll deadlock → resume → cursor-advance path

Notes for reviewer

Follow-up to #595. Also clears history_page_token on Gmail history-gap re-anchor (was a separate draft commit).

Open in Web View Automation 

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, batch cap mid-slice, or 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 bd645e0 Commit Preview URL

Branch Preview URL
Jul 27 2026, 11:10 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 bd645e0 Jul 27 2026, 11:11 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