Skip to content

feat(gateway): render terminal commands as bare fenced code blocks in chat#42576

Merged
teknium1 merged 1 commit into
mainfrom
feat/terminal-codeblock-progress
Jun 9, 2026
Merged

feat(gateway): render terminal commands as bare fenced code blocks in chat#42576
teknium1 merged 1 commit into
mainfrom
feat/terminal-codeblock-progress

Conversation

@teknium1

@teknium1 teknium1 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Terminal tool progress on markdown-capable gateways (Telegram, Slack, Discord, WhatsApp, Matrix, Weixin, Feishu) renders the full command in a fenced code block again — in all/new AND verbose modes — and no longer prints a literal bash line on Slack.

Restores the #41215 feature that #41950 removed. For a personal assistant, seeing the command your agent ran is the desired default; the "full command visible in a group chat" concern is a preference, not a vulnerability, and plain-text platforms still fall back to the short truncated preview.

Changes

  • gateway/run.py: progress_callback builds a fenced block for the terminal tool when the adapter sets supports_code_blocks, wired into both the verbose branch and the all/new branch. Bare ``` fence — no language tag.
  • gateway/platforms/base.py: updated the supports_code_blocks doc comment to reflect that tool progress uses it again.
  • tests/gateway/test_run_progress_topics.py: inverted the fix(gateway): stop terminal progress from posting the full command to messaging chats #41950 regression test to assert the fenced block is present (no bash tag, full command body, no truncated preview); the existing truncation tests are unaffected (they pass {} args, so the code-block gate never fires).

Why no language tag

Slack mrkdwn does not support syntax-highlight language hints — a ```bash fence renders bash as a literal first code line. A bare ``` fence renders correctly on every platform that supports code blocks.

Validation

Platform class Render
supports_code_blocks=True (Telegram/Slack/Discord/…) 💻 terminal\n```\n<full command>\n``` — bare fence, full command
plain-text terminal: "set -euo…" truncated preview (unchanged)

E2E-verified the real progress_callback path on a code-block adapter (fence present, no bash tag, full command) and a plain adapter (truncated preview). tests/gateway/test_run_progress_topics.py: 30/30 pass.

Infographic

terminal-code-blocks-mission-patch

… chat

Terminal tool progress on markdown-capable gateways (Telegram, Slack,
Discord, WhatsApp, Matrix, Weixin, Feishu) renders the full command in a
fenced code block again, in all/new AND verbose modes — gated on the
adapter's supports_code_blocks capability. Plain-text platforms keep the
short truncated preview.

No language tag is emitted: Slack mrkdwn renders a '```bash' fence with
'bash' as a literal first code line, so a bare '```' fence is used, which
renders correctly on every platform that supports blocks.

This restores the #41215 feature (removed in #41950 due to the command
showing in group chats) as the default. For a personal assistant the
command display is desired; the group-chat concern is a preference, not a
vulnerability.
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: feat/terminal-codeblock-progress vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10579 on HEAD, 10579 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5557 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Jun 9, 2026
@teknium1 teknium1 merged commit 3705625 into main Jun 9, 2026
23 checks passed
@teknium1 teknium1 deleted the feat/terminal-codeblock-progress branch June 9, 2026 04:19
a249169329-cpu pushed a commit to a249169329-cpu/hermes-agent that referenced this pull request Jun 9, 2026
… chat (NousResearch#42576)

Terminal tool progress on markdown-capable gateways (Telegram, Slack,
Discord, WhatsApp, Matrix, Weixin, Feishu) renders the full command in a
fenced code block again, in all/new AND verbose modes — gated on the
adapter's supports_code_blocks capability. Plain-text platforms keep the
short truncated preview.

No language tag is emitted: Slack mrkdwn renders a '```bash' fence with
'bash' as a literal first code line, so a bare '```' fence is used, which
renders correctly on every platform that supports blocks.

This restores the NousResearch#41215 feature (removed in NousResearch#41950 due to the command
showing in group chats) as the default. For a personal assistant the
command display is desired; the group-chat concern is a preference, not a
vulnerability.
wachoo pushed a commit to wachoo/hermes-agent that referenced this pull request Jun 10, 2026
… chat (NousResearch#42576)

Terminal tool progress on markdown-capable gateways (Telegram, Slack,
Discord, WhatsApp, Matrix, Weixin, Feishu) renders the full command in a
fenced code block again, in all/new AND verbose modes — gated on the
adapter's supports_code_blocks capability. Plain-text platforms keep the
short truncated preview.

No language tag is emitted: Slack mrkdwn renders a '```bash' fence with
'bash' as a literal first code line, so a bare '```' fence is used, which
renders correctly on every platform that supports blocks.

This restores the NousResearch#41215 feature (removed in NousResearch#41950 due to the command
showing in group chats) as the default. For a personal assistant the
command display is desired; the group-chat concern is a preference, not a
vulnerability.
changman pushed a commit to changman/hermes-agent that referenced this pull request Jun 10, 2026
… chat (NousResearch#42576)

Terminal tool progress on markdown-capable gateways (Telegram, Slack,
Discord, WhatsApp, Matrix, Weixin, Feishu) renders the full command in a
fenced code block again, in all/new AND verbose modes — gated on the
adapter's supports_code_blocks capability. Plain-text platforms keep the
short truncated preview.

No language tag is emitted: Slack mrkdwn renders a '```bash' fence with
'bash' as a literal first code line, so a bare '```' fence is used, which
renders correctly on every platform that supports blocks.

This restores the NousResearch#41215 feature (removed in NousResearch#41950 due to the command
showing in group chats) as the default. For a personal assistant the
command display is desired; the group-chat concern is a preference, not a
vulnerability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants