Skip to content

The agent that grows with you

docs(cli): say "list-literal" where the coerce docstrings said "JSON-list"

liuhao10246611ed0cac2c
diff --git a/hermes_cli/tools_config.py b/hermes_cli/tools_config.py
index 03b8a949cd4..c12dcdab386 100644
--- a/hermes_cli/tools_config.py
+++ b/hermes_cli/tools_config.py
@@ -550,13 +550,15 @@ def _context_engine_active(config: dict) -> bool:
def _coerce_platform_toolsets_value(value):
- """Read a JSON-list string saved for ``platform_toolsets.<platform>`` as the list it encodes.
+ """Read a list-literal string saved for ``platform_toolsets.<platform>`` as the list it encodes.
``hermes config set`` stores a bare ``[...]`` argument as a plain string, so an explicit
selection like ``'["browser", "terminal"]'`` parses as str, not list — readers then treat
the platform as unconfigured and substitute the platform default, and the next save
- overwrites the user's entries (#115866). Anything that does not parse as a list keeps its
- original value: a scalar string still means "not a list" and keeps the default fallback.
+ overwrites the user's entries (#115866). The parser is ``ast.literal_eval``, so any
+ Python list literal (JSON-style double quotes included) is accepted. Anything that does
+ not parse as a list keeps its original value: a scalar string still means "not a list"
+ and keeps the default fallback.
"""
if isinstance(value, str) and value.strip().startswith("["):
try:
diff --git a/tests/hermes_cli/test_tools_config.py b/tests/hermes_cli/test_tools_config.py
index 3fa23acdc85..9ec8db25145 100644
--- a/tests/hermes_cli/test_tools_config.py
+++ b/tests/hermes_cli/test_tools_config.py
@@ -111,7 +111,7 @@ def test_string_platform_toolsets_resolves_as_the_list_it_encodes():
def test_enable_on_string_platform_toolsets_keeps_listed_entries():
- """#115866: `hermes tools enable` must operate on the selection a JSON-list
+ """#115866: `hermes tools enable` must operate on the selection a list-literal
string encodes — not re-baseline it on the platform default, which silently
dropped the user's default-off entries (video, video_gen) on write."""
config = {"platform_toolsets": {"telegram": '["browser", "terminal", "video", "video_gen"]'}}