Skip to content

fix(platform): read Gmail envelopes for the inbox triage digest - #4034

Merged
larryro merged 1 commit into
mainfrom
fix/gmail-triage-digest-rows
Oct 1, 2026
Merged

larryro merged 1 commit into
mainfrom
fix/gmail-triage-digest-rows

Conversation

@larryro

@larryro larryro commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

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_messages is users.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 behind conversation.list_mailbox_messages read the rows straight off the listing (sync_mailbox.ts listInbox). 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 with get_message format: 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, plus snippet as the preview. The three triage packs stay one document; the transform is untouched.
  • A message gone between the list and the fetch is skipped (warned); every fetch failing fails that mailbox, so a dead token cannot read as an empty inbox. The existing per-mailbox skip still folds it.
  • 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 gains failMessages.
  • 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:manual green.
  • Live on the dev stack after a backend restart: one mode: live, limit: 5 run of gmail-triage-inbox v2 finished success with all five rows carrying subject, sender, ISO time and preview, and the model's summary describing the actual mail (needsReply: []). Each row cost one users.messages.get?format=metadata.

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.
@larryro
larryro merged commit c278e4e into main Oct 1, 2026
62 checks passed
@larryro
larryro deleted the fix/gmail-triage-digest-rows branch October 1, 2026 07:54
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