Repository navigation
fix(platform): read Gmail envelopes for the inbox triage digest - #4034
Merged
Merged
Conversation
Gmail's list_messages is users.messages.list and answers bare
{id, threadId} pairs, while Outlook and IMAP list subject, sender and
date in the same call. The triage fan-out behind
conversation.list_mailbox_messages read the rows straight off the
listing, so a live Gmail digest carried subject "", from "" and
receivedAt "" on every row and the model summarized nothing. The sync
pack never showed it because it fetches each body; the pack test never
showed it because the native's mock already answers the IMAP shape.
The Gmail branch now fetches each listed id with get_message
format=metadata (headers + snippet, no body, no attachment bytes),
normalizes it through the ingest normalizer and hands the digest the
same {id, subject, from, sentAt} row the IMAP listing has, plus the
snippet as the preview. A message gone between the list and the fetch
is skipped; every fetch failing fails the mailbox so a dead token
cannot read as an empty inbox.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A live run of Triage the Gmail inbox handed the model rows with
subject: "",from: "",receivedAt: "",preview: ""— only the Gmail id and the mailbox name were set — so the digest summarized nothing.Root cause: Gmail's
list_messagesisusers.messages.list, which answers bare{id, threadId}pairs (configs/platform/system/connectors/gmail/connector.yml:43). Outlook and IMAP list subject, sender and date in the same call, and the triage fan-out behindconversation.list_mailbox_messagesread the rows straight off the listing (sync_mailbox.tslistInbox). The sync pack never showed it because it fetches every body; the pack test never showed it because the native's mock already answers the IMAP row shape.What
listInbox: the Gmail branch now fetches each listed id withget_messageformat: metadata(headers + snippet — no body, no attachment bytes), normalizes it through the existing ingest normalizer and hands the digest the same{id, subject, from, sentAt}row the IMAP listing has, plussnippetas the preview. The three triage packs stay one document; the transform is untouched.sync_mailbox.test.ts: the Gmail dialect replaces the old list-only case (which replied a row shape Gmail never produces) — one metadata fetch per id with the listing credential, per-credential fan-out, the skip, the all-failed refusal, and Outlook reading off the listing alone. Harness gainsfailMessages.tests/manual/reference/automation.md: coverage row.Proof
vitest run backend/core/conversations/sync_mailbox.test.ts lib/automations/packs.test.ts— 108 passed; platform typecheck, oxlint,lint:manualgreen.mode: live,limit: 5run ofgmail-triage-inboxv2 finishedsuccesswith all five rows carrying subject, sender, ISO time and preview, and the model'ssummarydescribing the actual mail (needsReply: []). Each row cost oneusers.messages.get?format=metadata.