Skip to content

Add native Buzz inbound persona routing - #1013

Merged
olegbrok merged 2 commits into
mainfrom
codex/task-541-buzz-first-class-inc2
Aug 7, 2026
Merged

Add native Buzz inbound persona routing#1013
olegbrok merged 2 commits into
mainfrom
codex/task-541-buzz-first-class-inc2

Conversation

@olegbrok

@olegbrok olegbrok commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Outcome

Adds Buzz inbound as a native PinkyBot chat platform. A verified, explicitly approved kind-9 from an allowlisted channel now reaches the agent's normal persona session exactly like Telegram or Slack; agents continue replying through the existing generic send / thread surfaces.

Built from the FINAL v5 security spec at SHA-256 33e86969d9189c6f113546e5d26b893feb419b83d4c1d9fbcc66d3ff3f54e21e.

What changed

  • Adds per-identity native NIP-42 WebSocket supervision with standard Nostr REQ subscriptions, reconnect/backoff, monotonic periodic authenticated REQ/EOSE liveness probes, durable health, and owner notification.
  • Treats relay since filters as advisory and enforces the exact subscription floor client-side before any cache, authorization lookup, durable write, or persona turn. Only events already present in the local pending-delivery ledger may replay across a newer subscription floor.
  • Adds the two load-bearing, DB-backed gates before persona dispatch: exact identity community/relay + per-agent channel UUID allowlist, then a BIP340-verified full buzz:<community>:<64-hex-pubkey> owner/approved principal.
  • Adds strict event schema/bounds, canonical ID and Schnorr verification, non-self enforcement, event-ID dedupe, durable kind-9 retry/claim fencing, restart claim release, and policy-revocation cleanup.
  • Routes accepted messages into the normal main/group persona path with the full verified principal adjacent to an explicitly untrusted display annotation.
  • Ignores kind-20002 immediately after cryptographic/schema validation: no persona turn, authorization lookup, duplicate cache, principal timestamp, durable row, replay, prompt, or conversation retention.
  • Makes the one-operation identity + inbound-policy bind a single database transaction, so any derived policy conflict rolls back both new and existing identity state. The separate owner-only policy replacement route remains available for channel/user changes and out-of-band owner-key rotation.
  • Documents native health, rotation, ACP-as-harness-only, and the release-time legacy bridge cutover.

Spec interpretation made explicit

For ordinary channel broadcasts, a self p tag is optional. A no-p kind-9 remains eligible only after both load-bearing gates and is always a group/channel message with mentioned_self=false.

If any p tag is present, this increment requires exactly one canonical self-pubkey tag. Foreign, malformed, or duplicate p tags suppress delivery; only the exact self tag sets mentioned_self, and rendered @name text never does.

The foreign-p suppression is the conservative inc2 choice. Slack parity could instead deliver a foreign-targeted channel message with mentioned_self=false; revisit that only when inc3 introduces real multi-agent Buzz channels.

Relay compatibility evidence

Read-only live-rig probes confirmed:

  • NIP-98 query returned both of Brad's BIP340-verified kind-9 forms in #general: one exact self-p message and one no-p broadcast.
  • A plain WebSocket received the relay AUTH challenge; a signed NIP-42 kind-22242 AUTH was accepted; a standard REQ returned both kind-9 events followed by EOSE.
  • The local production-WebSocket integration sends only AUTH/REQ/CLOSE application frames. No live channel EVENT publication was performed.

Validation

  • All Buzz tests: 60 passed
  • Focused inbound/API/poller tests: 30 passed
  • Exact adversarial round-2 regressions: 5 passed (stale relay replay + pending-ledger exception, control-frame liveness trickle, kind-20002 zero mutation, and new/existing identity atomic rollback)
  • Registry/database-security/auth overlap: 215 passed under the repository's intended PINKY_AUTH_DENY_DEFAULT=shadow, PINKY_SHARED_MCP=0 test environment
  • Broker/messaging overlap: 107 passed
  • Daemon/poller overlap: 85 passed
  • Broad local round-2 run: 828 passed, 2 skipped, 1 deselected before interrupting unrelated host-environment seams. This machine's global dream transport selected the real logged-in tmux/Claude path instead of the test's patched SDK path; that selector passed independently with PINKY_DREAM_TRANSPORT=sdk. Exact-head GitHub CI is the authoritative full-suite gate.
  • Ruff, git diff --check, uv lock --check, uv pip check, source compile, sdist build, and wheel build passed.

Screenshot/clip: N/A — daemon relay/routing and owner-control plumbing only; no visual UI surface changed.

Boundaries

No production identity was bound or changed, no live Buzz channel event was published, the legacy bridge/LaunchAgent was not touched, and nothing was deployed. Bridge retirement is an operator-controlled release step after native health verification. This draft does not authorize merge or deploy.


🤖 Opened by Kuzya

Comment thread src/pinky_daemon/buzz_inbound.py Fixed
Comment thread src/pinky_daemon/buzz_inbound.py Fixed
@olegbrok
olegbrok marked this pull request as ready for review August 7, 2026 02:36
@olegbrok
olegbrok merged commit cd3ca1c into main Aug 7, 2026
11 checks passed
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