feat(cli): channels set-respond-policy publishes the complete kind:10100 in one event - #7700
Open
rmichelena wants to merge 1 commit into
Open
rmichelena wants to merge 1 commit into
rmichelena wants to merge 1 commit into
Conversation
…100 in one event kind:10100 (agent profile) is a replaceable event, and the only CLI path that publishes it -- `channels set-add-policy` -- writes a content with `channel_add_policy` alone. Every publish through it erases the agent's `respond_to`, name and status, so an agent that once had a complete profile stops being mentionable after a routine policy change, and a headless agent has no CLI path at all to declare `respond_to`. `buzz channels set-respond-policy` publishes the whole profile at once: `respond_to`, `channel_add_policy`, `status`, `name`/`display_name`, and `respond_to_allowlist` for the allowlist policy. `--policy`, `--channel-add-policy` and `--status` are required at the parser, so no invocation can drop a field by omission; `--allow` is required with `--policy allowlist` and refused with any other policy; invalid values are refused before signing. Signing goes through `BuzzClient::sign_event`, so the NIP-OA auth tag rides on the event when `BUZZ_AUTH_TAG` is set. The deployment gate `BUZZ_ACP_ALLOWED_CHANNEL_ADD_POLICIES`, which `set-add-policy` already applies, is factored into one shared function and applied by both commands, so the second publisher cannot slip past a restriction the first one honours. `set-add-policy` keeps its behaviour and its partial content unchanged. Tests: agent_profile_tests pin that the event carries every field and exactly one auth tag naming the owner when the client has one, and none otherwise; allowlist without entries is refused and with entries is emitted; --allow with another policy is refused; invalid status, policy, add-policy and blank name are refused before signing; omitting --status, --channel-add-policy or --policy is a parser error. The deployment-gate test binds the production path of the new command and fails when the gate call is removed (checked by removing it). cargo test -p buzz-cli: 479 passed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Roberto Michelena <77797875+rmichelena@users.noreply.github.com>
🔐 Codex Security Review
|
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.
Summary
kind:10100 (agent profile) is a replaceable event, and the only CLI path that publishes it —
buzz channels set-add-policy— writes a content withchannel_add_policyalone. Every publish through it erases the agent'srespond_to, name and status, so an agent that once had a complete profile stops being mentionable after a routine policy change; and a headless agent (no Desktop) has no CLI path at all to declare itsrespond_to.This adds
buzz channels set-respond-policy, which publishes the whole profile in one event:--policy,--channel-add-policyand--statusare required at the parser, so no invocation can drop a field by omission (a partial profile is a usage error, never a smaller event).--allowis required with--policy allowlistand refused with any other policy; invalid values are refused before signing.--namedefaults toBUZZ_ACP_SESSION_TITLE, the name the harness already injects.BuzzClient::sign_event, so the NIP-OA auth tag rides on the event whenBUZZ_AUTH_TAGis set (fix(relay): record the NIP-OA owner for direct members on closed relays #5581's owner mapping on closed relays depends on that).BUZZ_ACP_ALLOWED_CHANNEL_ADD_POLICIES, whichset-add-policyalready applies, is factored into one shared function and applied by both commands, so the second publisher cannot slip past a restriction the first one honours.set-add-policykeeps its behaviour and its partial content unchanged; this PR does not remove it.Why a new command rather than extending
set-add-policyset-add-policywith new optional flags would keep the erasing behaviour as its default. The failure this fixes is precisely "a field went missing because nothing required it", so the fix is a command whose parser cannot express an incomplete profile.agents draft-update --respond-tois not a substitute: it opens an owner-reviewed draft through observer frames for Desktop-managed agents and publishes nothing from a headless host.Test plan
cargo test -p buzz-cli— 479 passed.agent_profile_testspin the contract: the event carries every field and exactly one auth tag naming the owner when the client has one, none otherwise; allowlist without entries refused / with entries emitted;--allowwith another policy refused; invalid status/policy/add-policy/blank name refused before signing; omitting--status,--channel-add-policyor--policyis a parser error. The subcommand-count test is updated (channels16 → 17).cmd_set_respond_policy) and fails when the gate call is removed — checked by removing it, not by watching it pass.cargo fmt -p buzz-cli -- --check,cargo clippy -p buzz-cli --all-targets -- -D warningsclean.--status, has run on one host since 2026-08-11; this complete form since 2026-09-15 for a headless OMP agent whose Desktop mention eligibility and activity log depend on the complete 10100). Rebased onmain@6dfd145cd.Companion: #7699 (owner-side
compute_auth_tagno longer takes the owner secret on argv).🤖 Generated with Claude Code