diff --git a/desktop/src/features/messages/lib/useMentions.ts b/desktop/src/features/messages/lib/useMentions.ts index 0c73b75339..f6bd877a54 100644 --- a/desktop/src/features/messages/lib/useMentions.ts +++ b/desktop/src/features/messages/lib/useMentions.ts @@ -16,7 +16,6 @@ import { coalesceAutocompleteCandidatesByKey, getMentionableAgentPubkeys, getSharedChannelIds, - isAgentIdentityInManagedList, shouldHideAgentFromMentions, } from "@/features/agents/lib/agentAutocompleteEligibility"; import { @@ -246,9 +245,6 @@ export function useMentions( if (isArchivedDiscovery(pubkey)) { return; } - if (!isAgentIdentityInManagedList(candidate, managedAgentPubkeys)) { - return; - } if ( shouldHideAgentFromMentions({ isAgent: candidate.isAgent === true, @@ -420,7 +416,6 @@ export function useMentions( managedAgentNamesByPubkey, managedAgentPersonaIds, managedAgentPersonaIdsByPubkey, - managedAgentPubkeys, managedAgentsQuery.data, memberPubkeys, members, diff --git a/desktop/tests/e2e/mentions.spec.ts b/desktop/tests/e2e/mentions.spec.ts index 512eb3d800..6f50bad08d 100644 --- a/desktop/tests/e2e/mentions.spec.ts +++ b/desktop/tests/e2e/mentions.spec.ts @@ -241,6 +241,50 @@ test("@ trigger prioritizes channel members before runnable personas and other m expect(fizzIndex).toBeLessThan(charlieIndex); }); +test("@ includes channel-member agents that are not locally managed", async ({ + page, +}) => { + await installMockBridge(page); + await page.goto("/"); + await page.getByTestId("channel-general").click(); + await expect(page.getByTestId("chat-title")).toHaveText("general"); + + const input = page.getByTestId("message-input"); + await input.fill("@mi"); + + const row = autocomplete(page).locator("button", { hasText: "mira" }); + await expect(row).toBeVisible(); + await expect(row.getByTestId("mention-agent-icon")).toBeVisible(); + await expect(row.getByText("not in channel")).toHaveCount(0); +}); + +test("@ hides channel-member agents when the viewer is outside their allowlist", async ({ + page, +}) => { + await installMockBridge(page, { + relayAgents: [ + { + pubkey: PROFILE_ONLY_AGENT_PUBKEY, + name: "mira", + channelNames: ["general"], + respondTo: "allowlist", + respondToAllowlist: [TEST_IDENTITIES.alice.pubkey], + }, + ], + }); + await page.goto("/"); + await page.getByTestId("channel-general").click(); + await expect(page.getByTestId("chat-title")).toHaveText("general"); + + const input = page.getByTestId("message-input"); + await input.fill("@mi"); + + await expect(autocomplete(page)).not.toBeVisible(); + await expect( + page.getByTestId(`mention-suggestion-${PROFILE_ONLY_AGENT_PUBKEY}`), + ).toHaveCount(0); +}); + test("thread autocomplete keeps multiple long names readable in a narrow panel", async ({ page, }) => {