Skip to content

The agent that grows with you

fix(config): hermes config set gateway.platforms.<p>.<field> lands on the top-level platforms block

teknium17c41e31e1bb9
diff --git a/hermes_cli/config.py b/hermes_cli/config.py
index 3cc1a1fc145..2dd7cf647f7 100644
--- a/hermes_cli/config.py
+++ b/hermes_cli/config.py
@@ -3384,16 +3384,26 @@ def _redirect_platform_display_key(key: str) -> tuple[str, Optional[str]]:
Before #71047 a write such as ``hermes config set platforms.telegram.streaming false`` landed on a key
the gateway never reads: ``config get`` echoed the new value back while the runtime kept the old
``display.platforms`` one — a silent no-op that looks like a duplicated key to the user.
+
+ ``gateway.platforms.<name>.<field>`` is canonicalized to the top-level ``platforms.<name>.<field>``
+ first (#115212): ``merge_platform_sections`` reads both blocks but the top-level one wins on
+ shared keys, so a nested write beside an existing top-level value printed ``✓ Set`` while the
+ gateway kept the old value.
"""
segs = _split_key_path(key)
+ note = None
+ if len(segs) >= 3 and segs[0] == "gateway" and segs[1] == "platforms":
+ segs = segs[1:]
+ key = ".".join(segs)
+ note = f" (note: the top-level platforms.{segs[1]} block outranks gateway.platforms — saved as {key})"
if len(segs) != 3 or segs[0] != "platforms":
- return key, None
+ return key, note
try:
from gateway.display_config import OVERRIDEABLE_KEYS as _display_keys
except Exception:
- return key, None
+ return key, note
if segs[2] not in _display_keys:
- return key, None
+ return key, note
canonical = f"display.platforms.{segs[1]}.{segs[2]}"
return canonical, f" (note: per-platform display setting — saved as {canonical})"
diff --git a/tests/hermes_cli/test_set_config_value.py b/tests/hermes_cli/test_set_config_value.py
index b4cae005633..a3f40f5666d 100644
--- a/tests/hermes_cli/test_set_config_value.py
+++ b/tests/hermes_cli/test_set_config_value.py
@@ -89,6 +89,28 @@ class TestCatchAllPatterns:
# Non-secret keys → config.yaml
# ---------------------------------------------------------------------------
+class TestGatewayPlatformsPrefixRedirect:
+ """#115212: ``gateway.platforms.<p>.<field>`` lands on the top-level ``platforms.<p>.<field>``
+ the gateway prefers, instead of a nested key that an existing top-level value shadows."""
+
+ def test_set_lands_on_top_level_platforms_block_the_loader_reads(self, _isolated_hermes_home, capsys):
+ (_isolated_hermes_home / "config.yaml").write_text(
+ "platforms:\n telegram:\n enabled: false\n", encoding="utf-8")
+ set_config_value("gateway.platforms.telegram.enabled", "true")
+ out = capsys.readouterr().out
+ assert "saved as platforms.telegram.enabled" in out
+ loaded = yaml.safe_load(_read_config(_isolated_hermes_home))
+ assert loaded["platforms"]["telegram"]["enabled"] is True
+ assert "gateway" not in loaded
+ from gateway.config import Platform, load_gateway_config
+ assert load_gateway_config().platforms[Platform.TELEGRAM].enabled is True
+
+ def test_nested_display_setting_still_reaches_display_platforms(self):
+ from hermes_cli.config import _redirect_platform_display_key
+ key, _ = _redirect_platform_display_key("gateway.platforms.telegram.streaming")
+ assert key == "display.platforms.telegram.streaming"
+
+
class TestConfigYamlRouting:
"""Regular config keys should go to config.yaml, NOT .env."""
diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.md
index aabb5698448..cc96dc0285f 100644
--- a/website/docs/user-guide/configuration.md
+++ b/website/docs/user-guide/configuration.md
@@ -2339,7 +2339,7 @@ display:
tool_progress: 'off' # quiet in shared Slack workspace
```
-From the CLI, use the canonical path — `hermes config set display.platforms.telegram.streaming false`. The shorthand `hermes config set platforms.telegram.streaming false` is accepted too: because per-platform *display* settings (`streaming`, `show_reasoning`, `tool_progress`, …) are only ever read from `display.platforms`, `config set`/`get`/`unset` redirect that shorthand to the canonical key and print a note. Connection keys under the top-level `platforms.<name>` block (`token`, `enabled`, `reply_to_mode`, `extra`) are not redirected.
+From the CLI, use the canonical path — `hermes config set display.platforms.telegram.streaming false`. The shorthand `hermes config set platforms.telegram.streaming false` is accepted too: because per-platform *display* settings (`streaming`, `show_reasoning`, `tool_progress`, …) are only ever read from `display.platforms`, `config set`/`get`/`unset` redirect that shorthand to the canonical key and print a note. Connection keys under the top-level `platforms.<name>` block (`token`, `enabled`, `reply_to_mode`, `extra`) are not redirected. Writing them under the nested prefix (`hermes config set gateway.platforms.telegram.enabled true`) is redirected to the top-level `platforms.telegram.enabled` with a note: the gateway reads both blocks, but the top-level one wins on shared keys, so a nested write would be silently shadowed by an existing top-level value.
Platforms without an override fall back to the global `tool_progress` value. Valid platform keys: `telegram`, `discord`, `slack`, `signal`, `whatsapp`, `matrix`, `mattermost`, `email`, `sms`, `homeassistant`, `dingtalk`, `feishu`, `wecom`, `weixin`, `bluebubbles`, `qqbot`. The legacy `display.tool_progress_overrides` key still loads for backward compatibility but is deprecated and migrated into `display.platforms` on first load.