fix: YAML boolean handling for tool_progress config (#3300)

YAML 1.1 parses bare `off` as boolean False, which is falsy in
Python's `or` chain and silently falls through to the 'all' default.
Users setting `display.tool_progress: off` in config.yaml saw no
effect — tool progress stayed on.

Normalise False → 'off' before the or chain in both affected paths:
- gateway/run.py _run_agent() tool progress reader
- cli.py HermesCLI.__init__() tool_progress_mode

Reported by @gibbsoft in #2859. Closes #2859.
This commit is contained in:
Teknium
2026-03-26 17:58:50 -07:00
committed by GitHub
parent 2d232c9991
commit 3c57eaf744
2 changed files with 10 additions and 3 deletions

4
cli.py
View File

@@ -1036,7 +1036,9 @@ class HermesCLI:
self.config = CLI_CONFIG self.config = CLI_CONFIG
self.compact = compact if compact is not None else CLI_CONFIG["display"].get("compact", False) self.compact = compact if compact is not None else CLI_CONFIG["display"].get("compact", False)
# tool_progress: "off", "new", "all", "verbose" (from config.yaml display section) # tool_progress: "off", "new", "all", "verbose" (from config.yaml display section)
self.tool_progress_mode = CLI_CONFIG["display"].get("tool_progress", "all") # YAML 1.1 parses bare `off` as boolean False — normalise to string.
_raw_tp = CLI_CONFIG["display"].get("tool_progress", "all")
self.tool_progress_mode = "off" if _raw_tp is False else str(_raw_tp)
# resume_display: "full" (show history) | "minimal" (one-liner only) # resume_display: "full" (show history) | "minimal" (one-liner only)
self.resume_display = CLI_CONFIG["display"].get("resume_display", "full") self.resume_display = CLI_CONFIG["display"].get("resume_display", "full")
# bell_on_complete: play terminal bell (\a) when agent finishes a response # bell_on_complete: play terminal bell (\a) when agent finishes a response

View File

@@ -4805,9 +4805,14 @@ class GatewayRunner:
enabled_toolsets = sorted(_get_platform_tools(user_config, platform_key)) enabled_toolsets = sorted(_get_platform_tools(user_config, platform_key))
# Tool progress mode from config.yaml: "all", "new", "verbose", "off" # Tool progress mode from config.yaml: "all", "new", "verbose", "off"
# Falls back to env vars for backward compatibility # Falls back to env vars for backward compatibility.
# YAML 1.1 parses bare `off` as boolean False — normalise before
# the `or` chain so it doesn't silently fall through to "all".
_raw_tp = user_config.get("display", {}).get("tool_progress")
if _raw_tp is False:
_raw_tp = "off"
progress_mode = ( progress_mode = (
user_config.get("display", {}).get("tool_progress") _raw_tp
or os.getenv("HERMES_TOOL_PROGRESS_MODE") or os.getenv("HERMES_TOOL_PROGRESS_MODE")
or "all" or "all"
) )