From 93397690693c52fde17d1e21a0de33720c6ef5ad Mon Sep 17 00:00:00 2001 From: iacker <82095453+iacker@users.noreply.github.com> Date: Sat, 27 Jun 2026 01:44:28 +0200 Subject: [PATCH] fix(terminal): don't hardcode 'Linux environment' in tool description (#7672) The terminal tool description opened with 'Execute shell commands on a Linux environment', which is misleading for users running locally on Windows/macOS or against a non-Linux configured backend. Reword to frame the environment as configured (local machine, Docker container, or cloud sandbox depending on setup), without claiming Linux. Minimal one-line change to the description string; the rest of the prompt (read_file/search_files/patch guidance, persistence contract) is untouched. Adds an invariant-style test asserting the description no longer hardcodes Linux and names the real configured options. Rebased reimplementation of #23242 onto current main. --- tests/tools/test_terminal_tool_description.py | 28 +++++++++++++++++++ tools/terminal_tool.py | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/tools/test_terminal_tool_description.py diff --git a/tests/tools/test_terminal_tool_description.py b/tests/tools/test_terminal_tool_description.py new file mode 100644 index 0000000000000..3eb241917d91c --- /dev/null +++ b/tests/tools/test_terminal_tool_description.py @@ -0,0 +1,28 @@ +"""Regression test for the terminal tool description wording (issue #7672). + +The description used to claim "Execute shell commands on a Linux environment", +which is misleading for users running locally on Windows/macOS or in a non-Linux +configured backend. Pin the invariant: the description must describe the +environment as *configured* rather than hardcoding Linux. +""" + +from __future__ import annotations + +from tools.terminal_tool import TERMINAL_TOOL_DESCRIPTION + + +def test_terminal_description_does_not_hardcode_linux(): + # The core of issue #7672: don't assert every user is on Linux. + assert "Linux environment" not in TERMINAL_TOOL_DESCRIPTION + + +def test_terminal_description_mentions_configured_environment(): + # It should frame the environment as setup-dependent, naming the real options. + assert "configured execution environment" in TERMINAL_TOOL_DESCRIPTION + assert "local machine" in TERMINAL_TOOL_DESCRIPTION + assert "Docker container" in TERMINAL_TOOL_DESCRIPTION + + +def test_terminal_description_keeps_persistence_contract(): + # The persistence guidance the rest of the prompt relies on must survive. + assert "persist between calls" in TERMINAL_TOOL_DESCRIPTION diff --git a/tools/terminal_tool.py b/tools/terminal_tool.py index 6a5a6af1fdfe0..962d1ca3ca414 100644 --- a/tools/terminal_tool.py +++ b/tools/terminal_tool.py @@ -932,7 +932,7 @@ def _transform_sudo_command(command: str | None) -> tuple[str | None, str | None # Tool description for LLM -TERMINAL_TOOL_DESCRIPTION = """Execute shell commands on a Linux environment. Filesystem, current working directory, and exported environment variables persist between calls. +TERMINAL_TOOL_DESCRIPTION = """Execute shell commands in the configured execution environment (local machine, Docker container, or cloud sandbox depending on setup — not necessarily Linux). Filesystem, current working directory, and exported environment variables persist between calls. Do NOT use cat/head/tail to read files — use read_file instead. Do NOT use grep/rg/find to search — use search_files instead.