feat(matrix): agent-facing add_reaction/remove_reaction (photon parity) - #77994
Open
CocaKova wants to merge 1 commit into
Open
feat(matrix): agent-facing add_reaction/remove_reaction (photon parity)#77994CocaKova wants to merge 1 commit into
CocaKova wants to merge 1 commit into
Conversation
send_message(action="react") dispatches by duck-typing public add_reaction/remove_reaction on the live adapter. Photon ships the pair; Matrix had only the private _send_reaction machinery, so reacting on Matrix errored "Platform 'matrix' does not support message reactions" even though the adapter already posts native m.reaction annotations for its lifecycle tapbacks. Add the public pair, mirroring photon's semantics: default target is the room's most recent inbound message (recorded in on_processing_start before the MATRIX_REACTIONS gate — that env var mutes the automatic tapback noise, not deliberate agent intents), explicit message_id overrides, and unreact redacts only annotations this process placed. 8 new tests in tests/gateway/test_matrix_agent_reactions.py; 173 matrix gateway tests + the send_message react dispatch and photon reaction suites all green.
This was referenced Aug 5, 2026
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
send_message(action="react")resolves reactions by duck-typing publicadd_reaction/remove_reactioncoroutines on the live adapter (tools/send_message_tool.py). The photon adapter ships the pair; Matrix has only the private_send_reaction/_redact_reactionmachinery it uses for lifecycle tapbacks (👀/✅) — so reacting on Matrix errorsPlatform 'matrix' does not support message reactionseven though the adapter can already post nativem.reactionannotations.This adds the public pair to the Matrix adapter, mirroring photon's semantics:
on_processing_startbefore theMATRIX_REACTIONSgate — that env var exists to mute the automatic tapback noise, not deliberate requests; same policy photon documents forPHOTON_REACTIONS).message_idoverrides the default.remove_reactionredacts only annotations this process placed (tracked per(room, target)), so lifecycle tapbacks keep managing their own redaction.Reactions land as standard
m.annotationrelations, so Element and other Matrix clients render them natively.Why
Reaction support on Matrix is half-shipped today: the dispatch layer and its tests exist, photon and signal implement their sides, and
website/docs/user-guide/messaging/matrix.md("Matrix Tools and Controls") advertises reaction ability — but the Matrix adapter never grew the public verbs, so the MCP surface (mcp_serve.pyexposessend_messagewholesale) errors on Matrix. Verified end-to-end against a live Synapse homeserver before submitting: the agent's reaction arrives as a native annotation and renders in Element.Related but out of scope: that same docs section lists several
matrix_*tools (matrix_send_reaction,matrix_fetch_history, …) that don't exist in the tree — worth a separate docs pass.Tests
8 new tests in
tests/gateway/test_matrix_agent_reactions.py(default targeting, explicit id, no-target and send-failure error paths, unreact redaction + own-annotation guard, target recording underMATRIX_REACTIONS=false, and thesend_messagedispatch end-to-end via a stub runner). 173 matrix gateway tests +tests/tools/test_send_message_react.py+ the photon reaction suite all pass.