From 0ef1fab9d80ba9caadb976fc865824fdeeade985 Mon Sep 17 00:00:00 2001 From: Rey Marques Date: Thu, 6 Aug 2026 10:23:45 -0700 Subject: [PATCH] fix(desktop): discover remote channel agents Co-authored-by: Rey Marques Signed-off-by: Rey Marques --- .../agents/lib/agentAutocompleteEligibility.test.mjs | 9 ++++++++- .../features/agents/lib/agentAutocompleteEligibility.ts | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) 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)) ); }