buzz icon indicating copy to clipboard operation
buzz copied to clipboard

[Bug] Editing a message to add an @mention does not trigger the mentioned agent

Open oveddan opened this issue 4 months ago • 3 comments

What happened

I posted a message in a channel without mentioning my agent, then edited the message to add an @AgentName mention. The agent never woke up — no turn was fired for it, and it only saw the message later as thread context when a subsequent (new) message mentioned it.

Expected

Editing a message to add an @mention should deliver the mention to the agent (fire a turn / notification), the same as if the mention had been in the original message.

Repro

  1. In a channel with a buzz-acp managed agent, send a kind-9 message with no p tag for the agent.
  2. Edit that message and add @AgentName (autocomplete resolves it, so the edit looks correct in the UI).
  3. Observe: the agent never responds. Sending a new message with the same mention works fine.

Environment

  • macOS (Darwin 24.6.0), Buzz Desktop with buzz-acp managed Claude Code agent
  • Discovered 2026-07-23 in a live session

Related but distinct: #2270 (thread replies without re-mention also don't reach the agent).

oveddan avatar Jul 23 '26 16:07 oveddan

Corroborating this on Buzz Desktop (2026-07-24, separate reporter/session).

One additional symptom worth adding: the mention added on edit also renders as plain text in the posted message — the name shows as literal @Name, not a mention chip. So the edit path appears to skip mention parsing entirely: no p tag is written on edit, which explains both observed failures at once — (a) the agent never fires, and (b) the name doesn't render as a mention. Mentions present in the original message render and fire correctly; only the edit path is affected.

Same root cause as described here (edit doesn't re-run the p-tag parser); flagging the rendering half so a fix is verified against both.

prabhatgmp avatar Jul 24 '26 11:07 prabhatgmp

Analysis and repro performed by a Buzz agent (Fizz) running on Claude Code, posted under my account.

Reproduced on 2026-07-27 (separate session), and I think the root cause is stated slightly too narrowly here. Two corrections from a CLI-side repro.

1. The edit does not merely lose its p tag — it never lands at all.

Isolated in a throwaway channel via buzz CLI against wss://liqpil.communities.buzz.xyz:

buzz messages send --channel $CH --content "plain message no mention"
# {"accepted":true,"event_id":"938d177bbaef6e8fa3273f3c71a0431506651c1155dd018c1120322a70c6ee32"}

buzz messages edit --event 938d177b... --content "@Pascal now with a mention added by edit"
# {"accepted":true,"event_id":"9aeb5bba5f9075c0ddc75c243e9201042b79a291ff8ec6600eccd22d9543ffa1"}

buzz messages get --channel $CH --limit 10
# returns content "plain message no mention", id 938d177b..., tags unchanged

buzz messages search --query "mention added by edit"
# []

The edit returns accepted:true with a fresh event id, and then that revision is not retrievable through messages get, messages search, or messages thread. The original incident that led me here matches: the user's message d8411c5a1d69d38d87334d256cae7dc2adf40970febdd99204c78fc377101c32 still sits on the relay with the pre-edit content and no p tag.

This matters because it conflicts with the comment above, which reports the edited mention rendering as plain text in the posted message — that implies the edited content is visible in Desktop. If Desktop shows the new text while the relay read path returns the old text, then the revision is either being dropped on write or not surfaced on read, and "edit doesn't re-run the p-tag parser" is a symptom rather than the cause. Worth confirming which, because the fix differs: re-running the mention parser on edit will not help if the edited revision never becomes readable.

Independent of the mention bug, accepted:true for a write that is then unreadable is silent data loss and probably deserves its own issue.

2. "only the edit path is affected" does not hold for the CLI.

Control case — mention typed at send time, never edited:

buzz messages send --channel $CH --content "@Pascal mention typed at send time"

Stored event:

{"content":"@Pascal mention typed at send time",
 "id":"44e4cb08758061e4ae4182c2bf9fb6accd22479d8c04501a21a03a6bf080acf5",
 "tags":[["h","7315562b-2470-42e7-8743-a09b88c04a53"],["auth","..."]]}

No p tag. By comparison a Desktop-composed message in the same thread carries ["p","30e1e0f8...2504"]. So @Name → p tag resolution appears to live in the Desktop compose UI, not in the send path. Any non-Desktop writer — CLI, automation, an agent relaying a mention — produces a message that reads as a mention to a human and notifies nobody.

If mention parsing were done relay-side on write, it would fix the edit path and the CLI path in one change.

Environment: macOS (Darwin 25.5.0), buzz CLI, buzz-acp managed agent.

pcrausaz avatar Jul 27 '26 21:07 pcrausaz

Relay-side observation from a self-hosted deployment. It conflicts with part of the CLI analysis above, so posting the raw data.

The Desktop edit does land, and it does carry the p tag.

Setup: self-hosted Buzz relay (Postgres 17), Buzz Desktop on macOS 24.6.0, one channel, one buzz-acp managed Claude Code agent.

Read directly from the relay events table:

  1. 2026-07-28T23:57:20Z, original message, kind 9, tags [h, e(reply)]. No p tag.
  2. 2026-07-28T23:57:44Z, the user edits that message in Desktop to add the mention. A second event lands: kind 40003, edited content, tags include ["p","390480…"], the agent's pubkey, correctly resolved.
  3. The agent never woke. No turn fired and no error surfaced. It saw the text later as passive thread context, when a new kind 9 carrying the same p tag arrived at 2026-07-28T23:58:41Z.

So on this deployment the edit revision is stored and mention parsing did run on it. The tag is present on the kind 40003. What did not happen is the wake, which points at the wake path keying on kind 9 and ignoring kind 40003 revisions.

That is a different failure from the CLI repro above, where the revision was unreadable afterward. Desktop edit and buzz messages edit may be two separate paths, worth separating in the fix, since the Desktop half is not a mention-parser bug.

I did not test the CLI edit path or the plain-text rendering symptom here.

Czaruno avatar Jul 29 '26 00:07 Czaruno