Skip to content

fix(desktop): allow bot channel members in mention picker from any device - #4653

Open
albertleecs322 wants to merge 2 commits into
block:mainfrom
albertleecs322:fix/bot-member-mention-cross-device
Open

fix(desktop): allow bot channel members in mention picker from any device#4653
albertleecs322 wants to merge 2 commits into
block:mainfrom
albertleecs322:fix/bot-member-mention-cross-device

Conversation

@albertleecs322

Copy link
Copy Markdown

Problem

Agents added to a channel as members (role: bot) cannot be @mentioned from
devices that don't own/manage those agents locally.

Root cause: isAgentIdentityInManagedList filters out any candidate where
isAgent === true but the pubkey isn't in managedAgentPubkeys. On the
agent-owning device that set is populated; on every other device it's empty, so
ALL channel bots are silently dropped from the mention picker — even when the
agent is set to respondTo: "anyone".

The downstream shouldHideAgentFromMentions already handles invocability
correctly (member agents with unknown invocability are shown; those explicitly
excluded by the relay directory are hidden), but it never runs because the
candidate is rejected first.

Fix

Add candidate.isMember === true as a pass-through condition in
isAgentIdentityInManagedList. Bot channel members are allowed to reach
shouldHideAgentFromMentions, which gates on actual invocability rather than
local ownership.

Test

Added an assertion for the new case in the existing
isAgentIdentityInManagedList test: a non-locally-managed agent that IS a
channel member returns true.

All 18 existing tests in agentAutocompleteEligibility.test.mjs continue to
pass.

Behaviour change

Scenario Before After
Agent managed on this device ✅ shown ✅ shown
Non-member relay agent (invocable) ❌ hidden ❌ hidden (unchanged — still filtered by shouldHideAgentFromMentions non-member path)
Bot channel member, not locally managed, respondTo: anyone ❌ hidden ✅ shown
Bot channel member, not locally managed, relay-directory-excluded ❌ hidden ✅ correctly hidden by shouldHideAgentFromMentions

Signed-off-by: Albert Lee albertleecs322@gmail.com

…vice

isAgentIdentityInManagedList was filtering out bot-role channel members
that aren't in the local managedAgentPubkeys set. On non-host devices this
set is empty, so every agent in the channel was silently dropped before
shouldHideAgentFromMentions could run — which already correctly gates on
invocability (respondTo=anyone + shared channel).

Fix: pass through candidates where isMember === true so shouldHideAgentFromMentions
handles the invocability decision, not a blanket local-ownership check.

Signed-off-by: Albert Lee <albertleecs322@gmail.com>
@albertleecs322
albertleecs322 requested a review from a team as a code owner August 4, 2026 03:16
Signed-off-by: Albert Lee <albertleecs322@gmail.com>
with:
node-version: 24.14.1

- uses: pnpm/action-setup@v4
with:
node-version: 24.14.1

- uses: pnpm/action-setup@v4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants