fix(buzz-cli): messages edit --content - reads stdin like send (#4361) - #4379
Open
iroiro147 wants to merge 1 commit into
Open
fix(buzz-cli): messages edit --content - reads stdin like send (#4361)#4379iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
…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>
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
buzz messages send --content -reads the message body from stdin (introduced in #624), butbuzz 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: trueresponse, and silently replace the answer with a single dash. Markdown clients then render the edited message as an empty bullet.Root cause
cmd_edit_messageincrates/buzz-cli/src/commands/messages.rspassed the raw--contentargument straight to validation andbuzz_sdk::build_editwithout routing it throughread_or_stdin, unlikecmd_send_message(which does, at line 582).Fix
Route the edit content flag through
read_or_stdinbefore validation, exactly mirroring the send path. Also update theEdit::contentclap help text to document the stdin convention (Use '-' to read from stdin.), matching theSend::contentwording.What was verified
cargo check -p buzz-cli -p buzz-sdk— clean.cargo test -p buzz-cli --quiet— 318/318 passing (317 baseline + 1 new regression test).cli_edit_content_dash_is_routed_through_stdin_not_stored_literallypins the resolution expression: a bare-is a stdin sentinel, never a publishable value after resolution; non-sentinel inputs pass through verbatim.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