hermes - 💡(How to fix) Fix [Bug]: Terminal tool progress posts the full command as a fenced code block to messaging chats (regression after #42576)

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…

Root Cause

In gateway/run.py, the progress callback builds a fenced block for the terminal tool whenever the adapter advertises supports_code_blocks:

_code_block = f"{emoji} {tool_name}\n```\n{args['command'].rstrip()}\n```"

It is gated only on supports_code_blocks and tool_name == "terminal", with no per-platform switch.

A related gotcha hides this in tests: the existing gateway truncation tests call terminal progress with {} args, so they never reach the real args["command"] code-block path. They stay green while the full command still posts in practice. The verbose-mode path has the same exposure because it serializes the full args.

Fix Action

Fix / Workaround

The intent behind #42576 (full command visibility for users who want it) is reasonable for personal or interactive surfaces. The problem is that there is currently no way to keep terminal progress compact on a mobile or shared channel without turning off all tool progress, which also removes useful breadcrumbs like search_files, read_file, patch, and todo.

The full command is posted to the chat as a bare fenced code block, in both all/new and verbose modes. Turning tool progress off is the only current workaround, which also removes the useful non-terminal breadcrumbs.

Code Example

_code_block = f"{emoji} {tool_name}\n
RAW_BUFFERClick to expand / collapse

Bug Description

On markdown-capable messaging platforms (Telegram, WhatsApp, Slack, Feishu, Matrix, Weixin), the gateway tool-progress breadcrumb for the terminal tool renders the full, untruncated shell command as a bare fenced code block. Every other tool shows a short truncated preview (for example search_files: "..."), but terminal posts the complete command, including the working directory and any inline arguments, into the chat.

This is a regression. It was reported before, fixed, and then reintroduced:

  • #41955 / #41732 reported that compact tool progress leaked terminal commands as code blocks into messaging chats.
  • #42420 (fix(gateway): stop terminal progress from posting full commands to messaging chats) fixed it. Terminal progress rendered the compact truncated terminal: "..." preview.
  • #42576 (feat(gateway): render terminal commands as bare fenced code blocks in chat) reversed that fix and restored the full fenced command block as the default on markdown-capable platforms.

The intent behind #42576 (full command visibility for users who want it) is reasonable for personal or interactive surfaces. The problem is that there is currently no way to keep terminal progress compact on a mobile or shared channel without turning off all tool progress, which also removes useful breadcrumbs like search_files, read_file, patch, and todo.

Screenshot

A single terminal progress bubble on Telegram rendering a complete multi-line gh issue/pr list ... --jq ... command as a fenced code block, including cd /root/.hermes/hermes-agent:

Terminal command leaked as a fenced code block in Telegram

Steps to Reproduce

  1. Configure a markdown-capable platform (for example Telegram) and turn tool progress on for it, for example display.platforms.telegram.tool_progress: all.
  2. Send a message that makes the agent run a terminal command (anything multi-line or long).
  3. Watch the progress bubble.

Expected Behavior

Either the compact truncated terminal: "..." preview (matching every other tool), or a supported way to choose compact rendering per platform while keeping the full block available for users who want it. Setting compact should not require disabling all tool progress.

Actual Behavior

The full command is posted to the chat as a bare fenced code block, in both all/new and verbose modes. Turning tool progress off is the only current workaround, which also removes the useful non-terminal breadcrumbs.

Root Cause

In gateway/run.py, the progress callback builds a fenced block for the terminal tool whenever the adapter advertises supports_code_blocks:

_code_block = f"{emoji} {tool_name}\n```\n{args['command'].rstrip()}\n```"

It is gated only on supports_code_blocks and tool_name == "terminal", with no per-platform switch.

A related gotcha hides this in tests: the existing gateway truncation tests call terminal progress with {} args, so they never reach the real args["command"] code-block path. They stay green while the full command still posts in practice. The verbose-mode path has the same exposure because it serializes the full args.

Proposed Fix

Add a per-platform display setting terminal_progress with values compact and code_block, resolved through the existing per-platform display resolver:

  • code_block (default) keeps #42576 behavior, so nothing changes out of the box.
  • compact falls back to the short truncated terminal: "..." preview, so the full command is not posted, while other breadcrumbs stay visible.

This keeps the full block available for users who want it and gives mobile or shared deployments a supported, durable way to opt into compact rendering. Regression tests should drive the real {"command": ...} path so the leak surface is actually exercised.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp), Tools (terminal).

Messaging Platform

Telegram (and any markdown-capable adapter: WhatsApp, Slack, Feishu, Matrix, Weixin).

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