fix(email): avoid double-decoding HTML entities - #68707
Conversation
|
Thanks for the focused regression fix. Current Automated hermes-sweeper review. |
|
Overlap note (2026-08-03): this PR addresses the same topic (HTML email delivery). PR #73294 (swissly) consolidates Markdown-to-HTML rendering for ALL 4 send paths + allowlist sanitizer + 20 tests, and was just rebased onto current main (commit 9529ee30). Please review #73294 for consolidation rather than duplicating send-path fixes. |
|
Coordination note from #73294 (swissly, 2026-08-03): Agreed — #68707 is the correct, minimal fix for #68704 (decode Scope clarification: #73294 (Markdown-to-HTML rendering) touches the SEND paths ( Recommendation to maintainers: #68707 can merge independently of #73294. |
SummaryOne PR addresses issue #68704. The diff of #68707 changes the entity-decoding order in Related pull requests
Suggested consolidationKeep #68707 open with a salvage path: retain its minimal decoding-order correction and focused regression test for #68704. No supplied PR is a duplicate; specifically, the discussion identifies #73294 as complementary outbound-email work rather than an alternative fix for the receive/fallback path. Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I68704(["issue #68704 (open)"])
P68707["PR #68707 (open)"]
P68707 -->|best fix| I68704
class I68704 open
class P68707 open
class P68707 best
class P68707 target
click I68704 "https://github.com/NousResearch/hermes-agent/issues/68704"
click P68707 "https://github.com/NousResearch/hermes-agent/pull/68707"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 1 kB of PR diffs, 3 kB of issue/PR text, 1 kB of discussion (2 comments), 2 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
Nested escaped text like &lt;APIKEY&gt; was decoded twice in one _strip_html call (& -> &, then < -> <), producing <APIKEY> instead of literal <APIKEY>. Decode </> before & so each entity layer is decoded at most once (issue NousResearch#68704). Same fix as PR NousResearch#68707 (tooiuiiu); applied locally for immediate effect, kept out of PR NousResearch#73294 (send-path scope). Tests: +2 regression cases.
3ba56f8 to
2054488
Compare
What does this PR do?
Prevents the email HTML fallback from decoding two entity layers in one pass. Nested escaped text such as
&lt;APIKEY&gt;now remains literal<APIKEY>instead of becoming<APIKEY>.Related Issue
Fixes #68704
Type of Change
Changes Made
<and>before&inplugins/platforms/email/adapter.py.tests/gateway/test_email.py.How to Test
pytest tests/gateway/test_email.py -q -k strip_html._strip_html("The token is &lt;APIKEY&gt;")returnsThe token is <APIKEY>.Checklist
Code
pytest tests/ -qand all tests passDocumentation & Housekeeping
cli-config.yaml.example: N/ACONTRIBUTING.md/AGENTS.md: N/AScreenshots / Logs
Focused regression suite:
Ruff passed for both touched files. A whole-file run reached one unrelated existing Windows environment failure in
TestConfigEnvOverrides.test_email_not_loaded_without_env: clearing all environment variables makesPath.home()unable to resolve. The focused behavior covered by this PR passes.