diff --git a/desktop/src/features/agents/lib/agentAutocompleteEligibility.test.mjs b/desktop/src/features/agents/lib/agentAutocompleteEligibility.test.mjs index 2cb2068d51..2904591aa0 100644 --- a/desktop/src/features/agents/lib/agentAutocompleteEligibility.test.mjs +++ b/desktop/src/features/agents/lib/agentAutocompleteEligibility.test.mjs @@ -229,7 +229,7 @@ test("autocomplete helper extraction preserves safe filtering and labels", () => ); }); -test("isAgentIdentityInAllowedList: keeps people and only explicitly allowed agent identities", () => { +test("isAgentIdentityInAllowedList: keeps people, channel members, and explicitly allowed agents", () => { const allowedAgentPubkeys = new Set([PUB_A]); assert.equal( @@ -253,6 +253,13 @@ test("isAgentIdentityInAllowedList: keeps people and only explicitly allowed age ), false, ); + assert.equal( + isAgentIdentityInAllowedList( + { isAgent: true, isMember: true, pubkey: PUB_B }, + allowedAgentPubkeys, + ), + true, + ); }); test("shouldHideAgentFromMentions: never hides non-agents", () => { diff --git a/desktop/src/features/agents/lib/agentAutocompleteEligibility.ts b/desktop/src/features/agents/lib/agentAutocompleteEligibility.ts index 0abdad82fa..54af248b20 100644 --- a/desktop/src/features/agents/lib/agentAutocompleteEligibility.ts +++ b/desktop/src/features/agents/lib/agentAutocompleteEligibility.ts @@ -83,11 +83,12 @@ export function getMentionableAgentPubkeys({ } export function isAgentIdentityInAllowedList( - candidate: { isAgent?: boolean; pubkey: string }, + candidate: { isAgent?: boolean; isMember?: boolean; pubkey: string }, allowedAgentPubkeys: ReadonlySet, ) { return ( candidate.isAgent !== true || + candidate.isMember === true || allowedAgentPubkeys.has(normalizePubkey(candidate.pubkey)) ); }