Repository navigation
revert(gmail): sync sent hiring-thread messages - #4610
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebf431d34c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if strings.EqualFold(msg.FromAddr, u.Email) { | ||
| return | ||
| } |
There was a problem hiding this comment.
Keep provider labels when disabling sent discovery
When a candidate sends from a Gmail alias, or a draft appears during thread expansion, FromAddr does not necessarily equal the connected primary address, so this check allows the message through. Because the revert also stops parsing Gmail's SENT/DRAFT labels, the insert uses the schema's incoming default and the message can be classified as an employer reply, linked, and used to advance the application stage. Sent-mail discovery can remain disabled while retaining provider-label parsing and skipping sent/draft siblings here.
Useful? React with 👍 / 👎.
| -- snippet already detoasts body_text, so the extra column costs no extra read; | ||
| -- it is guarded only to keep the web inbox's payload small. | ||
| SELECT emails.id, emails.source, emails.external_id, emails.thread_id, emails.direction, emails.to_addrs, emails.cc_addrs, emails.from_addr, emails.from_name, emails.subject, | ||
| SELECT emails.id, emails.source, emails.external_id, emails.from_addr, emails.from_name, emails.subject, |
There was a problem hiding this comment.
Preserve handling for already-stored outgoing messages
For mailboxes that completed the rolled-back sync before this revert, emails can already contain rows with direction = 'outgoing'; the migration and those rows are intentionally retained. This query still returns those rows but no longer exposes their direction, so the API and web UI render the candidate's own messages as ordinary inbound mail, while related unclassified counts can remain permanently nonzero because the classifier correctly refuses outgoing rows. Keep the direction-aware reader behavior, filter these rows, or explicitly clean up the stored outgoing data during rollback.
Useful? React with 👍 / 👎.
|
OpenCodeReview — commit Review incomplete. Retry with medium · low · high · medium · medium · medium · |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b3619f85d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| log.Printf("gmail-sync: user %d: thread %s: %v", u.UserID, tid, err) | ||
| sawFailure = true | ||
| continue |
There was a problem hiding this comment.
Preserve the sync cursor when thread expansion fails transiently
If ListThreadMessageIDs returns a transient error, such as a 503, this path now continues without setting sawFailure, so SetSynced advances the cursor despite never fetching that thread's siblings. When another successfully fetched message moves the watermark past the failed thread's anchor, subsequent BuildQueryFor searches exclude that anchor, and this revert also removes the stored-thread scan that could revisit it. Recruiter replies without hiring-search markers can therefore be permanently missed after a temporary Gmail failure. Retain the previous cursor on transient thread-list failures so the next sync retries the expansion.
Useful? React with 👍 / 👎.
… connected The first sync on #4604 re-read every stored thread of every mailbox at once; Google answered part of the burst with 403 rateLimitExceeded, which RevokedGrant read as a revoked grant, so 4 of 18 mailboxes were flagged needs_reconsent and the release was rolled back (#4610). - APIError now carries Google's error reason; a 403 whose reason is a rate limit or quota is not a revocation (Gmail and Calendar readers). - The first sent-mail scan expands only the 50 newest stored conversations.
…-limit handling (#4611) * Revert "revert(gmail): sync sent hiring-thread messages (#4610)" This reverts commit 7bd5212. * fix(gmail): bound the first sent-mail scan and keep rate-limited 403s connected The first sync on #4604 re-read every stored thread of every mailbox at once; Google answered part of the burst with 403 rateLimitExceeded, which RevokedGrant read as a revoked grant, so 4 of 18 mailboxes were flagged needs_reconsent and the release was rolled back (#4610). - APIError now carries Google's error reason; a 403 whose reason is a rate limit or quota is not a revocation (Gmail and Calendar readers). - The first sent-mail scan expands only the 50 newest stored conversations. * fix(mentorship): read the Google error reason on calendar and Meet calls The free/busy and Meet event calls share the grant flag, so a rate-limited 403 there must not read as a revocation either. * fix(gmail): stop a sync run when Google rate-limits it A rate-limited 403 or 429 no longer reads as a revocation, so the wave must stop on it by itself instead of issuing every remaining call into the same limit. * fix(mail): hide deleted linked emails from a job's list Also documents the 50-thread bound of the first sent-mail backfill in the OpenSpec change.
This reverts commit d319fcf.
Why: the first Gmail sync run on the build carrying "sync sent hiring-thread messages" (#4604) disconnected users' Gmail. With no sent-mail cursor yet, the worker re-read every known thread of every connected mailbox in one burst. Google answered some of those reads with 403, and the sync treats any 403 as a revoked grant, so it marked the connection "needs reconnect". In that one run 4 of 18 connected mailboxes were switched to needs-reconnect, all of them mailboxes whose sync had succeeded minutes earlier, against roughly one such case every couple of hours before. The release was rolled back and automatic deploys are held until this revert (or a fix) is on main.
The migration that adds the message direction and sent cursor columns came in with #4603 and stays: this revert changes no migration, and the old code ignores the extra columns.
Re-landing the sent-mail sync needs, at least: the first scan per mailbox paced or bounded (not every known thread at once), and a 403 that is a rate limit (reason in the response body) not treated as a revoked grant.
🤖 Generated with Claude Code