mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
fix(matrix): route text-only send_message through adapter for E2EE support
Text-only Matrix messages sent via the send_message engine (hermes send, cron deliver: matrix) arrived unencrypted (red padlock) in E2EE rooms. Media sends already routed through the mautrix adapter and encrypted fine, but text-only sends took the raw-HTTP standalone_sender_fn path, which never encrypts. Route ALL Matrix sends through _send_matrix_via_adapter so text is encrypted too. The adapter reuses the live gateway's E2EE session when available (#46310) and falls back to an encryption-aware ephemeral adapter for standalone/cron contexts. The registry standalone_sender_fn stays registered for the contract; it is simply no longer reached for Matrix. Salvaged from PR #20259 onto current main (the original patched the pre-#41112 _send_matrix branch, which had since moved to the plugin's standalone path). Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
This commit is contained in:
parent
cc1e4c32c0
commit
a537baa81d
2 changed files with 18 additions and 13 deletions
|
|
@ -829,8 +829,12 @@ async def _send_to_platform(platform, pconfig, chat_id, message, thread_id=None,
|
|||
last_result = result
|
||||
return last_result
|
||||
|
||||
# --- Matrix: use the native adapter helper when media is present ---
|
||||
if platform == Platform.MATRIX and media_files:
|
||||
# --- Matrix: route ALL sends through the native adapter so text is
|
||||
# encrypted in E2EE rooms too (issue: text-only sends arrived with a red
|
||||
# padlock because they took the raw-HTTP standalone path). The adapter
|
||||
# reuses the live gateway's E2EE session when available (#46310) and falls
|
||||
# back to an encryption-aware ephemeral adapter for standalone/cron. ---
|
||||
if platform == Platform.MATRIX:
|
||||
last_result = None
|
||||
for i, chunk in enumerate(chunks):
|
||||
is_last = (i == len(chunks) - 1)
|
||||
|
|
@ -965,8 +969,6 @@ async def _send_to_platform(platform, pconfig, chat_id, message, thread_id=None,
|
|||
result = await _registry_standalone_send("email", pconfig, chat_id, chunk, thread_id)
|
||||
elif platform == Platform.SMS:
|
||||
result = await _registry_standalone_send("sms", pconfig, chat_id, chunk, thread_id)
|
||||
elif platform == Platform.MATRIX:
|
||||
result = await _registry_standalone_send("matrix", pconfig, chat_id, chunk, thread_id)
|
||||
elif platform == Platform.DINGTALK:
|
||||
result = await _registry_standalone_send("dingtalk", pconfig, chat_id, chunk, thread_id)
|
||||
elif platform == Platform.FEISHU:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue