fix(desktop): keep live foreign agents in mention and add-member autocomplete - #4129
Open
neptun787 wants to merge 1 commit into
Open
fix(desktop): keep live foreign agents in mention and add-member autocomplete#4129neptun787 wants to merge 1 commit into
neptun787 wants to merge 1 commit into
Conversation
…complete block#2149 made the local managed Agents list the sole authority for concrete agent identities in autocomplete. That drops every agent owned by another desktop before shouldHideAgentFromMentions (block#1611) can run — a live, invocable agent that is a channel member can neither be @-mentioned nor found in the add-member search from any other device. Send-time mention extraction fails too, since it scans the same candidate list. Keep block#2149's stale-identity cleanup, but treat a relay agent directory entry (kind:10100) as live evidence alongside the managed list: agents present in either survive candidate building; explicitly non-invocable ones are still hidden by shouldHideAgentFromMentions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: neptun787 <neptun787@users.noreply.github.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.
Problem
Since #2149, the composer's
@-mention autocomplete and the members-sidebar add-member search drop every concrete agent identity that is not in the current user's local managed Agents list — including live, invocable agents owned by another desktop that are members of the current channel.useMentions.addCandidatereturns early viaisAgentIdentityInManagedList(...)beforeshouldHideAgentFromMentions(...)(#1611) ever runs, so the whole "member / invocable / directory-exclusion" decision table from #1611 is unreachable for foreign agents. The same gate sits inMembersSidebar.tsx.Concrete repro (two desktops, one relay):
GADS MacMiniand adds it to a shared channel.@gads.extractMentionPubkeys) scans the same candidate list, so typing the full name doesn't p-tag it either: the agent is effectively unmentionable from any other device.Meanwhile #2149's goal is real: stale p-tag/member identities (superseded agent keys) should not resurface.
Fix
Rename the gate to
isKnownLiveAgentIdentityand let a relay agent directory entry (kind:10100) count as live evidence alongside the local managed list. Everything else is unchanged — surviving foreign agents still flow throughshouldHideAgentFromMentions, so explicitly non-invocable ones stay hidden.shouldHideAgentFromMentions(as designed)Applied to both call sites (
useMentions.ts,MembersSidebar.tsx);MembersSidebaralready hadrelayAgentsQueryin scope and in the memo deps.Tests
agentAutocompleteEligibility.test.mjs: reworked the gate's test to cover person / managed / directory-listed-foreign / stale branchespnpm test→ 3906/3906 passtsc --noEmit→ 0 errorsbiome checkon the 4 changed files → clean🤖 Generated with Claude Code