fix(sidecar): resume truncated Gmail history via page token (#595) - #663
Closed
cursor[bot] wants to merge 1 commit into
Closed
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
When listNewMessageIds hits the MAX_HISTORY_PAGES cap the cursor correctly freezes, but if pages 1-3 are already deduped the poller re-fetches them forever and never reaches page 4+ — silently skipping inbound mail. Persist the dangling nextPageToken in sidecar_state.history_page_token once the current slice is fully worked; the next poll resumes from that token with the same cursor. Clear the token on cursor advance, history-gap re-anchor, or batch-cap mid-slice (restart from page 1 to finish unprocessed ids). 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 | d46a731 | Commit Preview URL Branch Preview URL |
Jul 30 2026, 11:06 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
agentic-inbox | d46a731 | Jul 30 2026, 11:07 AM |
Owner
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
nextPageTokeninsidecar_state.history_page_tokenwhen a history listing hits theMAX_HISTORY_PAGEScap and the current slice is fully worked.Why
When
listNewMessageIdshits the 3-page cap, the cursor correctly freezes — but if pages 1–3 are already deduped, the poller re-fetches them forever and never reaches page 4+. Inbound mail on later pages is silently skipped.Trigger: Sidecar mailbox with a burst of >3 pages of Gmail history where the first pages were already ingested in a prior partial run.
Test plan
npm testpasses locally (workspace-poll, gmail-client, sidecar-state suites — 59 tests)Notes for reviewer
32_history_page_token.cursor/critical-bug-investigation-e194but never merged to main.