The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): a chat's /footer keeps the global footer key
Teknium04d666a7970f
diff --git a/gateway/slash_commands.py b/gateway/slash_commands.pyindex 61abb479191..6b928065578 100644--- a/gateway/slash_commands.py+++ b/gateway/slash_commands.py@@ -1055,11 +1055,12 @@ class GatewaySlashCommandsMixin(return t("gateway.footer.usage")new_state = _FOOTER_STATE_BY_ARG[arg] if arg else not effective["enabled"]try:- # The per-platform key, as /reasoning show|hide saves: every local surface reads the- # ``cli`` key (gateway.display_config.local_display_config), so the setting holds- # wherever it was set without a second, global key (T7).- _write_raw_config_leaf(config_path, ("display", "platforms", platform_key, "runtime_footer", "enabled"),- new_state)+ # A local session writes the ``cli`` key, as /reasoning show|hide saves: every local+ # surface reads it (gateway.display_config.local_display_config), so the setting holds+ # wherever it was set (T7). A chat's /footer keeps the global key it always wrote.+ leaf = (("display", "platforms", platform_key) if event.source.platform == Platform.LOCAL+ else ("display",)) + ("runtime_footer", "enabled")+ _write_raw_config_leaf(config_path, leaf, new_state)except Exception as e:logger.warning("Failed to save runtime_footer.enabled: %s", e)return t("gateway.config_save_failed", error=e)diff --git a/tests/gateway/test_local_display_key.py b/tests/gateway/test_local_display_key.pyindex 5cc23113437..0a31e4755fc 100644--- a/tests/gateway/test_local_display_key.py+++ b/tests/gateway/test_local_display_key.py@@ -134,3 +134,28 @@ def test_classic_cli_reasoning_hide_saves_the_local_key(monkeypatch):cli._handle_reasoning_command('/reasoning hide')assert saved == {'display.platforms.cli.show_reasoning': False}assert cli.show_reasoning is False++[email protected](('platform', 'path'), [+ ('telegram', ('display', 'runtime_footer', 'enabled')), # a chat's /footer stays global+ ('local', ('display', 'platforms', 'cli', 'runtime_footer', 'enabled')), # local: the cli key+])+def test_footer_writes_global_from_chat_and_cli_key_locally(tmp_path, monkeypatch, platform, path):+ from gateway import run+ from gateway.config import Platform+ from gateway.platforms.base import MessageEvent+ from gateway.session import SessionSource+ from hermes_cli.config import read_user_config_raw++ (tmp_path / 'config.yaml').write_text(json.dumps({'display': {'runtime_footer': {'enabled': False}}}))+ monkeypatch.setattr(run, '_gateway_config_home', lambda: tmp_path)+ runner = object.__new__(run.GatewayRunner)+ source = SessionSource(platform=Platform(platform), chat_id='c1', user_id='u1', chat_type='dm')+ asyncio.run(runner._handle_footer_command(MessageEvent(text='/footer on', source=source)))+ saved = read_user_config_raw(tmp_path / 'config.yaml')+ node = saved+ for part in path:+ node = node[part]+ assert node is True, saved+ if platform == 'telegram':+ assert 'platforms' not in saved['display'], saved