Repository navigation
feat(email): opt in to preserving inbound HTML formatting - #130858
Open
Wenfengcheng wants to merge 4 commits into
Open
Wenfengcheng wants to merge 4 commits into
Wenfengcheng wants to merge 4 commits into
Conversation
This branch has not been deployed
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.
Problem
Fixes #23695.
Incoming email formatting can carry meaning (red/green review decisions, headings, font sizes). The email adapter always prefers
text/plainand strips tags from HTML-only messages, so the agent cannot see that information even when an operator wants it.Root cause
EmailAdapter._parse_fetched_messageunconditionally calls_extract_text_bodyin plaintext mode. There is no inbound HTML preference in the adapter config. Existing outbound HTML PRs (#25441, #93294) address a different direction; #68707 addresses entity decoding, not choosing the HTML MIME alternative.Change
platforms.email.preserve_html: true, default false, through the existingPlatformConfig.extrapath and boolean parser._first_body_partand_safe_decodeto prefer non-empty, non-attachment HTML, retaining plaintext fallback and default behavior.Verification
Base:
dad9c567482c5f365e4922d9348622378de91759.Native Windows, isolated HOME/USERPROFILE/HERMES_HOME/APPDATA/LOCALAPPDATA, existing Python 3.11 test interpreter; no live mailbox or credentials.
bash scripts/run_tests.sh tests/gateway/test_email_preserve_html.py -j 2 --file-retries 0git diff --checkpassed.Post-publication continuation on the same PR:
Exact-head review at
80902e85e6d3be3c4036f571b9462b717d630563: Codex STATIC PASS. Claude Code 2.1.280 / Opus 5.5 returned repeated HTTP 503 and hit the bounded timeout; its review remains pending, not PASS.Scope / remaining
All requested inbound
preserve_htmlbehavior is implemented. Outbound rich email, HTML sanitization/rendering, charset redesign, and sender authorization are unchanged. No live IMAP/SMTP validation is claimed.