Skip to content

The agent that grows with you

fix(config): config set/get still recognise terminal.singularity_image

Teknium8237c7f8ec17
diff --git a/hermes_cli/config.py b/hermes_cli/config.py
index 517f0da4205..e069959754a 100644
--- a/hermes_cli/config.py
+++ b/hermes_cli/config.py
@@ -3086,7 +3086,8 @@ def _validate_config_key(key: str) -> tuple[bool, Optional[str]]:
# A leading underscore on the FIRST segment marks an intentionally non-schema internal key
# (test harnesses/tooling); only the first segment is exempt so ``agent._max_turns`` is caught.
- if top.startswith("_") or top in _PLATFORM_CONTAINER_KEYS:
+ from hermes_cli.left_core_migration import LEFT_CORE_TERMINAL_KEYS
+ if top.startswith("_") or top in _PLATFORM_CONTAINER_KEYS or key in LEFT_CORE_TERMINAL_KEYS:
return True, None
known = _known_top_level_keys()
@@ -3394,15 +3395,6 @@ def _print_unknown_key_notice(key: str, suggestion: Optional[str]) -> None:
print(color(" (Use --force to skip this notice.)", Colors.DIM))
-def _unknown_subkey_refusal(key: str, suggestion: Optional[str]) -> str:
- lines = [color(f"✗ '{key}' is not a recognized config key — nothing was written.", Colors.RED)]
- if suggestion:
- lines.append(color(f" Did you mean: {suggestion}", Colors.YELLOW))
- lines.append(color(
- " (Custom top-level keys are supported; use --force to write this path anyway.)", Colors.DIM))
- return "\n".join(lines)
-
-
def set_config_value(key: str, value: str, force: bool = False):
"""Set a configuration value at a dotted ``key``; ``value`` is auto-coerced to bool/int/float.
``force`` writes a known key given under the wrong prefix (``gateway.discord.foo`` where
@@ -3457,7 +3449,8 @@ def set_config_value(key: str, value: str, force: bool = False):
# seeded default. Refuse only the positive wrong-prefix case from #112003; other unknown
# paths keep the post-write warning so valid runtime settings remain configurable.
if not is_known and not force and _is_wrong_prefix_suggestion(key, suggestion):
- _exit_invalid(_unknown_subkey_refusal(key, suggestion))
+ from hermes_cli.config_key_notices import unknown_subkey_refusal
+ _exit_invalid(unknown_subkey_refusal(key, suggestion))
if key == "display.language":
from hermes_cli.config_language import display_language_error
@@ -3638,8 +3631,8 @@ def unset_config_value(key: str):
if legacy_key:
removed = _unset_nested(user_config, legacy_key) or removed
- from hermes_cli.left_core_migration import RETIRED_TERMINAL_ENV_COPIES
- env_var = terminal_config_env_var_for_key(key) or RETIRED_TERMINAL_ENV_COPIES.get(key)
+ from hermes_cli.left_core_migration import LEFT_CORE_TERMINAL_KEYS
+ env_var = terminal_config_env_var_for_key(key) or LEFT_CORE_TERMINAL_KEYS.get(key)
if env_var and key != "terminal.cwd":
removed = remove_env_value(env_var) or removed
diff --git a/hermes_cli/config_key_notices.py b/hermes_cli/config_key_notices.py
new file mode 100644
index 00000000000..74965726184
--- /dev/null
+++ b/hermes_cli/config_key_notices.py
@@ -0,0 +1,17 @@
+"""Notices ``hermes config set`` prints for a key path the schema does not know."""
+
+from __future__ import annotations
+
+from typing import Optional
+
+from hermes_cli.colors import Colors, color
+
+
+def unknown_subkey_refusal(key: str, suggestion: Optional[str]) -> str:
+ """The refusal for a known key given under the wrong prefix (``gateway.discord.foo``)."""
+ lines = [color(f"✗ '{key}' is not a recognized config key — nothing was written.", Colors.RED)]
+ if suggestion:
+ lines.append(color(f" Did you mean: {suggestion}", Colors.YELLOW))
+ lines.append(color(
+ " (Custom top-level keys are supported; use --force to write this path anyway.)", Colors.DIM))
+ return "\n".join(lines)
diff --git a/hermes_cli/left_core_migration.py b/hermes_cli/left_core_migration.py
index 1daf8eb2a22..388708777f6 100644
--- a/hermes_cli/left_core_migration.py
+++ b/hermes_cli/left_core_migration.py
@@ -39,10 +39,11 @@ from hermes_cli.memory_provider_migration import (
logger = logging.getLogger(__name__)
-# ``terminal.*`` keys ``hermes config set`` also wrote to ``.env`` while core shipped their backend. The
-# plugin still reads that copy as a fallback, so ``hermes config unset`` keeps removing it: otherwise the
-# old value returns instead of the default.
-RETIRED_TERMINAL_ENV_COPIES = {"terminal.singularity_image": "TERMINAL_SINGULARITY_IMAGE"}
+# ``terminal.*`` keys a left-core plugin still reads -> the ``.env`` copy core's ``hermes config set`` also
+# wrote. Not in DEFAULT_CONFIG (a seeded default would hide the plugin's env fallback), so ``config
+# set/get`` recognise them here, and ``config unset`` removes that copy too: the plugin falls back to it,
+# and the old value would return instead of the default.
+LEFT_CORE_TERMINAL_KEYS = {"terminal.singularity_image": "TERMINAL_SINGULARITY_IMAGE"}
def _read_config(home: Path) -> dict:
diff --git a/tests/hermes_cli/test_left_core_singularity.py b/tests/hermes_cli/test_left_core_singularity.py
index c2c8c835e5f..457498c43ff 100644
--- a/tests/hermes_cli/test_left_core_singularity.py
+++ b/tests/hermes_cli/test_left_core_singularity.py
@@ -148,3 +148,16 @@ def test_config_unset_removes_the_env_copy_core_used_to_write(tmp_path, monkeypa
unset_config_value("terminal.singularity_image")
assert "singularity_image" not in (home / "config.yaml").read_text(encoding="utf-8")
assert "TERMINAL_SINGULARITY_IMAGE" not in (home / ".env").read_text(encoding="utf-8")
+
+
+def test_config_set_and_get_still_recognize_the_image_key(tmp_path, monkeypatch, capsys):
+ # The plugin reads terminal.singularity_image and its setup text says `hermes config set
+ # terminal.singularity_image <image>`; leaving DEFAULT_CONFIG must not make it an unknown key.
+ home = _home(tmp_path, config="terminal:\n backend: singularity\n")
+ monkeypatch.setenv("HERMES_HOME", str(home))
+ from hermes_cli.config import get_config_value, set_config_value
+ set_config_value("terminal.singularity_image", "docker://python:3.12")
+ get_config_value("terminal.singularity_image")
+ out = capsys.readouterr()
+ assert "docker://python:3.12" in out.out
+ assert "not a recognized config key" not in out.out + out.err