Skip to content

fix(matrix): remove eyes reaction on processing complete - #6852

Closed
fxfitz wants to merge 3 commits into
NousResearch:mainfrom
fxfitz:fix/matrix-reaction-cleanup-v2
Closed

fix(matrix): remove eyes reaction on processing complete#6852
fxfitz wants to merge 3 commits into
NousResearch:mainfrom
fxfitz:fix/matrix-reaction-cleanup-v2

Conversation

@fxfitz

@fxfitz fxfitz commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Problem

When Hermes starts processing a Matrix message, it adds the 👀 (eyes) reaction. When processing completes, the 👀 is never removed — both 👀 and ✅/❌ appear together instead of the eyes being replaced.

Root Cause

_send_reaction() returned only a bool and discarded the reaction event ID from the Matrix server. Without that event ID, on_processing_complete had no way to call _redact_reaction(), so it just added the completion emoji alongside the eyes.

Discord doesn't have this issue — its API lets you remove reactions by emoji name directly.

Fix

  1. _send_reactionOptional[str]: Now returns the reaction event ID from RoomSendResponse.event_id.
  2. New _pending_reactions dict: Tracks (room_id, message_event_id) → reaction_event_id.
  3. on_processing_start: Stores the eyes reaction event ID after sending.
  4. on_processing_complete: Redacts the eyes reaction before sending the completion emoji. Logs a debug message if redaction fails.

Testing

✅ Fix has been running locally on this deployment. 👀 is now correctly removed and replaced with ✅/❌.

Test coverage includes:

  • success=True path (eyes redacted, ✅ sent)
  • success=False path (eyes redacted, ❌ sent)
  • No pending reaction edge case (redaction skipped, completion emoji still sent)

Note: Telegram (issue #6068) may have the same pattern.


Branch: fxfitz/hermes-agent@8cdda296 (based on upstream main 3b554bf8)
Locally tested:

fxfitz and others added 3 commits April 9, 2026 18:28
The on_processing_complete handler was never removing the eyes reaction because
_send_reaction didn't return the reaction event_id.

Fix:
- _send_reaction returns Optional[str] event_id
- on_processing_start stores it in _pending_reactions dict
- on_processing_complete redacts the eyes reaction before adding completion emoji
_send_reaction now returns Optional[str] (event_id) instead of bool.
Tests updated:
- test_send_reaction: assert result == event_id string
- test_send_reaction_no_client: assert result is None
- test_on_processing_start_sends_eyes: _send_reaction returns event_id,
  now also asserts _pending_reactions is populated
- test_on_processing_complete_sends_check: set up _pending_reactions and
  mock _redact_reaction, assert eyes reaction is redacted before sending check
Add debug logging when eyes reaction redaction fails, and add tests
for the success=False path and the no-pending-reaction edge case.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #7154. All 3 commits were cherry-picked with your authorship preserved. We rebased onto the new ProcessingOutcome enum API (from a concurrent PR) and resolved the conflicts. Thanks for the clean fix!

@teknium1 teknium1 closed this Apr 10, 2026
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