Skip to content

Commit 58e8ea1

Browse files
kbst9claude
andcommitted
fix(desktop): let the relay decide who may add an agent to a channel
The add-member search dropped every agent that was not in the caller's own managed-agents list, so an agent running under another identity — a teammate's, or one on a shared always-on machine — could never be added to a channel from the UI. The same add via `buzz channels add-member` succeeded, because nothing below the UI blocks it: add_channel_members builds kind:9000 per pubkey and submits it, and the relay is the actual authority, enforcing each user's channel_add_policy (default 'anyone', refusing with policy:owner_only / policy:nobody otherwise). The client filter therefore duplicated a relay check with strictly less information. It also relied on relay-agent discovery (kind:10100), which only `buzz channels set-add-policy` ever publishes and whose content carries no channel_ids/respond_to — so the reachability path it depended on is empty in practice and the filter collapsed to owned-only. Drop it from the add surface and let refusals surface through the existing per-pubkey error list. @mention autocomplete is untouched: its invocability filter (block#1611) still applies there. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: kbst9 <[email protected]>
1 parent d8f9d87 commit 58e8ea1

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

‎desktop/src/features/channels/ui/MembersSidebar.tsx‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import {
77
useChannelMembersQuery,
88
} from "@/features/channels/hooks";
99
import { attachManagedAgentToChannel } from "@/features/agents/channelAgents";
10-
import {
11-
coalesceAgentAutocompleteCandidates,
12-
isAgentIdentityInManagedList,
13-
} from "@/features/agents/lib/agentAutocompleteEligibility";
10+
import { coalesceAgentAutocompleteCandidates } from "@/features/agents/lib/agentAutocompleteEligibility";
1411
import { useIsArchivedPredicate } from "@/features/identity-archive/hooks";
1512
import { useClassifiedMembers } from "@/features/channels/lib/useClassifiedMembers";
1613
import { formatMemberName } from "@/features/channels/lib/memberUtils";
@@ -271,18 +268,24 @@ export function MembersSidebar({
271268
.map((member) => member.displayName?.trim().toLowerCase())
272269
.filter((label): label is string => Boolean(label)),
273270
);
274-
const managedAgentPubkeys = new Set(managedAgentsByPubkey.keys());
275-
276271
const addCandidate = (candidate: AddMemberSearchCandidate) => {
277272
const pubkey = normalizePubkey(candidate.pubkey);
273+
// Agents are NOT filtered by local ownership here. Who may add an agent
274+
// to a channel is the relay's decision: every user carries a
275+
// `channel_add_policy` (default `anyone`) and kind:9000 is refused with
276+
// `policy:owner_only` / `policy:nobody` when it does not permit the add
277+
// (relay `handlers/side_effects.rs`). Pre-filtering to the caller's own
278+
// managed agents duplicated that check with strictly less information —
279+
// it hid teammates' agents that the relay would happily accept, leaving
280+
// no in-app way to add them, while the CLI (`buzz channels add-member`)
281+
// could. Refusals surface through the existing errors list below.
278282
if (
279283
(candidate.isAgent &&
280284
memberAgentLabels.has(
281285
formatAddCandidateName(candidate).toLowerCase(),
282286
)) ||
283287
memberPubkeys.has(pubkey) ||
284-
isArchivedDiscovery(pubkey) ||
285-
!isAgentIdentityInManagedList(candidate, managedAgentPubkeys)
288+
isArchivedDiscovery(pubkey)
286289
) {
287290
return;
288291
}

0 commit comments

Comments
 (0)