openclaw - 💡(How to fix) Fix feat: openclaw message send --message-file <path>

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Discovered during Log-it Android service fix where two background Claude Code agents completed their work but failed to send Telegram completion notifications due to shell expansion issues in the completion prompt.

Error Message

Agent writes report to temp file

cat > /tmp/agent-report.txt << 'REPORT' Done: Fixed 4 critical defects in LiveShiftForegroundService.kt

  • Timer replaced with Handler (tick loop survives exceptions)
  • foregroundServiceType changed from dataSync to health (6h limit removed)
  • PARTIAL_WAKE_LOCK acquired on shift start (Doze fix)
  • startForeground() moved to onCreate() (ANR window closed) REPORT

Safe send — no shell expansion risk

openclaw message send --channel telegram --target 8611381068 --message-file /tmp/agent-report.txt

Root Cause

Discovered during Log-it Android service fix where two background Claude Code agents completed their work but failed to send Telegram completion notifications due to shell expansion issues in the completion prompt.

Fix Action

Fix / Workaround

Current workaround patterns are fragile and error-prone:

# Dangerous — shell interpolates $, backticks, quotes
openclaw message send --message "$(cat report.txt)"

Code Example

# Dangerous — shell interpolates $, backticks, quotes
openclaw message send --message "$(cat report.txt)"

# Also fragile — heredoc still subject to expansion
openclaw message send --message "$(cat << 'EOF'
$(cat report.txt)
EOF
)"

---

openclaw message send --channel telegram --target 8611381068 --message-file /tmp/report.txt

---

# Agent writes report to temp file
cat > /tmp/agent-report.txt << 'REPORT'
Done: Fixed 4 critical defects in LiveShiftForegroundService.kt
- Timer replaced with Handler (tick loop survives exceptions)
- foregroundServiceType changed from dataSync to health (6h limit removed)
- PARTIAL_WAKE_LOCK acquired on shift start (Doze fix)
- startForeground() moved to onCreate() (ANR window closed)
REPORT

# Safe send — no shell expansion risk
openclaw message send --channel telegram --target 8611381068 --message-file /tmp/agent-report.txt
RAW_BUFFERClick to expand / collapse

Feature Request: --message-file flag for openclaw message send

Problem

When AI agents generate completion reports containing code blocks, JSON, multiline content, $ references, backticks, or quotes, passing them via shell expansion to --message causes:

  • Bad substitution errors (line 1: bad substitution)
  • Mangled or truncated messages
  • Silent send failures

Current workaround patterns are fragile and error-prone:

# Dangerous — shell interpolates $, backticks, quotes
openclaw message send --message "$(cat report.txt)"

# Also fragile — heredoc still subject to expansion
openclaw message send --message "$(cat << 'EOF'
$(cat report.txt)
EOF
)"

This means agent completion notifications — the primary way background tasks report back to users — are unreliable whenever output contains code.

Proposed Solution

Add a --message-file <path> flag to openclaw message send:

openclaw message send --channel telegram --target 8611381068 --message-file /tmp/report.txt

Acceptance Criteria

  • Reads file as UTF-8
  • Preserves multiline content exactly — no shell interpolation
  • Supports all existing routing flags (--channel, --target, --account, --reply-to, --thread-id)
  • Mutually exclusive with --message (error if both provided)
  • Handles max length: if file exceeds platform message limit, truncate with a trailing note ([truncated]) rather than silently dropping or failing
  • Returns nonzero exit code on send failure
  • Prints a clear error if the file does not exist or is not readable

Use Case

Agent completion notification pattern:

# Agent writes report to temp file
cat > /tmp/agent-report.txt << 'REPORT'
Done: Fixed 4 critical defects in LiveShiftForegroundService.kt
- Timer replaced with Handler (tick loop survives exceptions)
- foregroundServiceType changed from dataSync to health (6h limit removed)
- PARTIAL_WAKE_LOCK acquired on shift start (Doze fix)
- startForeground() moved to onCreate() (ANR window closed)
REPORT

# Safe send — no shell expansion risk
openclaw message send --channel telegram --target 8611381068 --message-file /tmp/agent-report.txt

Context

Discovered during Log-it Android service fix where two background Claude Code agents completed their work but failed to send Telegram completion notifications due to shell expansion issues in the completion prompt.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix feat: openclaw message send --message-file <path>