Extract attachment text in the sync worker, in a limited child process #73
Labels
No labels
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/mail-mind-mcp#73
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent: #9 (Phase 4). Decision: ADR 0007.
Extract the text of each in-scope attachment in the sync worker, store it in the mirror, and index it in FTS5. The bytes never reach the disk.
Scope
AttachmentsConfiginconfig.py: an optional[attachments]section withmax_bytes,per_message,max_charsandper_pass(ADR 0007 §3, §5). Absent means nothing is fetched.src/imap_mailmind_mcp/extract.py(new):python -I -m imap_mailmind_mcp.extract <kind>, which reads bytes on stdin and writes text on stdout;RLIMIT_CPU10 s (pypdf and stdlib) or 30 s (MarkItDown),RLIMIT_AS512 MiB or 1 GiB, a wall timeout of twice the CPU limit, an environment ofPATHonly, and stderr discarded;DocxConverter,PptxConverter,OutlookMsgConverterandHtmlConverterregistered, built-ins and plugins off; a stdlib reader for XLSX that writes Markdown table rows; charset decoding for the text types;socket.socketdisabled in the child before any parser import.markitdown[docx,pptx,outlook]to one release, inpyproject.tomlanduv.lock. Measure the amd64 image growth and the child address space, and set theRLIMIT_ASvalues from that measurement.store.py:attachment_text(message_id, part, status, text)and one more FTS5 column for the joined attachment text. A deleted message loses its rows in the same transaction.blob_keyfor the backlog; then the IMAP section fetch or the JMAP blob download. The raw-bytes fallback uses the bytes it holds. A raw-message extraction matches each MIME attachment to the stored list by position, name, type and size.per_passattachments, and the worker shortens its wait while a backlog remains.mail_statusshows the extracted count and the backlog for each account.Acceptance
timeout, and a zip bomb is refused from its declared size;failedand the parent goes on;too_large,skipped,unsupported;.zipand a.pdf;[blobs]set, new mail is extracted with no extra fetch, and the backlog reads the bucket;failed;mail_searchon a word from the attachment only.config.example.toml, SECURITY.md and CLAUDE.md name the section, the formats and the limits.make checkandmake test-integrationpass.Blocked by
Human act
ruling: the operator approves parsing hostile attachments in a child process of the sync container (CONV-40)
Filed under: operator word "resume phase 4 development." sha256:b5be33c704e1