Skip to content

feat(relay): auto-add relay owner to newly created channels - #4495

Open
wilsonwang0713 wants to merge 1 commit into
block:mainfrom
wilsonwang0713:feat/auto-add-owner-to-created-channels
Open

feat(relay): auto-add relay owner to newly created channels#4495
wilsonwang0713 wants to merge 1 commit into
block:mainfrom
wilsonwang0713:feat/auto-add-owner-to-created-channels

Conversation

@wilsonwang0713

Copy link
Copy Markdown

Problem

When an agent (or another member) creates a channel, only the creator becomes a member. The relay owner does not see the new channel in their client until they manually join — and for private channels they cannot self-join at all (kind:9021 is open-channel only). This is especially confusing with agent-created channels: the agent reports "created", but the owner's channel list stays empty.

Change

Add BUZZ_AUTO_ADD_OWNER_TO_CHANNELS (default off). When enabled and RELAY_OWNER_PUBKEY is set, the relay owner is automatically enrolled as an admin member of every channel they did not create.

  • Runs in handle_create_group, before NIP-29 discovery emission, so the kind:39002 members roster already includes the owner.
  • Emits a member-added notification so the owner's client subscribes in real time (mirrors the creator notification).
  • Works for private channels too — direct membership add, not a self-join.
  • Idempotent and non-fatal: the channel and creator membership are already committed if the owner add fails.
  • Skips when the owner is the creator, or when the owner pubkey is unset/invalid.

Testing

  • New config unit test auto_add_owner_to_channels_defaults_off_and_opts_in (default off; opt-in on).
  • cargo fmt, cargo clippy -p buzz-relay, and cargo build -p buzz-relay pass.
  • Verified end-to-end against a deploy/compose relay: an agent-created channel appears for the owner within the same turn, no manual join.

Notes

Opt-in and default-off, so existing single- and multi-tenant deployments are unaffected unless they explicitly enable it.

@wilsonwang0713
wilsonwang0713 requested a review from a team as a code owner August 3, 2026 08:37
Add BUZZ_AUTO_ADD_OWNER_TO_CHANNELS (default off). When enabled, the relay
owner (RELAY_OWNER_PUBKEY) is automatically enrolled as an admin member of
every channel they did not create, so the owner's channel list stays in sync
with agent- and member-created channels without a manual join.

The enrollment runs in handle_create_group before NIP-29 discovery emission,
so the kind:39002 members roster already includes the owner, and emits a
member-added notification so the owner's client subscribes in real time.
Idempotent and non-fatal: the channel and creator membership are already
committed if the owner add fails.

Signed-off-by: wilson <wilson07131@gmail.com>
@wilsonwang0713
wilsonwang0713 force-pushed the feat/auto-add-owner-to-created-channels branch from a34c70b to 675ea4e Compare August 7, 2026 01:47
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