Clean up Buzz envelopes and auto-register memberships - #1016
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Outcome
Cleans up Buzz inbound envelopes and makes newly granted Buzz memberships usable without manual database edits. Known contacts render from an explicit per-agent trust registry; unknown contacts remain fully attributable and visibly untrusted.
What changed
verified_contactstable and agent-scoped registry methods plusGET/PUT/DELETE /agents/{name}/verified-contactsowner API surfaces.buzz:posspecialists:90425c…) withname=Bradandrole=owner; fresh installs retry the seed when Barsik is first registered.from:Brad (owner) principal:90425c785cf2…; registry names always override sender-supplied names.display_name(untrusted)path. Unknown principals claiming a registered name are flagged asuntrusted+collides:<registered-name>.msg_idand one fullchat_idfor outreach calls. Telegram group and DM header bytes are unchanged.group_chatsat subscription time and again on first authorized inbound, preserving operator aliases.{"kinds":[44100,44101],"#p":["<agent-pubkey>"]}.Trust and routing impact
The contact registry is explicit and keyed by
(agent_name, platform, principal); no contact is learned from traffic. Missing rows, an empty table, or lookup failures keep the current full-principal unknown rendering and never blank or crash the sender slot.Membership changes require a BIP340-valid event received on the authenticated relay connection with exactly one canonical self
ptag and one canonical channelhtag. Runtime identity, subscriptions, contacts, and group-chat registration remain per-agent; the Brad row is only the caller-specified deployment seed.Deliberate 1059 split
Kind 1059 is not included in this PR's filter. The tree has no NIP-17 gift-wrap/NIP-44 unwrap path, and subscribing now would make PinkyBot appear DM-capable while silently swallowing messages it cannot decrypt.
Follow-up work must first decide the NIP-44 dependency strategy (maintained library vs. reviewed vendored implementation), then add authenticated unwrap/decrypt, authorization, routing, and adversarial tests end to end. Only after that should kind 1059 join the
#p-gated REQ.Validation
env -u PINKY_DREAM_TRANSPORT PYTHONPATH=src ... pytest -q tests/test_agent_registry.py tests/test_broker.py tests/test_buzz_inbound.py tests/test_buzz_inbound_poller.py tests/test_verified_contacts.py— 224 passedruff check .— passedpy_compile— passedgit diff --check— passedPINKY_DREAM_TRANSPORT=tmuxoverride escaped an SDK-mocked dream test; that exact test passes independently with the override removed. GitHub CI remains the clean full-suite gate.Barsik's pre-merge production-relay probe remains required for the exact 44100/44101
#pfilter. No relay credentials or live fan-out probe were used in this build lane.Boundaries
No production database, identity, relay subscription, release, daemon, or deployment state was changed. This draft does not authorize merge or deploy.
🤖 Opened by Kuzya