Skip to content

Allow bot owners to remove their agents from any channel#284

Merged
wesbillman merged 5 commits into
mainfrom
bot-owner-remove
Apr 9, 2026
Merged

Allow bot owners to remove their agents from any channel#284
wesbillman merged 5 commits into
mainfrom
bot-owner-remove

Conversation

@wesbillman

Copy link
Copy Markdown
Collaborator

Summary

  • Adds is_agent_owner() DB helper that checks if a user is the owner of a bot agent (via agent_owner_pubkey, set immutably at token mint)
  • Updates relay kind 9001 validation to allow agent owners to remove their bots even when they're not a channel owner/admin
  • Adds isMyBot() frontend helper and updates canRemoveMember logic in MembersSidebar so bot owners see the Remove button for their agents regardless of channel role

Motivation

Users can add their bots to other people's channels but previously couldn't remove them unless they were a channel owner/admin. This aligns with the VISION.md principle of letting users manage their own agents.

Test plan

  • Verify bot owner can see Remove button on their bots in channels they don't own
  • Verify clicking Remove successfully removes the bot (relay accepts the request)
  • Verify non-owners still cannot remove other people's bots
  • Verify existing admin/owner removal permissions still work
  • Integration tests in channel.rs cover happy path + negative case

🤖 Generated with Claude Code

wesbillman and others added 5 commits April 9, 2026 11:47
Extends remove_member authorization to check agent_owner_pubkey: if the
actor owns the target bot (via agent_owner_pubkey), they can remove it
from any channel they're both members of, even without owner/admin role.

Updated both the DB layer (remove_member) and the NIP-29 kind:9001
validation (validate_admin_event) with the same agent-owner check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add isMyBot() helper to useClassifiedMembers that checks if a member is
in the current user's managedAgentPubkeys set. Use it in MembersSidebar
so the "Remove" button appears for bots the user owns, regardless of
their channel role.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add comment explaining why is_agent_owner queries pool instead of tx
  (agent_owner_pubkey is immutable, set at mint)
- Guard isMyBot condition with selfMember check so non-members don't see
  a Remove button that the relay would reject

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace is_agent_owner() indirect query via get_agent_channel_policy()
  with a direct agent_owner_pubkey comparison query
- Fix stale docstring on remove_member re: transaction boundaries
- Add comment explaining non-member bot owners can't remove bots
- Add clarifying comment on frontend canRemoveMember logic

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wesbillman wesbillman merged commit a3a4127 into main Apr 9, 2026
9 checks passed
@wesbillman wesbillman deleted the bot-owner-remove branch April 9, 2026 22:06
tlongwell-block added a commit that referenced this pull request Apr 11, 2026
…ona-migration

* origin/main:
  feat(desktop): add Pulse social notes surface (#296)
  Fix flaky desktop smoke tests (#294)
  Add agent lifecycle controls to channel members sidebar (#291)
  Update nest_agents.md tagging info (#292)
  feat: add Sprout nest — persistent agent workspace at ~/.sprout (#290)
  Fix auth and SSRF vulns (#261)
  Add per-agent MCP toolset configuration to agent setup (#279)
  feat(desktop): team & persona import/edit flows (#288)
  Remove menu item subtitles and fix persona card overflow (#289)
  feat: Phase 1 video upload support (Blossom-compliant-ish) (#285)
  Add inline subtitles to menu items and field descriptions (#276)
  Improve ephemeral channel affordances and hide archived sidebar rows (#286)
  Fix @mention search to use word-boundary prefix matching (#278)
  Allow bot owners to remove their agents from any channel (#284)
  [codex] Polish agent selectors and settings layout (#283)

# Conflicts:
#	desktop/scripts/check-file-sizes.mjs
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.

2 participants