fix(sidecar): resume Gmail history past page cap when pages are deduped - #686
Draft
cursor[bot] wants to merge 2 commits into
Draft
cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
…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>
…nit test Complements #667 cherry-pick: first truncated-history poll test now checks the persisted page token, and gmail-client gets a resumePageToken test. 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 | 5692f6f | Commit Preview URL Branch Preview URL |
Aug 14 2026, 11:17 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
agentic-inbox | 5692f6f | Aug 14 2026, 11:18 AM |
This was referenced Aug 23, 2026
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.
Bug and impact
When a Gmail history listing spans more than
MAX_HISTORY_PAGES(3) and pages 1–3 are fully deduped,truncated=truefroze the cursor forever. The poller re-fetched the same three pages every cron tick and never reached page 4+ — silent mail loss during bursts on Workspace sidecar mailboxes.Root cause
listNewMessageIdscorrectly setstruncated=trueand blocks cursor advancement when anextPageTokendangles past the page cap. However, the next poll restarted from the samehistory_cursorwith no persisted page token, so already-deduped pages were re-fetched indefinitely.Fix
history_page_tokencolumn tosidecar_state(migration 32)listNewMessageIdson resumenextPageTokenfromlistNewMessageIdswhen truncatedpollWorkspaceMailboxalongside cursor advancement rulesValidation
tests/providers/gmail-client.test.ts— resumePageToken unit testtests/providers/workspace-poll.test.ts— two-poll convergence regression (fix(sidecar): resume truncated Gmail history via history_page_token #667)test/durableObject/sidecar-state.test.ts— schema column