feat: add --message-file flag to openclaw message send#79225
Closed
BigBot-ironlogic wants to merge 3 commits into
Closed
feat: add --message-file flag to openclaw message send#79225BigBot-ironlogic wants to merge 3 commits into
BigBot-ironlogic wants to merge 3 commits into
Conversation
Adds first-class file input support to avoid shell expansion corruption when agent completion reports contain $, backticks, quotes, JSON, or markdown code fences. New flags: --message-file <path> Read UTF-8 message body from file --allow-empty Allow sending empty file (default: error) Behaviour: - Reads file content without shell interpolation - Fails clearly if file not found or empty (unless --allow-empty) - Mutually exclusive with --message (error if both supplied) - Strips messageFile/allowEmpty from opts before downstream call - No logging of message body content Safe agent completion pattern: REPORT_FILE="$(mktemp)" cat > "$REPORT_FILE" << 'EOF' Done: summary EOF openclaw message send --channel telegram --target <t> --message-file "$REPORT_FILE" rm -f "$REPORT_FILE" Tests: 10 new vitest tests + 25 existing passing (35/35 total) TypeScript: no errors (pnpm tsgo) Closes #79182
Contributor
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: feat: add --message-file flag to openclaw message send This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
This PR is duplicated with #79200 |
25 tasks
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.
Summary
Adds first-class file input to
openclaw message sendto fix agent completion message corruption when reports contain shell metacharacters.Closes #79182
Problem
Agent completion reports passed via
--message "$(cat file.txt)"are silently corrupted or dropped when the file contains:$(variable expansion)This caused multiple silent failures in production builds.
Solution
New
--message-file <path>flag reads UTF-8 content from a file without shell interpolation.New flags
--message-file <path>— read message body from file--allow-empty— allow sending empty file (default: error)Mutual exclusion
--messageand--message-fileare mutually exclusive (error if both supplied)Safe agent completion pattern
Changes
src/cli/program/message/register.send.ts— adds--message-fileand--allow-emptyoptionssrc/cli/program/message/helpers.ts— addsresolveMessageFromFile(), wired intorunMessageActionsrc/cli/program/message/register.send.message-file.test.ts— 10 new vitest testsTests
pnpm tsgo)oxfmt)