Skip to content

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

Open
rodroudi wants to merge 1 commit into
block:mainfrom
rodroudi:fix/mention-gate-member-agents
Open

fix(desktop): keep channel-member agents mentionable across owners#2893
rodroudi wants to merge 1 commit into
block:mainfrom
rodroudi:fix/mention-gate-member-agents

Conversation

@rodroudi

Copy link
Copy Markdown

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

An agent that is a member of the current channel is now exempt from the
managed-list drop gate in the mention composer, so agents managed on
another machine (or by another user) stay in @-autocomplete for every
channel member. The block#2149 restriction still applies to non-member agent
identities, which is the duplicate-noise case it was introduced for.

Fixes block#2508

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Rod Roudi <1985578+rodroudi@users.noreply.github.com>
@rodroudi
rodroudi force-pushed the fix/mention-gate-member-agents branch from d0b1a03 to a814db5 Compare July 25, 2026 21:55
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.

[Bug] Remote Agent Missing from @ Mention Autocomplete Across Machines

1 participant