Skip to content

fix(gateway): stop terminal progress from posting full commands to messaging chats#42420

Merged
teknium1 merged 1 commit into
mainfrom
salvage/41950-terminal-progress-leak
Jun 8, 2026
Merged

fix(gateway): stop terminal progress from posting full commands to messaging chats#42420
teknium1 merged 1 commit into
mainfrom
salvage/41950-terminal-progress-leak

Conversation

@teknium1

@teknium1 teknium1 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Terminal tool progress no longer posts full shell commands into messaging chats — it goes back to the short truncated terminal: "cmd…" preview every other tool uses.

Root cause: #41215 (commit dde9c0d) rendered terminal commands as untruncated ```bash fenced blocks on markdown gateways (Telegram, WhatsApp, Slack, Discord) in all progress modes, dumping heredocs, internal paths, and destructive commands into the chat before the final answer — visible to everyone in it.

Changes

  • gateway/run.py: remove the _bash_block rendering path; terminal progress uses the standard truncated preview (capped at tool_preview_length) in all modes
  • gateway/platforms/base.py: supports_code_blocks capability retained for future markdown features; comment updated to record that tool progress deliberately no longer renders commands as bash blocks
  • CLI/TUI rendering is a separate path and was unaffected

Validation

Before After
Telegram/WhatsApp progress full bash command block terminal: "set -e printf…" truncated preview
tests/gateway/test_run_progress_topics.py 30/30 pass

Fixes #41955, #41732. Salvaged from #41950 onto current main; @GodsBoy's commit authorship preserved.

Infographic

gateway-progress-rendering-two-fixes

… messaging chats

#41215 rendered a terminal tool call as a native ```bash fenced block on
markdown platforms (Telegram, WhatsApp, Slack, and others), showing the full
command with no truncation, in both all/new and verbose modes. That posted
complete shell commands (heredocs, internal paths, destructive commands) into
the chat before the final answer, visible to everyone in it.

This restores the prior behavior: terminal progress shows the short, truncated
preview line that every other tool already uses, capped at tool_preview_length.
The supports_code_blocks capability flag is left in place for future use.
CLI/TUI rendering is a separate path and was unaffected.

Adds a regression test asserting terminal progress renders as a truncated
preview, not a fenced bash block, even on a markdown-capable gateway.

Fixes #41955
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 P2 Medium — degraded but workaround exists tool/terminal Terminal execution and process management type/security Security vulnerability or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway tool progress leaks raw shell commands and code bodies to messaging chats

3 participants