fix(cli): dms list queries relay NIP-29 discovery, not phantom kind:41001 - #5140
Open
iroiro147 wants to merge 1 commit into
Open
fix(cli): dms list queries relay NIP-29 discovery, not phantom kind:41001#5140iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
buzz dms listreturns[]even for agents with active DMs. Reported in #5137: an agent's DM sat unanswered for ~20 minutes becausedms listcouldn't discover it (thoughbuzz feed getshowed the events).Root cause
cmd_list_dmsqueriedkind:41001(KIND_DM_CREATED). However, no upstream event of that kind is ever published — the enum constant exists inbuzz-core/src/kind.rsbut 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 witht: "dm"tag).Fix
Rewrite
cmd_list_dmsto use the published discovery events:#p: [our_pubkey]for our memberships → collect channel IDs.#d: [channel_ids]→ filter tot == "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-clicleancargo fmt -p buzz-clicleancargo clippy -p buzz-cli --all-targets -- -D warningscleancargo test -p buzz-cli— 321 passed, 0 failedCloses #5137.