feat(relay): push mentions to people outside a listed channel (#9623)

## Summary

A message that `p`-tags someone in a listed channel they haven't joined
now sends them a push. Before this, push woke only channel members. This
is the relay part of "Let them know", a choice for mentioning people
outside a public channel. The client changes are
https://github.com/block/buzz-app/pull/3769,
https://github.com/block/buzz-app/pull/3771 and
https://github.com/block/buzz/pull/9629.

- The matcher wakes a non-member only when a `p` tag names them and the
channel is open, not unlisted, and a stream or forum. It reuses the
channel directory's `LISTED_CHANNEL_SQL`.
- Delivery checks again before sending. The channel must still be
listed, the event must still mention them, and they must still be able
to connect. A ban on them or their agent's owner blocks the push, and so
does a missing membership or allowlist entry when the relay requires
one.
- Members, private and unlisted channels, DMs and system channels are
unchanged.

**Needs security review.** This decides who gets push wakes. A wake goes
only to someone who could already read the event with `REQ`, and it
carries no message content.

Follow-up: a banned or removed channel member still gets wakes until
their lease expires. That predates this PR, and the fix belongs in the
ban and removal code.

### Related issue

None found.

### Testing

- Postgres tests run ingest through delivery against a fake gateway.
They cover private, unlisted and system channels, a switch to private
before delivery, bans, removal, a missing allowlist entry, and an agent
relying on its owner's membership. I made 20 small changes that each
broke one of these checks, and each one made a test fail.
- On a local relay with a stand-in gateway, an outsider's mention push
arrived, and nothing went out after a ban, a removal or a switch to
private. With the new delivery check turned off, the banned and removed
people got pushes.
- Not tested: a real gateway and a phone.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Soheyl Vakili <soheyl@squareup.com>
Signed-off-by: Tom Brow <tomb@block.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Tom Brow <tomb@block.xyz>
This commit is contained in:
Soheyl
2026-11-19 11:29:10 -07:00
committed by GitHub
parent 9ea57cba2a
commit 98e2b7cbbc
7 changed files with 822 additions and 9 deletions

View File

@@ -45,3 +45,17 @@ skip it, so the owner is not notified by every run of their workflow. When a
workflow mentions its owner, the relay adds a plain `["p", <owner>]`, which
notifies them like any mention. Mobile's Activity feed, unread mention priority
and in-app notification rule apply the same rule.
## Channel access
A lease wakes for a channel's events only when its author is a member, with
one exception: a message that `p`-tags a non-member wakes that non-member when
the channel is listed (open, not unlisted, a stream or forum). Workflow owner
attribution does not count as a mention. The relay checks this when it matches
and again before delivery, so a channel that becomes private or unlisted in
between stops the wake. Delivery also applies the connection gate to the
non-member: a ban on them or their agent's owner stops the wake, and so does
losing community membership or their allowlist entry when the relay requires
one. Private channels, unlisted channels, DMs and system channels still require
membership. Anyone in the community can already read a listed channel with
`REQ`, so the exception wakes no one for content they cannot read.