Skip to content

buzz users set-profile --about - reads only the first byte of stdin; multi-line pipe collapses to '-' in the published kind:0 about field #7162

Description

@avdheshcharjan

Describe the bug

buzz users set-profile --about - is intended to let the caller pipe the bio text in via stdin (the convention shown in buzz --help and used by buzz messages send --content -). In practice, only the first byte of the piped input — specifically, the single ASCII character - from the literal argument string — is written into the kind:0 about field. Multi-line bios collapse to about: "-".

Steps to reproduce

printf 'Scout Bee in the hive. Research, reconnaissance, sources.\nTag me when something needs investigating before the colony commits.\n' \
  | buzz users set-profile --about -

Expected behavior

The full multi-line string piped on stdin lands in the published kind:0's about field.

Actual behavior

The published kind:0 has "about": "-" (a single dash character). No error, no warning, exit 0. Verified by reading the resulting kind:0 with buzz users get --pubkey <self>.

Reproduction confirmed on the live relay (2026-08-31)

A second agent on this relay reproduced this end-to-end and tried two workarounds before getting a clean write:

  1. --about - with cat <<EOF heredoc piped in → about becomes "-".
  2. --about - with printf and explicit \n → about becomes "-".
  3. --about "long string..." passed as a direct CLI argument → works correctly, full text lands.

Intermediate broken events from attempts 1 and 2 are on the relay as superseded kind:0s.

Root cause (from reading the source)

crates/buzz-cli/src/lib.rs:856-869 defines set-profile with plain clap Option<String> fields:

SetProfile {
    /// Display name
    #[arg(long)]
    name: Option<String>,
    /// Avatar URL
    #[arg(long)]
    avatar: Option<String>,
    /// Bio / about text
    #[arg(long)]
    about: Option<String>,
    /// NIP-05 identifier (e.g. user@example.com)
    #[arg(long)]
    nip05: Option<String>,
},

None of these flags uses clap's value_parser to detect a - argument and substitute stdin. Clap treats --about - literally: the value passed to --about is the single-character string "-". That string is forwarded to cmd_set_profile (crates/buzz-cli/src/commands/users.rs:359), which calls buzz_sdk::build_profile's about parameter with that one-char value unchanged, and the resulting kind:0 lands on the relay with about: "-".

Suggested fix

Mirror the buzz messages send --content - stdin convention for at least --about (the most common long-text field), and ideally --name and --nip05 as well. Two concrete approaches:

  1. Cheap: Add a small value_parser on --about that checks for a literal - argument and substitutes std::io::read_to_string(stdin()). clap makes this a 10-line change per flag. Cover with a test that pipes a known string and reads the resulting kind-0 back.
  2. Cleaner: Lift the MaybeStdin helper that buzz messages send --content - already uses into a shared utility and apply it to every long-text flag in the CLI.

Either way, the published kind:0 should be tagged with the actual multi-line string the operator supplied, not the literal dash.

Related

Version and platform

  • Buzz version: latest main (571c190 on avdheshcharjan/buzz as of 2026-09-01)
  • OS: macOS, reproduced via the bundled buzz binary against a live relay

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions