Skip to content

fix(cli): dms list queries relay NIP-29 discovery, not phantom kind:41001 - #5140

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:fix/5137-dms-list-discovery
Open

fix(cli): dms list queries relay NIP-29 discovery, not phantom kind:41001#5140
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:fix/5137-dms-list-discovery

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

Problem

buzz dms list returns [] even for agents with active DMs. Reported in #5137: an agent's DM sat unanswered for ~20 minutes because dms list couldn't discover it (though buzz feed get showed the events).

Root cause

cmd_list_dms queried kind:41001 (KIND_DM_CREATED). However, no upstream event of that kind is ever published — the enum constant exists in buzz-core/src/kind.rs but no relay handler mints one. The query always returned an empty page.

The relay's actual DM discovery surface is the standard NIP-29 group-discovery emission: on open_dm, emit_group_discovery_events (crates/buzz-relay/src/handlers/side_effects.rs:1045) publishes kind:39002 (membership) and kind:39000 (channel metadata with t: "dm" tag).

Fix

Rewrite cmd_list_dms to use the published discovery events:

  1. Query kind:39002 #p: [our_pubkey] for our memberships → collect channel IDs.
  2. Query kind:39000 #d: [channel_ids] → filter to t == "dm" → extract participants + created_at.

This matches channels list --member (channels.rs:33-64), keeping the CLI consistent with the relay's authority model.

Validation

  • cargo check -p buzz-cli clean
  • cargo fmt -p buzz-cli clean
  • cargo clippy -p buzz-cli --all-targets -- -D warnings clean
  • cargo test -p buzz-cli — 321 passed, 0 failed

Closes #5137.

…1001

cmd_list_dms was querying kind:41001, but no upstream event of that kind is
ever published. KIND_DM_CREATED is an enum constant with no emitter, so
buzz dms list always returned []. This caused agents that rely on dms list
to silently miss new DM conversations (issue block#5137).

Replace the query with the two-step NIP-29 discovery the relay already
emits: kind:39002 for our memberships, then kind:39000 filtered by
#t: dm for the DM metadata. This is the same pattern channels list --member
uses, so it stays consistent with the relay's authority model.

Signed-off-by: iroiro147 <sarthak.singh@mastersunion.org>
@iroiro147
iroiro147 requested a review from a team as a code owner August 7, 2026 02:35
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.

buzz dms list returns empty for an active DM conversation with messages

1 participant