Skip to content

fix(gh-priority-sync): use last_edited_time filter for Notion checkpoint resume#206

Open
snomiao wants to merge 3 commits intomainfrom
sno/fix-notion-cursor-priority-sync
Open

fix(gh-priority-sync): use last_edited_time filter for Notion checkpoint resume#206
snomiao wants to merge 3 commits intomainfrom
sno/fix-notion-cursor-priority-sync

Conversation

@snomiao
Copy link
Copy Markdown
Member

@snomiao snomiao commented May 2, 2026

Summary

  • Fixes combined-github-tasks CI failure: APIResponseError: The start_cursor provided is invalid: 34a6d73d-3650-810c-89ee-e9c25cd07700.
  • Root cause: gh-priority-sync passed checkpoint.id (a Notion page ID) into notion.dataSources.query({ start_cursor }). Notion's start_cursor only accepts a token previously returned as next_cursor — feeding it an arbitrary page ID makes Notion reject the request.
  • Switch to filtering by last_edited_time on_or_after checkpoint.editedAt and start pagination from undefined. The existing post-filter e.id !== checkpoint?.id still drops the boundary entry.

Test plan

  • CI green on this branch (gh-combined-tasks workflow)
  • On next scheduled run, the GitHub Issue Priorities Labeler Task no longer throws start_cursor validation errors and resumes from the prior checkpoint via last_edited_time filter

🤖 Generated with Claude Code

…int resume

Notion's start_cursor must be a token returned by a previous query
(next_cursor), not an arbitrary page ID. Passing checkpoint.id caused
"The start_cursor provided is invalid" errors that failed CI.

Switch to filtering by last_edited_time on_or_after checkpoint.editedAt,
and let pagination start from undefined. The existing post-filter that
skips checkpoint.id continues to drop the duplicate boundary entry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 2, 2026 19:19
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comfy-pr Ready Ready Preview, Comment May 2, 2026 7:39pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes gh-priority-sync Notion pagination resume logic by avoiding invalid start_cursor usage and instead resuming via last_edited_time filtering, preventing APIResponseError: The start_cursor provided is invalid.

Changes:

  • Stop passing checkpoint.id (Notion page ID) as start_cursor to notion.dataSources.query.
  • Introduce a last_edited_time on_or_after checkpoint.editedAt filter and start pagination from undefined.
  • Keep the boundary-skip behavior by filtering out checkpoint.id from results.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/tasks/gh-priority-sync/index.ts Outdated
Comment thread app/tasks/gh-priority-sync/index.ts Outdated
snomiao and others added 2 commits May 2, 2026 19:36
Removes a dead snippet that referenced an undefined CHECKPOINT identifier
(the actual constant is NotionCheckpoint). Addresses Copilot review on PR #206.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When multiple Notion pages share the same last_edited_time as the
checkpoint, the prior implementation only skipped the single checkpoint id
and reprocessed (or got stuck on) the rest each run.

Extend the checkpoint to track all ids processed at the boundary timestamp
(processedIdsAtEditedAt) and use it as a post-filter. As we process items,
we either append to the boundary set (same timestamp) or reset it (new
timestamp), so the persisted checkpoint always reflects every id already
handled at the current boundary. Legacy { id, editedAt } checkpoints are
upgraded by treating { id } as the only processed id at editedAt.

Addresses Copilot review on PR #206.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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