Skip to content

fix(send_message): deliver Matrix media via adapter - #10486

Closed
helix4u wants to merge 1 commit into
NousResearch:mainfrom
helix4u:fix/matrix-send-message-media-delivery
Closed

fix(send_message): deliver Matrix media via adapter#10486
helix4u wants to merge 1 commit into
NousResearch:mainfrom
helix4u:fix/matrix-send-message-media-delivery

Conversation

@helix4u

@helix4u helix4u commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes Matrix media delivery for send_message. The Matrix gateway adapter already supported native file uploads, but tools/send_message_tool.py still treated Matrix like a text-only platform and dropped media attachments before they ever reached the adapter. This wires Matrix into the native adapter-backed media path so generated PDFs and other attachments actually get uploaded to Matrix rooms.

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Added a Matrix-specific native media branch in tools/send_message_tool.py so send_message routes Matrix attachments through the Matrix adapter instead of dropping them.
  • Added _send_matrix_via_adapter() to preserve native Matrix document/image/audio/video delivery.
  • Added targeted tests covering Matrix media routing and adapter-backed document delivery.
  • Updated a stale Matrix URL-encoding assertion in tests/tools/test_send_message_missing_platforms.py.

How to Test

  1. Configure a Matrix gateway and send a send_message payload that includes a local PDF attachment.
  2. Verify the text message still sends and the PDF is uploaded as a Matrix file attachment.
  3. Run source venv/bin/activate && python -m pytest tests/tools/test_send_message_tool.py tests/tools/test_send_message_missing_platforms.py -q

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Ubuntu/WSL

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

Targeted test slice passed:

source venv/bin/activate && python -m pytest tests/tools/test_send_message_tool.py tests/tools/test_send_message_missing_platforms.py -q

I also kicked off the full suite, but this workspace was already red outside this change area, so I am not claiming full-suite green here.

@helix4u
helix4u marked this pull request as ready for review April 15, 2026 20:10
teknium1 added a commit that referenced this pull request Apr 16, 2026
Matrix media delivery was silently dropped by send_message because Matrix
wasn't wired into the native adapter-backed media path. Only Telegram,
Discord, and Weixin had native media support.

Adds _send_matrix_via_adapter() which creates a MatrixAdapter instance,
connects, sends text + media via the adapter's native upload methods
(send_document, send_image_file, send_video, send_voice), then disconnects.

Also fixes a stale URL-encoding assertion in test_send_message_missing_platforms
that broke after PR #10151 added quote() to room IDs.

Cherry-picked from PR #10486 by helix4u.
teknium1 added a commit that referenced this pull request Apr 16, 2026
Matrix media delivery was silently dropped by send_message because Matrix
wasn't wired into the native adapter-backed media path. Only Telegram,
Discord, and Weixin had native media support.

Adds _send_matrix_via_adapter() which creates a MatrixAdapter instance,
connects, sends text + media via the adapter's native upload methods
(send_document, send_image_file, send_video, send_voice), then disconnects.

Also fixes a stale URL-encoding assertion in test_send_message_missing_platforms
that broke after PR #10151 added quote() to room IDs.

Cherry-picked from PR #10486 by helix4u.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #10602. Your commit was cherry-picked onto current main with authorship preserved in git log. Follow-up fix added: gated the adapter path on media_files presence so text-only Matrix sends continue using the lightweight HTTP helper instead of spinning up a full MatrixAdapter each time. Thanks @helix4u!

kagura-agent pushed a commit to kagura-agent/hermes-agent that referenced this pull request Apr 16, 2026
Matrix media delivery was silently dropped by send_message because Matrix
wasn't wired into the native adapter-backed media path. Only Telegram,
Discord, and Weixin had native media support.

Adds _send_matrix_via_adapter() which creates a MatrixAdapter instance,
connects, sends text + media via the adapter's native upload methods
(send_document, send_image_file, send_video, send_voice), then disconnects.

Also fixes a stale URL-encoding assertion in test_send_message_missing_platforms
that broke after PR NousResearch#10151 added quote() to room IDs.

Cherry-picked from PR NousResearch#10486 by helix4u.
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
Matrix media delivery was silently dropped by send_message because Matrix
wasn't wired into the native adapter-backed media path. Only Telegram,
Discord, and Weixin had native media support.

Adds _send_matrix_via_adapter() which creates a MatrixAdapter instance,
connects, sends text + media via the adapter's native upload methods
(send_document, send_image_file, send_video, send_voice), then disconnects.

Also fixes a stale URL-encoding assertion in test_send_message_missing_platforms
that broke after PR NousResearch#10151 added quote() to room IDs.

Cherry-picked from PR NousResearch#10486 by helix4u.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
Matrix media delivery was silently dropped by send_message because Matrix
wasn't wired into the native adapter-backed media path. Only Telegram,
Discord, and Weixin had native media support.

Adds _send_matrix_via_adapter() which creates a MatrixAdapter instance,
connects, sends text + media via the adapter's native upload methods
(send_document, send_image_file, send_video, send_voice), then disconnects.

Also fixes a stale URL-encoding assertion in test_send_message_missing_platforms
that broke after PR NousResearch#10151 added quote() to room IDs.

Cherry-picked from PR NousResearch#10486 by helix4u.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
Matrix media delivery was silently dropped by send_message because Matrix
wasn't wired into the native adapter-backed media path. Only Telegram,
Discord, and Weixin had native media support.

Adds _send_matrix_via_adapter() which creates a MatrixAdapter instance,
connects, sends text + media via the adapter's native upload methods
(send_document, send_image_file, send_video, send_voice), then disconnects.

Also fixes a stale URL-encoding assertion in test_send_message_missing_platforms
that broke after PR NousResearch#10151 added quote() to room IDs.

Cherry-picked from PR NousResearch#10486 by helix4u.
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
Matrix media delivery was silently dropped by send_message because Matrix
wasn't wired into the native adapter-backed media path. Only Telegram,
Discord, and Weixin had native media support.

Adds _send_matrix_via_adapter() which creates a MatrixAdapter instance,
connects, sends text + media via the adapter's native upload methods
(send_document, send_image_file, send_video, send_voice), then disconnects.

Also fixes a stale URL-encoding assertion in test_send_message_missing_platforms
that broke after PR NousResearch#10151 added quote() to room IDs.

Cherry-picked from PR NousResearch#10486 by helix4u.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants