Skip to content

The agent that grows with you

fix(config): keep <section>.<extra_root> paths out of the wrong-prefix refusal

teknium15e16a57435fc
diff --git a/hermes_cli/config.py b/hermes_cli/config.py
index f7c11b45bf4..99c9a3e8cdc 100644
--- a/hermes_cli/config.py
+++ b/hermes_cli/config.py
@@ -3338,8 +3338,15 @@ def _validate_config_key(key: str) -> tuple[bool, Optional[str]]:
# Checked BEFORE the fuzzy sibling: a structural match is proof, a fuzzy match is a
# guess, and ``agent.gateway.strict`` must be refused as ``gateway.strict`` rather
# than written with a misleading ``agent.gateway_timeout`` did-you-mean.
+ # Only DEFAULT_CONFIG / open-subkey roots qualify as the stripped prefix:
+ # ``_EXTRA_KNOWN_ROOT_KEYS`` also holds the top-level FORMS of nested gateway
+ # settings (``filter_silence_narration``, ``reset_triggers``, ...), and
+ # ``gateway.filter_silence_narration`` is a runtime-read path, not a wrong prefix.
rest = ".".join(segments[len(consumed):])
- if _split_key_path(rest)[0] in _known_top_level_keys() and _validate_config_key(rest)[0]:
+ if (
+ _split_key_path(rest)[0] in set(DEFAULT_CONFIG) | _OPEN_SUBKEY_TOP_LEVEL_KEYS
+ and _validate_config_key(rest)[0]
+ ):
return False, rest
sibling = _suggest_closest_key(seg, set(node.keys()))
if sibling is not None:
diff --git a/tests/hermes_cli/test_set_config_value.py b/tests/hermes_cli/test_set_config_value.py
index 91b79cecebf..be35e04ba30 100644
--- a/tests/hermes_cli/test_set_config_value.py
+++ b/tests/hermes_cli/test_set_config_value.py
@@ -542,6 +542,10 @@ class TestSchemaValidation:
# from an unseeded key, so it is written too — the user gets the sibling suggestion
# (``agent.max_turns``) instead of a refusal.
("agent.max_turnz", "50", 50, "agent.max_turns"),
+ # ``filter_silence_narration`` is an _EXTRA_KNOWN_ROOT_KEYS top-level form of a nested
+ # gateway setting (gateway/config_loader.py bridge). Its presence in the known roots
+ # must not turn the nested path into a wrong-prefix refusal.
+ ("gateway.filter_silence_narration", "false", False, None),
])
def test_unknown_leaf_under_known_section_is_written_with_notice(
self, key, value, expected, suggestion, _isolated_hermes_home, capsys
@@ -613,7 +617,6 @@ class TestValidateConfigKey:
# but absent from DEFAULT_CONFIG; they used to trip the false "not a recognized config
# key" notice with a bogus near-miss suggestion (platform_hints.cli).
"platform_toolsets.cli",
- "smart_model_routing.enabled",
])
def test_known_keys_pass(self, key):
from hermes_cli.config import _validate_config_key