Skip to content

fix(trigger): handle Drive rate limits, 410 page token expiry, and clean up comments#4112

Open
waleedlatif1 wants to merge 2 commits intostagingfrom
fix/google-drive-polling
Open

fix(trigger): handle Drive rate limits, 410 page token expiry, and clean up comments#4112
waleedlatif1 wants to merge 2 commits intostagingfrom
fix/google-drive-polling

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add explicit 403/429 rate limit handling in `fetchChanges` and `getStartPageToken` with clear error messages, consistent with the Calendar and Sheets handlers
  • Handle HTTP 410 (invalid page token) in `fetchChanges` — previously this caused the webhook to enter a permanent failure loop; now it clears the stored token so the next poll re-seeds from the current Drive state via `getStartPageToken`
  • Remove dead `eslint-disable-next-line no-constant-condition` comment (project uses Biome, not ESLint)
  • Remove verbose multi-line comments from the pagination resume token logic and state update block

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 11, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 11, 2026 8:22pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 11, 2026

PR Summary

Medium Risk
Adjusts Google Drive polling error handling and state resets, which affects webhook progression and could change whether/when events are retried or skipped under API errors.

Overview
Improves Google Drive polling resilience by special-casing Drive API errors: treats 403/429 as rate-limit conditions with clearer messages, and handles 410 by marking the stored page token invalid and clearing it so the next poll re-seeds from a fresh start token instead of failing repeatedly.

Also tightens pagination resume-token selection comments/logic readability and removes stale lint/comment noise, without changing the core event processing flow.

Reviewed by Cursor Bugbot for commit 0f503f6. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 11, 2026

Greptile Summary

This PR adds three targeted fixes to the Google Drive polling handler: explicit 403/429 rate-limit handling in fetchChanges and getStartPageToken (consistent with the Calendar and Sheets handlers), 410 page-token expiry recovery in fetchChanges (previously caused a permanent failure loop by retrying with the same dead token), and removal of the dead ESLint comment and verbose inline comments. The 410 recovery works correctly — it clears pageToken to undefined in the DB, and the next poll's first-branch logic re-seeds via getStartPageToken and resets knownFileIds: [].

Confidence Score: 5/5

Safe to merge — the 410 recovery is correctly implemented and rate-limit handling is consistent with existing Google API handlers.

All findings are P2. The 410 fix correctly clears the stored token so the next poll re-seeds cleanly, and 403/429 handling mirrors the Calendar and Sheets handlers exactly. No logic errors or data-integrity concerns were found.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/lib/webhooks/polling/google-drive.ts Adds 410 page-token expiry recovery and 403/429 rate-limit handling; 410 path correctly clears the stored token so the next poll re-seeds cleanly.

Reviews (1): Last reviewed commit: "fix(trigger): handle Drive rate limits, ..." | Re-trigger Greptile

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.

1 participant