fix(tools): route encrypted matrix send_message through adapter - #23382
Closed
32r4 wants to merge 1 commit into
Closed
fix(tools): route encrypted matrix send_message through adapter#2338232r4 wants to merge 1 commit into
32r4 wants to merge 1 commit into
Conversation
Collaborator
|
Duplicate of #20259 — same fix (route text-only Matrix send_message through adapter when E2EE is enabled). Same files changed, same approach. |
Contributor
|
Closing as a duplicate of #20259, which fixed the same text-only Matrix E2EE routing bug and was submitted first (May 5 vs your May 10). Merged via PR #56106 (commit a537baa on main). Both approaches route text-only Matrix sends through the adapter; #20259 routes unconditionally, which is simpler and correct since the adapter sends plaintext to unencrypted rooms fine. Thanks for the contribution and the extra live-adapter-reuse test coverage — appreciated. |
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.
What does this PR do?
Fixes Matrix
send_messagedelivery for encrypted rooms. Before this change, text-only Matrix sends used the lightweight direct/_matrix/client/v3/rooms/.../send/m.room.message/...path, which bypassed the gateway'smautrixE2EE client and caused plaintext sends to fail in encrypted rooms. This PR routes encrypted Matrix sends through the adapter path that already handles E2EE correctly, while preserving the lightweight direct send path for non-E2EE text-only sends.Related Issue
Fixes #23055
Type of Change
Changes Made
_send_matrix_via_adapter()whenever media is attached or Matrix encryption is enabled._send_matrix_via_adapter()to reuse the live gateway Matrix adapter when available before creating a temporary adapter instance./tmp/...path totmp_path, so it passes on Windows.How to Test
MATRIX_ENCRYPTION=trueand a reachable encrypted room.send_messageto send a text-only message to that Matrix target.m.room.messageREST send.uv run pytest -q tests/tools/test_send_message_tool.py -quv run pytest -q tests/tools/test_send_message_missing_platforms.py -qChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
uv run pytestcoverage for the affected Matrix send_message paths.PermissionErrorat interpreter exit in this environment; the test runs themselves complete successfully.