buzz icon indicating copy to clipboard operation
buzz copied to clipboard

fix(desktop): keep channel-member agents mentionable across owners

Open rodroudi opened this issue 4 months ago • 0 comments

Summary

Agents that are members of the current channel are exempted from the managed-list drop gate in the mention composer, so an agent managed on another machine — or by another user entirely — stays in @-autocomplete for every channel member.

Root cause of #2508: since #2149 (a4dfead2), useMentions.addCandidate drops any candidate with isAgent: true that is not in the local managed-agent list, before shouldHideAgentFromMentions (the member/directory logic from #1611) ever runs. isAgent is derived from the channel bot role and the NIP-OA attestation on the agent's kind:0, so every remote agent is affected regardless of its Respond-to setting. Two aggravating factors:

  • "Respond to: Anyone" only updates the owner-local kind:30177 record; nothing in the tree publishes the kind:10100 agent profile that relayAgentIsSharedWithUser reads, so mentionableAgentPubkeys can never include a remote agent (the only kind:10100 writer today is buzz channels set-add-policy, which writes a channel_add_policy-only profile).
  • Because the drop gate precedes it, the "Member (Option B): unknown invocability ⇒ show" branch of shouldHideAgentFromMentions became unreachable for exactly the candidates it was designed for.

The fix is a new pure helper, shouldDropAgentMentionCandidate, used by useMentions in place of the raw managed-list check: a channel-member agent is never dropped; the managed-list restriction from #2149 still applies to non-member agent identities (stale kind:0 discoveries, global-search strays), which is the duplicate-noise case it was introduced for. Member agents remain subject to shouldHideAgentFromMentions, so an explicit not-invocable signal from a future kind:10100 directory still hides them. The MembersSidebar call site (add-to-channel search, non-members by construction) is intentionally unchanged.

Related issue

Fixes #2508. Same mechanism likely underlies #2349 / the cross-user reports in the #2508 thread.

Testing

  • New regression test: shouldDropAgentMentionCandidate keeps channel-member agents from other owners, keeps locally managed agents, never drops people, and still drops non-member foreign agent identities.
  • Full desktop unit suite: 3506 pass / 0 fail. tsc --noEmit and biome check clean.
  • Manual scenario (two users, one relay, agents BP and Fizz each managed on a different machine, both channel members with Respond-to: Anyone): before — each user could only see/tag their own agent; with this change the member agent appears in autocomplete for the other user and the selected mention emits the agent's p tag, which the ACP harness (event_mentions_agent) requires to wake.

🤖 Generated with Claude Code

rodroudi avatar Jul 25 '26 20:07 rodroudi