Skip to content

The agent that grows with you

fix(config): canonicalize platforms.<name>.<display_setting> at one chokepoint; mirror on get/unset (#71047 Problem A)

Tekniumcb446a5bed37
diff --git a/tests/hermes_cli/test_config_set_platforms_redirect.py b/tests/hermes_cli/test_config_set_platforms_redirect.py
index d4b83876aab..803a70e58ff 100644
--- a/tests/hermes_cli/test_config_set_platforms_redirect.py
+++ b/tests/hermes_cli/test_config_set_platforms_redirect.py
@@ -93,3 +93,65 @@ class TestPerPlatformDisplayRedirect:
result = yaml.safe_load((home / "config.yaml").read_text())
assert result["display"]["platforms"]["telegram"]["streaming"] is True
assert "platforms" not in result # no stray top-level platforms block
+
+
+class TestRedirectSiblingSurfaces:
+ """The canonicalization must hold for every CLI surface that takes a dotted
+ key — set, get, unset — and the written value must be what the gateway's
+ resolver actually reads (the #71047 symptom was CLI and runtime disagreeing).
+ """
+
+ def test_get_mirrors_gateway_resolution_after_set(self, hermes_home, monkeypatch, capsys):
+ from gateway.display_config import resolve_display_setting
+ from hermes_cli.config import get_config_value
+
+ _set(monkeypatch, hermes_home, "platforms.telegram.streaming", "false")
+ capsys.readouterr()
+ get_config_value("platforms.telegram.streaming")
+ assert capsys.readouterr().out.strip() == "false"
+
+ raw = yaml.safe_load((hermes_home / "config.yaml").read_text())
+ assert resolve_display_setting(raw, "telegram", "streaming") is False
+
+ def test_unset_removes_the_redirected_leaf(self, hermes_home, monkeypatch):
+ from hermes_cli.config import unset_config_value
+
+ _set(monkeypatch, hermes_home, "platforms.telegram.streaming", "false")
+ unset_config_value("platforms.telegram.streaming")
+ result = yaml.safe_load((hermes_home / "config.yaml").read_text())
+ assert "streaming" not in result["display"]["platforms"]["telegram"]
+ # Sibling display override and connection block untouched.
+ assert result["display"]["platforms"]["telegram"]["show_reasoning"] is True
+ assert result["platforms"]["telegram"] == {"token": "secret-bot-token"}
+
+ def test_unset_missing_redirected_leaf_exits_nonzero(self, hermes_home, monkeypatch):
+ from hermes_cli.config import unset_config_value
+
+ monkeypatch.setenv("HERMES_HOME", str(hermes_home))
+ with pytest.raises(SystemExit) as exc:
+ unset_config_value("platforms.telegram.streaming")
+ assert exc.value.code == 1
+
+ def test_set_prints_redirect_note(self, hermes_home, monkeypatch, capsys):
+ _set(monkeypatch, hermes_home, "platforms.telegram.streaming", "false")
+ out = capsys.readouterr().out
+ assert "saved as display.platforms.telegram.streaming" in out
+ assert "Set display.platforms.telegram.streaming = False" in out
+
+ def test_redirect_helper_only_touches_known_display_keys(self):
+ from gateway.display_config import OVERRIDEABLE_KEYS
+ from hermes_cli.config import _redirect_platform_display_key
+
+ for setting in OVERRIDEABLE_KEYS:
+ canonical, note = _redirect_platform_display_key(f"platforms.discord.{setting}")
+ assert canonical == f"display.platforms.discord.{setting}"
+ assert note
+ for key in (
+ "platforms.telegram.token",
+ "platforms.telegram.reply_to_mode",
+ "platforms.telegram.extra.foo", # 4 segments — not a display leaf
+ "platforms.telegram",
+ "display.platforms.telegram.streaming", # already canonical
+ "streaming.enabled",
+ ):
+ assert _redirect_platform_display_key(key) == (key, None)
diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.md
index 0c270e5660b..b1d55705766 100644
--- a/website/docs/user-guide/configuration.md
+++ b/website/docs/user-guide/configuration.md
@@ -2064,6 +2064,8 @@ 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.
+
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.
Signal is listed as a valid platform key because the setting can be saved per platform, but the current Signal adapter cannot edit sent messages and does not render tool-progress bubbles. Keep Signal `tool_progress` set to `off`; use the CLI or an editing-capable messaging platform if you need to watch each tool call live.