Repository navigation
Description
An email's body reaches no index. A conversation is searchable by subject only, and message content is searchable nowhere.
Why it matters
The context that explains an attachment usually lives in the covering email, not in the attachment. A CV named for its author says nothing about the role it was sent for; the email saying "applying for the field sales agent role" does. Today that sentence is invisible to every retrieval leg, so a question about what came in for a role can only match a document whose own text happens to use those words.
Observed on a live deployment: two CVs in the corpus, one findable by role because its own text repeats the job title, the other not findable at all despite being indexed and in scope.
Status quo
convex/conversations/search_for_chat.tsmatchestextFields: ['subject'], with its own comment noting message bodies are not searched.- No path indexes message bodies into the corpus. Only Document Hub files and, since feat(platform): index an emailed attachment for its conversation #3012, mail attachments.
indexDocumentalready acceptstextdirectly, so a body needs no blob.lib/knowledge/html-to-text.tsexists and should be reused rather than duplicated.
The obstacle
Every corpus ref resolves through fileMetadata.by_storageId in filterRetrievableRagFileIds. A message has no fileMetadata row, so a message hit would be denied outright. Indexing bodies therefore needs a new ref class and a new branch in that gate, deciding a message by its conversation's live assignment — the same predicate attachments use.
Shape
- Message-scoped corpus refs: the ref format and the gate branch, with nothing indexed. Mechanism first, no behaviour change — the same sequencing feat(platform): scope a corpus row to its conversation #3011 used before feat(platform): index an emailed attachment for its conversation #3012.
- Index bodies on ingest, together with the erasure cascade.
governance/erasure.tscountsragDocumentsRemovedand has afileMetadatacategory; a new corpus class without a cascade means an erasure request leaves message text behind, so the two must land together.
Constraints
- Skip empty bodies. Mail arrives with no subject and no body, and an empty corpus row matches nothing while costing a row.
- Volume is per message, not per attachment — every send and receive. This is where Bug: background ingestion shares the interactive RAG indexing budget and can starve it #2987's shared indexing budget stops being theoretical.
Open questions
- Should a message ref be fetchable by
rag_fetch, or should a hit cite its conversation instead? Conversations are already a first-class read subject since feat(platform): let chat search conversations, under assignment privacy #3006. - Outbound as well as inbound? Indexing our own sent mail may be mostly noise.
Activity
feat(platform): index inbound email bodies for chat retrieval