Skip to content

Desktop hides allowlisted agents owned by another user from @mention autocomplete #3125

Description

@pax-k

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 meowner-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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions