Skip to content

fix(buzz): require explicit group addressing - #92781

Closed
conrelma wants to merge 2 commits into
NousResearch:mainfrom
conrelma:anvil/buzz-explicit-addressing
Closed

conrelma wants to merge 2 commits into
NousResearch:mainfrom
conrelma:anvil/buzz-explicit-addressing

Conversation

@conrelma

@conrelma conrelma commented Aug 23, 2026

Copy link
Copy Markdown

Summary

  • require explicit @Display-Name, npub, hex, or recipient p-tag in Buzz group channels
  • keep named rooms and missing metadata fail-closed as groups
  • preserve mention-free DMs when hosted relays return them only through channels list as name=DM with an empty description
  • add regression coverage for bare names, prefixes, recipient tags, DM latching, and p-tag-free true DMs

Tests

  • scripts/run_tests.sh tests/gateway/test_buzz_adapter.py tests/gateway/test_buzz_websocket.py (41 passed)

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Aug 23, 2026
@Enough1122

Copy link
Copy Markdown
Contributor

AI code review — automated review for reference, author can ignore or act on any point.

Overall: a meaningful trust-model tightening done carefully — requiring explicit addressing (@name text or signed recipient p-tag) before waking in channels, failing closed on missing metadata, and promoting only the exact relay-DM metadata shape ("DM" + empty description) fixes both the phantom-dispatch and wrong-latch failure modes. The test additions cover prefix collisions, substring identities, tag-vs-text paths, and latch suppression thoroughly. Points:

  1. plugins/platforms/buzz/adapter.py:1135 vs :1137 — the hex branch builds its pattern from re.escape(self._self_pubkey) without .lower(), while the npub branch lowercases before escaping. Content is matched against a lowercased string, so if _self_pubkey is ever stored in mixed/upper case the hex identity match silently never fires (npub would still work). Normalize both (re.escape(self._self_pubkey.lower())) for symmetry with the .lower() convention used in _p_tagged_to_self.

  2. plugins/platforms/buzz/adapter.py:~981-985 — the fallback discovery now flips an already-watched channel's chat_type to "dm" in place. That's correct per the new policy, but it's the one state mutation here with no log line; every other reclassification logs via _maybe_latch_dm. A logger.info on the promotion (and on the direct-seed path) would keep the audit trail symmetric when debugging relay quirks.

  3. plugins/platforms/buzz/adapter.py:1158-1163 — the display-name terminator set omits ` and "; backtick-quoted @Chip would dispatch. Trivial, but cheap to extend alongside [\s,;.!?:)\]}].

The _strip_mention asymmetry (require @ for names, optional for npub/hex) matches the dispatch rules — good consistency.

@teknium1

Copy link
Copy Markdown
Collaborator

Merged via #99431 — both commits cherry-picked with authorship preserved. The @-required gate with token boundaries plus signed p-tag addressing, fail-closed meta classification, and DM-shaped promotion fixed four issues in one design (#78798, #87899, #77987, and composed with #75953's reply-to-own escape).

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

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants