From b2a4766463a74ee1500ead5178d5e04731b54787 Mon Sep 17 00:00:00 2001 From: xxxigm Date: Mon, 15 Jun 2026 19:09:49 +0700 Subject: [PATCH] fix(dump): report effective terminal backend in `hermes debug` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `terminal.backend` in config.yaml is bridged to the TERMINAL_ENV env var, but a TERMINAL_ENV set in .env / the shell overrides config and is what terminal_tool actually uses. The dump printed only the config value, so a user whose agent was jailed in a docker/podman sandbox via a stale TERMINAL_ENV still saw `terminal: local` — hiding the real cause. Report the effective backend and flag when TERMINAL_ENV overrides config.yaml. --- hermes_cli/dump.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/hermes_cli/dump.py b/hermes_cli/dump.py index 16d6f6069f9..239a6994b61 100644 --- a/hermes_cli/dump.py +++ b/hermes_cli/dump.py @@ -252,9 +252,24 @@ def run_dump(args): except Exception: profile = "(default)" - # Terminal backend + # Terminal backend — report the EFFECTIVE backend, not just config.yaml. + # ``terminal.backend`` in config.yaml is bridged to the TERMINAL_ENV env var, + # but a TERMINAL_ENV set directly in .env / the shell overrides config and is + # what terminal_tool actually uses (tools/terminal_tool.py reads TERMINAL_ENV). + # Reporting only the config value hides that override and sends users chasing + # the wrong cause when the agent runs in a docker/podman sandbox even though + # config says "local" (and vice-versa). run_dump() has already loaded .env, + # so os.environ reflects the real override here. terminal_cfg = config.get("terminal", {}) - backend = terminal_cfg.get("backend", "local") + config_backend = terminal_cfg.get("backend", "local") + env_backend = (os.environ.get("TERMINAL_ENV") or "").strip().lower() + if env_backend and env_backend != str(config_backend).strip().lower(): + backend = ( + f"{env_backend} (TERMINAL_ENV overrides config.yaml " + f"terminal.backend={config_backend})" + ) + else: + backend = config_backend # OpenAI SDK version try: