fix(trigger): handle Drive rate limits, 410 page token expiry, and clean up comments#4112
fix(trigger): handle Drive rate limits, 410 page token expiry, and clean up comments#4112waleedlatif1 merged 3 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Adds explicit Drive rate-limit detection for 403s ( Reviewed by Cursor Bugbot for commit ccbc151. Configure here. |
Greptile SummaryThis PR hardens the Google Drive polling handler against two failure modes: HTTP 410 responses (stale page token) are now caught as Confidence Score: 5/5Safe to merge — fixes a genuine retry loop bug and a failure-budget erosion bug with no regressions introduced. All three new code paths (410, rate-limit, re-seed with preserved knownFileIds) are logically correct. The updateWebhookProviderConfig utility spreads undefined values that JSON.stringify drops, so pageToken is reliably removed from the stored config on 410. No P0/P1 findings remain. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[pollWebhook called] --> B{config.pageToken set?}
B -- No --> C[getStartPageToken]
C --> D{Rate limit 429/403?}
D -- Yes --> E[throw DriveRateLimitError]
D -- No --> F[Seed pageToken + preserve knownFileIds]
F --> G[markWebhookSuccess → return success]
B -- Yes --> H[fetchChanges]
H --> I{HTTP error?}
I -- 410 --> J[throw DrivePageTokenInvalidError]
I -- 429/403 RL --> K[throw DriveRateLimitError]
I -- Other --> L[throw generic Error]
I -- OK --> M{changes found?}
M -- None --> N[update pageToken, markWebhookSuccess]
M -- Some --> O[filterChanges → processChanges → update state]
O --> P[markWebhookSuccess/Failed]
E --> Q[catch: DriveRateLimitError]
K --> Q
Q --> R[markWebhookSuccess → return success]
J --> S[catch: DrivePageTokenInvalidError]
S --> T[clear pageToken via updateWebhookProviderConfig]
T --> U[markWebhookSuccess → return success]
U --> V[Next poll re-seeds via getStartPageToken]
L --> W[catch: generic]
W --> X[markWebhookFailed → return failure]
Reviews (3): Last reviewed commit: "fix(trigger): distinguish Drive 403 rate..." | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
…s, preserve knownFileIds on 410 re-seed
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ccbc151. Configure here.
Summary
Type of Change
Testing
Tested manually
Checklist