Skip to content

fix(desktop): let channel members bypass mention agent gate#965

Open
tellaho wants to merge 1 commit into
mainfrom
tho/fix/agent-mention-filter
Open

fix(desktop): let channel members bypass mention agent gate#965
tellaho wants to merge 1 commit into
mainfrom
tho/fix/agent-mention-filter

Conversation

@tellaho

@tellaho tellaho commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator
image he's back

Category: fix

User Impact: Agents that are already members of a channel reappear in @-mention autocomplete, even when they live in a different build's managed-agents.json or were set to respondTo: owner-only.

Problem: PR #942 added a global gate that hides any agent from the mention picker unless the running build owns it locally or it advertises respondTo: "anyone". The intent — keeping the relay's long tail of non-responsive bots out of the picker — is right, but the same gate was applied to bots that are already explicit channel members. Across multiple builds (prod, dev, worktrees) each Tauri instance has its own managed-agents.json keyed by bundle identifier, so the same persona lives behind different pubkeys per build and only one build "owns" each pubkey. The result was that my canonical Ned/Bart/Marge agents stopped autocompleting in channels they're members of whenever I ran from a different build.

Solution: Treat channel membership as its own opt-in signal. Members bypass the directory gate; non-members and global-search hits still go through it, so the zombie zoo stays hidden.

File changes

desktop/src/features/messages/lib/useMentions.ts
Adjusted the agent gate in addCandidate so it only fires for non-members (!candidate.isMember). Membership is only ever set by the channel-members loop — directory and global-search candidates are hard-coded isMember: false — so the bypass can't be triggered by relay discovery results. The archived-identity filter runs before this gate, so archived agents stay hidden even when they're members.

Reproduction steps

  1. Run a dev/worktree build of Sprout — i.e. one whose managed-agents.json does NOT contain the canonical Ned pubkey owned by your prod build.
  2. Open a channel where Ned is a member (and Ned was created with the default respondTo: "owner-only").
  3. In the composer, type @n.
  4. Before this PR: Ned does not appear in autocomplete. After: Ned appears, labeled as a channel member.
  5. Now type @n in a channel where Ned is not a member: Ned should still NOT appear (directory gate intact).
  6. Archive a zombie via the identity-archive flow → confirm it's filtered out of the picker.

@tellaho tellaho force-pushed the tho/fix/agent-mention-filter branch 2 times, most recently from a4905d6 to 0bf3cb4 Compare June 11, 2026 01:58
@tellaho tellaho marked this pull request as ready for review June 11, 2026 01:58
@tellaho

tellaho commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

checks fixed by #966

PR #942 added a directory-wide gate that hides any agent from the
mention autocomplete unless it lives in the running build's
`managed-agents.json` or advertises `respondTo === "anyone"` on the
relay. The intent — keeping the relay's zombie zoo out of autocomplete
— is right for the global directory, but the gate is also applied to
agents that are already explicit channel members. That hides:

- the user's own agents owned by a different build (prod vs.
  dev/worktree split — each build has its own `managed-agents.json`)
- channel-added bots that defaulted to `respondTo: "owner-only"`

Explicit channel membership is itself an opt-in signal, so let those
candidates through unconditionally and keep the directory gate for
non-members and `userSearchQuery` hits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tellaho tellaho force-pushed the tho/fix/agent-mention-filter branch from 0bf3cb4 to cbd8bf0 Compare June 11, 2026 08:17
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.

1 participant