Skip to content

Buzz: adding an agent mention through message edit does not activate Hermes #3

Description

@reinhold-ph

Bug description

The Buzz adapter does not receive or process edited messages (kind:40003). If a user initially posts an unmentioned channel message and then edits it to add @Agent, Buzz correctly emits an edit event carrying the newly added agent mention, but Hermes never wakes.

This makes Buzz Desktop's "new mention added by edit" behavior ineffective for Hermes agents.

Reproduction

  1. Configure the Hermes Buzz gateway with both require_mention: true and WebSocket transport.
  2. In a watched shared Buzz channel, send a message without mentioning the Hermes agent.
  3. Edit that message and add the Hermes agent through Buzz's mention picker.
  4. Observe that Buzz publishes a kind:40003 edit event containing:
    • the edited content beginning with @Agent;
    • an e tag targeting the original kind:9 event;
    • the agent's exact p tag;
    • the corresponding mention tag and buzz:mention-snapshot marker.
  5. Observe that Hermes does not receive or answer the edited message.
  6. Send the same mention as a new kind:9 message; Hermes receives it immediately.

Expected behavior

A kind:40003 edit that adds a new valid mention for the Hermes identity should activate the agent once, using the edited content and preserving the original message/thread route.

Ordinary edits that do not newly mention the agent must not re-trigger it.

Actual behavior

Hermes ignores every Buzz edit event, including edits carrying a newly added mention.

Confirmed root cause

The Buzz adapter defines only kind:9 as inbound chat:

_CHAT_KIND = 9

Its WebSocket subscription requests only that kind:

{"kinds": [_CHAT_KIND], "#h": [channel_id], "since": since}

The shared inbound handler also drops every event whose kind is not _CHAT_KIND:

if int(event.get("kind") or 0) != _CHAT_KIND:
    return

Therefore kind:40003 edit events never reach mention gating or dispatch. Polling has the same semantic gap because _handle_event() rejects the edit kind.

Relevant file: plugins/platforms/buzz/adapter.py.

Suggested fix constraints

  • Subscribe to and fetch kind:40003 alongside kind:9.
  • Resolve the edit's target from its e tag and retain the original thread/routing semantics.
  • Dispatch only when the edit adds this Hermes identity as a new mention; do not re-run the agent for typo fixes or unchanged mentions.
  • Deduplicate by edit event ID so reconnect/poll overlap cannot activate twice.
  • Add WebSocket and polling regression tests covering:
    1. unmentioned original → edit adds Hermes mention → one dispatch;
    2. edit without a new Hermes mention → no dispatch;
    3. replay of the same edit → no duplicate dispatch;
    4. thread reply edit preserves the original thread route.

Environment

  • Hermes Buzz gateway using WebSocket transport
  • Buzz message event kind: 9
  • Buzz message-edit event kind: 40003

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions