mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
fix: normalize display boolean strings
This commit is contained in:
parent
b9de7044aa
commit
14c91ade32
2 changed files with 21 additions and 0 deletions
|
|
@ -239,6 +239,10 @@ def _normalise(setting: str, value: Any) -> Any:
|
|||
if value is True:
|
||||
return "all"
|
||||
val = str(value).strip().lower()
|
||||
if val in {"false", "0", "no"}:
|
||||
return "off"
|
||||
if val in {"true", "1", "yes", "on"}:
|
||||
return "all"
|
||||
return val if val in {"off", "new", "all", "verbose", "log"} else "all"
|
||||
if setting in {
|
||||
"show_reasoning",
|
||||
|
|
@ -246,6 +250,7 @@ def _normalise(setting: str, value: Any) -> Any:
|
|||
"interim_assistant_messages",
|
||||
"long_running_notifications",
|
||||
"busy_ack_detail",
|
||||
"busy_steer_ack_enabled",
|
||||
"thinking_progress",
|
||||
}:
|
||||
if isinstance(value, str):
|
||||
|
|
|
|||
|
|
@ -54,6 +54,22 @@ class TestResolveDisplaySetting:
|
|||
# Unknown platform, no config → global default "all"
|
||||
assert resolve_display_setting(config, "unknown_platform", "tool_progress") == "all"
|
||||
|
||||
def test_tool_progress_boolean_like_strings_normalise(self):
|
||||
"""Quoted YAML booleans should not unexpectedly enable progress."""
|
||||
from gateway.display_config import resolve_display_setting
|
||||
|
||||
assert resolve_display_setting({"display": {"tool_progress": "false"}}, "telegram", "tool_progress") == "off"
|
||||
assert resolve_display_setting({"display": {"tool_progress": "0"}}, "telegram", "tool_progress") == "off"
|
||||
assert resolve_display_setting({"display": {"tool_progress": "no"}}, "telegram", "tool_progress") == "off"
|
||||
assert resolve_display_setting({"display": {"tool_progress": "true"}}, "telegram", "tool_progress") == "all"
|
||||
|
||||
def test_busy_steer_ack_enabled_string_false_normalises(self):
|
||||
from gateway.display_config import resolve_display_setting
|
||||
|
||||
config = {"display": {"platforms": {"telegram": {"busy_steer_ack_enabled": "false"}}}}
|
||||
|
||||
assert resolve_display_setting(config, "telegram", "busy_steer_ack_enabled", True) is False
|
||||
|
||||
def test_fallback_parameter_used_last(self):
|
||||
"""Explicit fallback is used when nothing else matches."""
|
||||
from gateway.display_config import resolve_display_setting
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue