feat(buzz-cli): support direct relay pubkeys in channel-template rosters - #4093
Open
iroiro147 wants to merge 1 commit into
Open
feat(buzz-cli): support direct relay pubkeys in channel-template rosters#4093iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
A channel template's `agents` roster previously only accepted Desktop
persona ids (which resolve through kind:30176/30177 events) and team
ids. Long-running remote or VPS-managed agent identities — stable Nostr
pubkeys with no local Desktop persona instance — could not be
deterministically rostered: they ended up in the report's 'skipped''
bucket with the channel otherwise created successfully, leaving the
operator thinking the roster was applied when it wasn't.
Add a third roster variant, `agentPubkeys: [{ pubkey, label? }]`,
that bypasses the persona/team slug scan entirely and adds the pubkey
directly as a channel member. This gives template authors a first-class
deterministic path for provider-backed agents, matching the first
option listed in issue block#3953.
Behavior notes:
- Label falls back to TRUNCATED-pubkey prefix (first 16 chars, not
full 64-hex) so the template report stays readable.
- The pubkey is passed through unchanged to build_add_member. A
malformed/short pubkey surfaces as a member_failures entry — never
silently dropped, never in 'skipped'.
- Direct entries are merged with persona/team-resolved agents, not
exclusive — a template can mix all three.
Tests:
- expand_direct_pubkeys_uses_label_when_present: explicit label path.
- expand_direct_pubkeys_falls_back_to_truncated_pubkey_label: the
fallback and its no-panic short-string safety.
- expand_direct_pubkeys_empty_when_no_entries.
- load_templates_parses_full_roster: existing test extended to assert
the new agentPubkeys field defaults to empty on pre-block#3953 templates,
preserving backward compatibility.
- load_templates_parses_direct_agent_pubkeys: parses the new JSON
(camelCase agentPubkeys, optional label).
- load_templates_rejects_invalid_pubkey_entry: malformed entries fail
parse instead of silently dropping — closing the silent-omission
regression vector from the persona path.
Fixes block#3953.
Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
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.
Problem
A channel template's
agentsroster previously only accepted Desktop persona ids (which resolve through kind:30176/30177 events) and team ids. Long-running remote or VPS-managed agent identities — stable Nostr pubkeys with no local Desktop persona instance — could not be deterministically rostered. They ended up in the report'sskippedbucket with the channel otherwise created successfully, leaving the operator thinking the roster was applied when it wasn't (#3953).Fix
This implements the issue's option (a): add a third roster variant
agentPubkeys: [{ pubkey, label? }]that bypasses the persona→kind:30177 slug scan entirely and adds the pubkey directly as a channel member. Template authors now have a first-class deterministic path for provider-backed agent identities.Three behavior guarantees:
build_add_member. A malformed or short pubkey surfaces as amember_failuresentry, never silently dropped, never inskipped.labelis omitted the template report uses the first 16 chars of the pubkey (pubkey:<16>) instead of dumping the full 64-hex.agent_pubkeys: []and behave exactly as before.Code
crates/buzz-cli/src/commands/channel_templates.rs— newTemplatePubkeyEntry { pubkey, label };TemplateAgentRostergains#[serde(default)] agent_pubkeys: Vec<TemplatePubkeyEntry>(camelCase JSONagentPubkeys).crates/buzz-cli/src/commands/channels.rs— new pure helperexpand_direct_pubkeysconverts the entries verbatim intoResolvedAgents;build_roster_resolutioncollects them alongside the existing persona/team slug scan and merges them intoRosterResolution.agentsbefore any channel creation.Tests
New unit coverage in
channels.rs:expand_direct_pubkeys_uses_label_when_presentexpand_direct_pubkeys_falls_back_to_truncated_pubkey_label— includes a short/malformed pubkey that must not panic and must truncate at its actual lengthexpand_direct_pubkeys_empty_when_no_entriesNew/extended coverage in
channel_templates.rs:load_templates_parses_direct_agent_pubkeys— full camelCase JSON round-trip, optional labelload_templates_rejects_invalid_pubkey_entry— malformed entry (missing pubkey) fails parse; the silent-omission regression vector from the persona path is closedload_templates_parses_full_roster— extended to assertagent_pubkeysdefaults to empty on pre-fix: channel templates should not silently omit remote managed agents from the roster #3953 templatesVerification
Fixes #3953.