Skip to content

fix/webhook history pagination#1298

Open
elie222 wants to merge 5 commits intomainfrom
fix/webhook-history-pagination
Open

fix/webhook history pagination#1298
elie222 wants to merge 5 commits intomainfrom
fix/webhook-history-pagination

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Jan 16, 2026

User description

  • Add JSON format instruction to AI prompt system messages
  • Add capped Gmail history pagination
  • Test Gmail history pagination

Generated description

Below is a concise technical summary of the changes proposed in this PR:

graph LR
fetchGmailHistoryResilient_("fetchGmailHistoryResilient"):::modified
getHistory_("getHistory"):::modified
GMAIL_API_("GMAIL_API"):::modified
LOGGER_("LOGGER"):::modified
fetchGmailHistoryResilient_ -- "Adds paging support; aggregates up to 3 pages then caps." --> getHistory_
getHistory_ -- "Accepts optional pageToken to request specific history pages." --> GMAIL_API_
fetchGmailHistoryResilient_ -- "Logs when pagination capped, includes pagesFetched and cap limits." --> LOGGER_
classDef added stroke:#15AA7A
classDef removed stroke:#CD5270
classDef modified stroke:#EDAC4C
linkStyle default stroke:#CBD5E1,font-size:13px
Loading

Enhances the Gmail webhook processing flow by implementing capped history pagination and increasing timeout limits for webhook routes. Updates multiple AI system prompts to explicitly request JSON formatted responses, ensuring better integration with the application's data parsing logic.

TopicDetails
Gmail History Sync Implements a paginated loop in processHistoryForUser to fetch up to 3 pages or 1500 items from the Gmail history API, preventing data loss during high-volume updates. Includes new test cases in process-history.test.ts and increases maxDuration for webhook routes to accommodate the additional processing time.
Modified files (5)
  • apps/web/app/api/google/webhook/process-history.test.ts
  • apps/web/app/api/google/webhook/process-history.ts
  • apps/web/app/api/google/webhook/route.ts
  • apps/web/app/api/outlook/webhook/route.ts
  • apps/web/utils/gmail/history.ts
Latest Contributors(2)
UserCommitDate
elie222fix-prevent-Google-web...January 16, 2026
eduardoleliss@gmail.comSeparate-files-and-PR-...August 15, 2025
AI Prompt Updates Appends a JSON format instruction to the system messages of various AI utility functions, including aiSummarizeEmailForDigest, aiBuildUserPersona, and aiAnalyzeEmailBehavior, to ensure consistent structured output.
Modified files (8)
  • apps/web/utils/ai/digest/summarize-email-for-digest.ts
  • apps/web/utils/ai/document-filing/parse-filing-reply.ts
  • apps/web/utils/ai/report/analyze-email-behavior.ts
  • apps/web/utils/ai/report/analyze-label-optimization.ts
  • apps/web/utils/ai/report/build-user-persona.ts
  • apps/web/utils/ai/report/generate-actionable-recommendations.ts
  • apps/web/utils/ai/report/generate-executive-summary.ts
  • apps/web/utils/ai/report/response-patterns.ts
Latest Contributors(2)
UserCommitDate
elie222security-add-prompt-ha...January 14, 2026
eduardoleliss@gmail.comUpdate-prompt-and-temp...August 28, 2025
This pull request is reviewed by Baz. Review like a pro on (Baz).

@vercel
Copy link

vercel bot commented Jan 16, 2026

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

Project Deployment Review Updated (UTC)
inbox-zero Ready Ready Preview Jan 16, 2026 8:40pm

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 13 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/web/app/api/google/webhook/process-history.ts">

<violation number="1" location="apps/web/app/api/google/webhook/process-history.ts:369">
P3: Dead code: `if (!lastResponse)` can never be true since `lastResponse` is always assigned inside a `do-while` loop (which executes at least once). Consider removing this unreachable block.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

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