block / block/buzz

Desktop: shared relay agents never appear in mention autocomplete (mobile works)

Open
#4,128 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
32.7k
Forks
4.3k
Avg merge
1d 13h
Merged PRs (30d)
253

Description

### Describe the bug

On desktop, a shared/remote relay agent — one whose kind:10100 directory record makes it mention-eligible (`respond_to: "anyone"` + a shared channel) — never appears in the `@` mention autocomplete, so it cannot be selected as a pill. The same agent gets a pill on mobile immediately. Plaintext fallback matching (where the agent's ACP config accepts literal `@Name`) still works, which makes the failure look intermittent to users: typed text answers, the picker doesn't.

### To reproduce

1. Self-host a relay. Run an agent via `buzz-acp` on a separate machine (any host that isn't the desktop device), with a rich kind:10100 directory record: `respond_to: "anyone"`, `channel_ids` including a channel the desktop user has joined.
2. Add the agent to that channel (role `bot`). Confirm it authenticates and appears in the relay directory.
3. Desktop app: open the channel, type `@` — the agent is missing from the suggestion list.
4. Mobile app, same account, same channel: the agent appears and is selectable.

### Expected behavior

Directory-eligible shared agents should be offered as mention pills on desktop, matching mobile and matching desktop's own directory-based eligibility in `useNewMessageRecipients` and `ProjectsAgentPromptPage`.

### Mechanism (as of `3d7712c`)

`addCandidate()` in `desktop/src/features/messages/lib/useMentions.ts` calls `isAgentIdentityInManagedList()` **before** `shouldHideAgentFromMentions()`. Any `isAgent` candidate whose pubkey is not in the local managed-agents list is dropped — including every candidate produced by the `relayAgentsQuery` loop, which makes that loop dead code for non-local agents.

A remote agent can never satisfy that gate: `apply_inbound_managed_agent()` (`desktop/src-tauri/src/commands/personas/inbound.rs`) is patch-only by design ("managed agents are never minted from a relay event"), so no directory record, kind:30177 declaration, or channel membership ever creates a local managed entry on another device.

Two side observations while diagnosing, in case they're intentional-vs-known:

- `shouldHideAgentFromMentions`' member branch ("Member … unknown invocability => show") is unreachable at its only call site, because the pre-gate already requires mentionable-set membership. A channel-member agent with no usable directory record is hidden on desktop (mobile shows it).
- `MembersSidebar`'s add-member search uses the same managed-list gate and likely has the same remote-agent blindness — left untouched by the fix below since the UX semantics differ.

### Trust-model note

Directory eligibility (`respond_to` + shared `channel_ids`) is self-published per-pubkey, but this exact eligibility set is already trusted by mobile mentions, `useNewMessageRecipients`, and `ProjectsAgentPromptPage` — fixing the pill path brings mention autocomplete to parity, not beyond it.

### Fix

PR incoming from this account: admit mention candidates through the mentionable set (`getMentionableAgentPubkeys` = managed ∪ directory-eligible) at the `useMentions` call site, leaving `isAgentIdentityInManagedList` unchanged for its other consumer; unit tests included. Verified on a live self-hosted deployment (desktop vs Android discrepancy reproduced, then resolved with the patch).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.