Skip to content

fix(desktop): show cross-desktop managed agents in @mention autocomplete - #4714

Open
anindyar wants to merge 1 commit into
block:mainfrom
anindyar:fix/4187-cross-desktop-mention-autocomplete
Open

fix(desktop): show cross-desktop managed agents in @mention autocomplete#4714
anindyar wants to merge 1 commit into
block:mainfrom
anindyar:fix/4187-cross-desktop-mention-autocomplete

Conversation

@anindyar

@anindyar anindyar commented Aug 4, 2026

Copy link
Copy Markdown

Summary

Fixes #4187 — a managed agent created on one Buzz Desktop instance is not discoverable in the @mention autocomplete picker on another member's Desktop, even though it is a channel member (role: "bot"), has a valid kind:0 profile, and responds normally when mentioned via the CLI with --mention.

Root cause

useMentions (desktop/src/features/messages/lib/useMentions.ts) builds mention candidates through addCandidate, which applies two agent-visibility gates in sequence:

  1. isAgentIdentityInManagedList(candidate, managedAgentPubkeys) — keeps an agent only if it is in this client's local managed-agent list.
  2. shouldHideAgentFromMentions({ … }) — the nuanced "Option B" member/directory policy that is explicitly designed to show channel-member agents whose invocability is unknown, and to hide only non-member or explicitly-excluded ones.

Gate #1 runs first and short-circuits. Any agent that isn't locally managed is dropped before gate #2 can run — so a managed agent running on another Desktop instance (present in the channel as a role: "bot" member, but absent from this client's local managed list and, for the native Claude Code runtime, not in the relay kind:10100 directory) is filtered out. That makes shouldHideAgentFromMentions's member-handling dead code for exactly the cross-desktop case it was written for, which is the behavior reported in #4187 (and confirmed independently on 0.5.4 in the issue thread).

Fix

Remove the redundant isAgentIdentityInManagedList pre-filter from the mention path and let shouldHideAgentFromMentions be the sole visibility policy there. Its existing, tested behavior already gives the correct result:

isAgentIdentityInManagedList itself is unchanged and still used by MembersSidebar's "add member" search, where restricting agent suggestions to locally-managed agents is correct (you can only add agents you manage). The fix is scoped to the mention path only.

Tests

  • desktop/src/features/agents/lib/agentAutocompleteEligibility.test.mjs — added a named #4187 regression test asserting a channel-member agent managed by another Desktop instance (not in the managed list, not in the relay directory) stays visible.
  • Full desktop unit suite green: pnpm test4130 passed, 0 failed.
  • pnpm typecheck and biome check clean on the changed files.

Notes for reviewers

  • This is a Desktop-side fix; the previously-linked fix(mobile): resolve hand-typed member mentions at send time #4309 only touched mobile/…/compose_bar* and does not address this issue.
  • MembersSidebar's "add member" search still applies the same local-managed gate. That's intentional and out of scope here, but if you'd prefer relay-discovered agents to be addable there too, that's a natural follow-up.

🤖 Generated with Claude Code

The mention-autocomplete candidate builder (useMentions) applied two
agent-visibility gates in sequence: isAgentIdentityInManagedList (keep
only locally-managed agents) followed by shouldHideAgentFromMentions
(the member/directory "Option B" policy). The first gate short-circuits
and drops any agent not in this client's local managed-agent list before
the second, more nuanced policy can run. So a managed agent running on
another Desktop instance, present in the channel as a role:"bot" member,
never appears in the @mention picker on other members' clients (block#4187).

Remove the redundant isAgentIdentityInManagedList pre-filter from the
mention path and let shouldHideAgentFromMentions be the sole policy: it
already shows member agents with unknown invocability and hides
non-member / explicitly-excluded ones. isAgentIdentityInManagedList is
unchanged and still used by the MembersSidebar "add member" search,
where restricting suggestions to locally-managed agents is correct.

Add a named block#4187 regression test.

Fixes block#4187

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Anindya Roy <i@anindya.me>
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.

Cross-desktop @mention autocomplete doesn't discover managed agents from other Desktop instances

1 participant