Skip to content

Telegram: Exec tool output leaks to chat during active agent turn (streamMode partial preview) #19912

@firstmovr

Description

@firstmovr

Problem

When an agent runs exec tool calls during an active turn, the raw command + output is delivered to the Telegram channel as a visible message, even when the exec succeeds (exit code 0).

Example of what appears in Telegram:

⚠️ 🛠️ Exec: grep -c "pattern" /path/to/file 2>&1 failed: 0

This leaks internal tool execution details (commands, file paths, patterns) to end users who should only see the agent's final response.

Expected Behavior

Exec tool calls during an active agent turn should never produce visible Telegram messages. Only the agent's composed reply should be delivered.

Current Behavior

With default config or streamMode: "partial", exec tool invocations produce visible ⚠️ 🛠️ Exec: messages in Telegram. These include:

  • The full shell command being executed
  • File paths and arguments
  • Exit codes (even 0 / success cases)

Workaround

Setting streamMode: "off" on the Telegram account config suppresses these, but also disables all streaming (partial message delivery).

Environment

  • OpenClaw v2026.2.15
  • Telegram channel (bot API)
  • Occurs with both main session and sub-agent exec calls

Analysis

The stream preview path appears to format exec tool calls as user-visible messages regardless of success/failure status. This is separate from #19894 (which covers sub-agent exec failures leaking despite suppressToolErrors).

The root issue seems to be that the Telegram streaming renderer treats exec tool-use blocks as content to preview, rather than filtering them as internal-only tool operations.

Suggested Fix

The streaming preview for Telegram should:

  1. Never render exec tool-use blocks as visible messages
  2. Or at minimum, respect a config flag like messages.suppressToolPreviews: true

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions