fix(desktop): show cross-desktop managed agents in @mention autocomplete - #4714
Open
anindyar wants to merge 1 commit into
Open
fix(desktop): show cross-desktop managed agents in @mention autocomplete#4714anindyar wants to merge 1 commit into
anindyar wants to merge 1 commit into
Conversation
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>
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.
Summary
Fixes #4187 — a managed agent created on one Buzz Desktop instance is not discoverable in the
@mentionautocomplete 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 throughaddCandidate, which applies two agent-visibility gates in sequence:isAgentIdentityInManagedList(candidate, managedAgentPubkeys)— keeps an agent only if it is in this client's local managed-agent list.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 makesshouldHideAgentFromMentions'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
isAgentIdentityInManagedListpre-filter from the mention path and letshouldHideAgentFromMentionsbe the sole visibility policy there. Its existing, tested behavior already gives the correct result:isAgentIdentityInManagedListitself is unchanged and still used byMembersSidebar'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#4187regression test asserting a channel-member agent managed by another Desktop instance (not in the managed list, not in the relay directory) stays visible.pnpm test→ 4130 passed, 0 failed.pnpm typecheckandbiome checkclean on the changed files.Notes for reviewers
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