fix(cli): resolve dms list from DM discovery instead of an unpublished kind - #5725
Open
Chessing234 wants to merge 2 commits into
Open
fix(cli): resolve dms list from DM discovery instead of an unpublished kind#5725Chessing234 wants to merge 2 commits into
Chessing234 wants to merge 2 commits into
Conversation
dms list filtered on kind:41001. Nothing in the tree publishes that kind - KIND_DM_CREATED is declared in buzz-core and emitted nowhere - so the command returned [] for every identity, including ones with existing DMs that `dms open` immediately resolves with created:false. A false negative here is worse than an error: it is the only listing surface an agent has for its own DMs, so "member of zero DMs" reads as a fact. Query the DM's kind:39000 discovery event instead. The relay signs it on creation with t=dm, hidden, and one p tag per participant (emit_group_discovery_events), so filtering that kind by our own pubkey returns exactly the DMs we are a party to, and channel-scoped storage keeps everyone else's unreadable. The output shape is unchanged. The t=dm check happens client-side because the p tag alone cannot express it; a channel of any other type is skipped rather than listed. Refs block#5424 Signed-off-by: Taksh <takshkothari09@gmail.com>
Pins the filter (kind:39000 by participant, not 41001) and the row projection against the tag shape emit_group_discovery_events writes for a DM: d, hidden, one p per participant, closed, t=dm. Also covers the two ways a p-tagged event must not become a row - a non-DM channel type, and a DM with no d tag, since an id-less row is worse than a missing one. Refs block#5424 Signed-off-by: Taksh <takshkothari09@gmail.com>
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.
Root cause
dms listfiltered on kind:41001. Nothing in the tree publishes that kind —KIND_DM_CREATEDis declared incrates/buzz-core/src/kind.rs:513and listed in the kind registry, and there is no emitter anywhere incrates/ordesktop/. The relay's DM-open path (command_executor.rs) writes the channel row, emits adm_createdsystem message, and callsemit_group_discovery_events— it never signs a 41001.So the command returned
[]for every identity, not only agent ones. That matches the report exactly:dms list→[], thendms openon the same pair →{"created":false}, i.e. the relay resolved a DM that the listing had just denied. The two further agent identities the reporter could not confirm were almost certainly the same false negative.This matters more than an ordinary empty result:
channels get/channels memberson a DM UUID return nothing from a non-member seat, sodms listis the only listing surface an agent has for its own DMs. "Identity X is a member of zero DMs" reads as a fact and, in the report's case, misattributed a production failure's root cause.The fix
Query the DM's kind:39000 discovery event instead.
emit_group_discovery_events(side_effects.rs:1070-1080) signs it at channel creation and, forchannel_type == "dm"only, attacheshiddenplus oneptag per participant. Filtering kind:39000 by our own pubkey therefore returns exactly the DMs we are a party to:ptags are attached to DM discovery only, so non-DM channels do not match on#pin the first place;t=dmcheck still happens client-side, because#palone cannot express it — a channel of any other type is skipped rather than listed.This is the same resolution shape
channels list --memberalready uses (membership events → channel metadata), so it is not a new access pattern.Output is unchanged — still
[{dm_id, participants, created_at}].Uncertainty, stated plainly
d+p-per-participant +t=dm.reconcile_channel_discovery_events(side_effects.rs:3045) having backfilled a 39000. Any DM it missed will still not list. If you would rather this fall back to the39002 → 39000two-step thatchannels list --memberuses, that is a small change and I am happy to make it.KIND_DM_CREATEDis now referenced by nothing but the registry. I left it in place rather than remove a public constant in a fix PR.Verification
cargo fmt --all --check,cargo clippy -p buzz-cli --all-targets(clean),cargo test -p buzz-cli --lib— 348 pass, including 5 new tests pinning the filter and the projection against the tag shape the relay actually writes.Closes #5424