Skip to content

fix(cli): make 'buzz messages edit --content -' read stdin like send - #4684

Open
kushaim wants to merge 1 commit into
block:mainfrom
kushaim:fix/4361-edit-reads-stdin
Open

fix(cli): make 'buzz messages edit --content -' read stdin like send#4684
kushaim wants to merge 1 commit into
block:mainfrom
kushaim:fix/4361-edit-reads-stdin

Conversation

@kushaim

@kushaim kushaim commented Aug 4, 2026

Copy link
Copy Markdown

Fixes #4361.

cmd_edit_message validated and signed the literal "-" as the
replacement body when callers passed --content -, while
cmd_send_message correctly resolves stdin in the same situation
(introduced in PR #624). The two paths diverged in this one step.

This is hazardous for agents: an agent can 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.

Mirrors cmd_send_message's exact pattern: read stdin if -, then
validate the resolved content, then pass the resolved string to
build_edit. No new public API, no behavior change for non--
content, no change to cmd_send_message.

Includes a regression test on the read_or_stdin helper
(read_or_stdin_dash_reads_stdin_not_literal_dash) that asserts
read_or_stdin("-") is not the literal "-". A test runner's
stdin is empty, so the result is Ok("") — the test is robust
against whatever the runner has on stdin as long as it isn't a
literal "-" (which would itself be a bug).

Verified:

  • cargo check -p buzz-cli --lib — clean
  • cargo test -p buzz-cli --lib — 318 passed, 0 failed (the new
    test included)

Fixes block#4361.

cmd_edit_message validated and signed the literal '-' as the
replacement body when callers passed --content -, while
cmd_send_message correctly resolves stdin in the same situation
(PR block#624). The two paths diverged in this one step.

Mirrors cmd_send_message's exact pattern: read stdin if '-', then
validate the resolved content, then pass the resolved string to
build_edit. No new public API, no behavior change for non-'-'
content.

Also adds a regression test on the read_or_stdin helper asserting
that read_or_stdin('-') is not the literal '-'.

Signed-off-by: kushaim <carlossilvajimenez@gmail.com>
@kushaim
kushaim requested a review from a team as a code owner August 4, 2026 08:14
Copilot AI lite review requested due to automatic review settings August 4, 2026 08:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

2 participants