Commit graph

4 commits

Author SHA1 Message Date
240279f95b refactor: eliminate redundant truncation in email_ingest and fix em dash
- Replace em dash with hyphen in thread_ingest.py user message (feedback_no_emdash.md)
- Remove duplicate truncation logic in email_ingest.py (lines 12-17 and _truncate_for_embed method)
- Consolidate truncation responsibility to ping.py's _safe_field_value as single source of truth
- This prevents email_ingest's marker from being re-truncated by ping.py's defensive catch-all
2026-07-13 15:08:35 -07:00
75ee9f8117 fix: prevent Discord embed field 400s from empty/oversized values
C1: build_ping_embed set sender_id field value="" whenever sender_id was
None, which manual_share.py always passes -- Discord rejects empty embed
field values (min length 1), so every manual-share ping failed to send.
Fixed by using a zero-width space sentinel that round-trips back to ""
(raw_content) or None (sender_id) in parse_ping_embed. Added regression
tests asserting no field value is ever empty after build_ping_embed runs.

C2: raw_content over 1024 chars (Discord's embed field cap) caused
inbox.send() to raise before the UID was marked seen, so oversized emails
were retried forever and never ingested. Added a defensive hard truncation
in build_ping_embed itself, plus an explicit truncation in email_ingest.py
before the embed is built (lossy for very long emails, acceptable for MVP).
2026-07-13 15:01:23 -07:00
f1bf86a5c9 fix(bot): preserve HTML body content and isolate mailbox poll failures
_extract_body previously discarded real HTML content, replacing it with
a placeholder whenever a multipart email had no text/plain part. Now
falls back to the raw text/html payload before giving up, only using
the placeholder when a message has no text-bearing part at all.

poll_mailboxes also had no error isolation: an unhandled IMAP exception
from any one mailbox would stop the discord.ext.tasks.Loop permanently,
silently killing ingestion for all three mailboxes. Each mailbox's poll
is now wrapped in try/except so one failure doesn't block the others.
2026-07-13 14:12:46 -07:00
f4b57238d2 feat(bot): add email ingestion polling and thread-open triage creation 2026-07-13 14:07:53 -07:00