fix(sidecar): resume truncated Gmail history via page token (#595) - #659
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(sidecar): resume truncated Gmail history via page token (#595)#659cursor[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 | 811dd85 | Commit Preview URL Branch Preview URL |
Jul 28 2026, 11:04 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
agentic-inbox | 811dd85 | Jul 28 2026, 11:05 AM |
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_token(migration 32) so the next poll can resume past the page cap.Why
listNewMessageIdscaps atMAX_HISTORY_PAGES=3. When truncated, the cursor correctly freezes — but if pages 1–3 are all deduped, the poller re-fetches them forever and never reaches page 4+. Inbound mail beyond the page cap is silently skipped.Closes #595.
Test plan
npm testpasses locally (59 tests: workspace-poll, gmail-client, sidecar-state)Notes for reviewer
Also clears
history_page_tokenon history-gap re-anchor (stale token + new cursor would be invalid).