Desktop hides allowlisted agents owned by another user from @mention autocomplete
- Dominant language
- Rust
- Stars
- 32.7k
- Forks
- 4.3k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 253
Description
## Summary
The desktop composer prevents a user from mentioning an agent owned by someone else even when the agent is present in the channel and its `respond_to` policy explicitly permits that user.
Observed in `wss://formidable.communities.buzz.xyz`:
- Testbot is owned by `gabimoncha`.
- Testbot is a `bot` member of `#general`.
- Testbot is configured so Pax may invoke it.
- Gabimoncha can resolve and mention Testbot.
- Pax's `@Testbot` remains plain text and the published event has no Testbot `p` tag, so ACP is never woken.
## Root cause
PR #2149 made the current user's local managed-agent list authoritative for every concrete agent identity in mention autocomplete.
`useMentions.ts` calls `isAgentIdentityInManagedList(candidate, managedAgentPubkeys)` before the existing `respond_to`/allowlist/shared-channel eligibility check. An other-owned agent is therefore discarded even when `getMentionableAgentPubkeys()` has correctly classified it as invocable for the current user.
This conflates two different concepts:
- **managed by me** — ownership/lifecycle control
- **invocable by me** — `owner-only`, `allowlist`, or `anyone` response policy
## Expected behavior
A concrete agent should be mentionable when either:
- it is locally managed by the current user, or
- its relay profile and channel relationship authorize the current user through `respond_to`.
Agents that are neither locally managed nor invocable must remain hidden.
## Acceptance criteria
- An allowlisted user can select an other-owned agent from desktop `@mention` autocomplete.
- An `anyone` agent shared through a joined channel can be selected by other members.
- The sent event contains the selected agent's `p` tag.
- Owner-only and non-allowlisted other-owned agents remain hidden.
- Locally managed agents remain visible regardless of response policy.
- Focused unit and desktop E2E coverage protects the owner/allowlist distinction.
## Suspected files
- `desktop/src/features/messages/lib/useMentions.ts`
- `desktop/src/features/agents/lib/agentAutocompleteEligibility.ts`
- `desktop/src/features/agents/lib/agentAutocompleteEligibility.test.mjs`
- `desktop/tests/e2e/mentions.spec.ts`
Regression introduced by #2149.
Contributor guide
Research direction
Start in desktop/src/features/messages/lib/useMentions.ts and desktop/src/features/agents/lib/agentAutocompleteEligibility.ts, then read the focused eligibility test. Run desktop/src/features/agents/lib/agentAutocompleteEligibility.test.mjs and the relevant cases in desktop/tests/e2e/mentions.spec.ts. Done means allowlisted and shared-channel agents are selectable with their p tag, while unauthorized agents remain hidden.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- desktop, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100