Skip to content

fix(buzz-cli): messages edit --content - reads stdin like send (#4361) - #4379

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:fix/4361-messages-edit-content-stdin
Open

fix(buzz-cli): messages edit --content - reads stdin like send (#4361)#4379
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:fix/4361-messages-edit-content-stdin

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

Problem

buzz messages send --content - reads the message body from stdin (introduced in #624), but buzz messages edit --content - signed and published the literal string - as the replacement body.

This is especially hazardous for agents: an agent can successfully send a multiline answer through stdin, use the same content convention to correct that answer, receive an accepted: true response, and silently replace the answer with a single dash. Markdown clients then render the edited message as an empty bullet.

Root cause

cmd_edit_message in crates/buzz-cli/src/commands/messages.rs passed the raw --content argument straight to validation and buzz_sdk::build_edit without routing it through read_or_stdin, unlike cmd_send_message (which does, at line 582).

Fix

Route the edit content flag through read_or_stdin before validation, exactly mirroring the send path. Also update the Edit::content clap help text to document the stdin convention (Use '-' to read from stdin.), matching the Send::content wording.

What was verified

  • cargo check -p buzz-cli -p buzz-sdk — clean.
  • cargo test -p buzz-cli --quiet318/318 passing (317 baseline + 1 new regression test).
  • New regression test cli_edit_content_dash_is_routed_through_stdin_not_stored_literally pins the resolution expression: a bare - is a stdin sentinel, never a publishable value after resolution; non-sentinel inputs pass through verbatim.
  • Functional smoke: echo 'test replacement content' | buzz messages edit --content - --event <id> now reads stdin (proceeds to the auth gate) instead of short-circuiting on the literal dash.

Fixes #4361

…tent -) (block#4361)

Previously `messages edit --content -` stored the literal string "-" as the
replacement message body, silently replacing the original message with a dash
when an agent (or shell pipeline) attempted a multi-line edit.

Now edit resolves the content flag through read_or_stdin, exactly like send
(introduced in block#624), so `messages edit --content -` reads the replacement
body from stdin before validation and signing. The command help text is
updated to document the behavior.

Adds a regression test pinning the resolution expression: a bare dash is
never a publishable value after resolution.

Fixes block#4361

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
@iroiro147
iroiro147 requested a review from a team as a code owner August 2, 2026 18:35
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.

buzz messages edit --content - stores a literal dash instead of reading stdin

1 participant