The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(config): keep the notice for padded MoA preset names; move the path rule into moa_config
kshitijk4poor0217c5f6bbff
diff --git a/hermes_cli/config.py b/hermes_cli/config.pyindex dbb059565a4..843101087cf 100644--- a/hermes_cli/config.py+++ b/hermes_cli/config.py@@ -2963,13 +2963,13 @@ def _suggest_closest_key(key: str, candidates: set[str], cutoff: float = 0.6) ->def _validate_config_key(key: str) -> tuple[bool, Optional[str]]:- """Dotted config-key path -> ``(is_known, suggestion)``: the schema walk, then (only for a refused key)- the runtime-read keys DEFAULT_CONFIG leaves unseeded (config_runtime_keys)."""+ """CLI-syntax key (``\\.`` escapes a dot) -> ``(is_known, suggestion)``: the schema walk, then (only for a+ refused key) the runtime-read keys DEFAULT_CONFIG leaves unseeded (config_runtime_keys)."""known, suggestion = _validate_schema_key(key)if known or not key:return known, suggestionfrom hermes_cli.config_runtime_keys import is_runtime_read_key- return (True, None) if is_runtime_read_key(key) else (False, suggestion)+ return (True, None) if is_runtime_read_key(_split_key_path(key)) else (False, suggestion)def _validate_schema_key(key: str) -> tuple[bool, Optional[str]]:diff --git a/hermes_cli/config_runtime_keys.py b/hermes_cli/config_runtime_keys.pyindex a3eac191d0b..5ce7ebd63b6 100644--- a/hermes_cli/config_runtime_keys.py+++ b/hermes_cli/config_runtime_keys.py@@ -7,8 +7,8 @@ Four owners supply them:* Core selection keys (``browser.cloud_provider``, ``<category>.use_gateway``, ``stt.provider``)::func:`tools.tool_backend_helpers.selection_config_keys`, built from ``read_selection``'s tables.* Core-owned unseeded keys outside that table, each listed with its reader (:data:`CORE_RUNTIME_KEYS`).-* MoA preset fields: the normalizer's own field list, under any preset name. Only exact fields- qualify, not arbitrary descendants of ``moa.presets``.+* MoA preset fields under any preset name (:func:`hermes_cli.moa_config.is_preset_field_path`). Only a+ preset's own fields qualify, not arbitrary descendants of ``moa.presets``.* ACTIVE plugins: a ``config_keys`` list in ``plugin.yaml`` (or ``extensions.com.nousresearch.hermes``in a portable ``plugin.json``) names core-section paths the plugin's code reads, e.g.``memory.retaindb``. Plugins are found and gated by the loader's own discovery@@ -102,17 +102,18 @@ def plugin_declared_config_keys() -> frozenset[str]:return frozenset(keys)-def is_runtime_read_key(key: str) -> bool:- """Recognize runtime-owned paths after the schema refuses them, retaining escaped dots in names."""- from hermes_cli.config import _split_key_path- from hermes_cli.moa_config import _FLAT_PRESET_KEYS+def is_runtime_read_key(parts: list[str]) -> bool:+ """True when the split key ``parts`` is a MoA preset field, a core selection key, a core runtime key,+ or sits at/under a path an active plugin declares. Call only for a key the schema walk refused.++ The MoA rule needs the segments (a preset name may contain a dot); the other owners match the+ dotted join."""+ from hermes_cli.moa_config import is_preset_field_pathfrom tools.tool_backend_helpers import selection_config_keys- parts = _split_key_path(key)- if (len(parts) == 4 and parts[:2] == ["moa", "presets"]- and parts[2].strip() and parts[3] in _FLAT_PRESET_KEYS):+ if is_preset_field_path(parts):return True- key = ".".join(parts)- if key in selection_config_keys() or _covered(key, CORE_RUNTIME_KEYS):+ dotted = ".".join(parts)+ if dotted in selection_config_keys() or _covered(dotted, CORE_RUNTIME_KEYS):return True- return _covered(key, plugin_declared_config_keys())+ return _covered(dotted, plugin_declared_config_keys())diff --git a/hermes_cli/moa_config.py b/hermes_cli/moa_config.pyindex d0a2b44dd39..d9266a44056 100644--- a/hermes_cli/moa_config.py+++ b/hermes_cli/moa_config.py@@ -238,6 +238,17 @@ _FLAT_PRESET_KEYS = ("fanout", "enabled")+def is_preset_field_path(parts: list[str]) -> bool:+ """True for a split ``moa.presets.<name>.<field>`` path whose field ``_normalize_preset`` reads.++ ``<name>`` may be anything except blank or whitespace-padded: :func:`normalize_moa_config` strips+ names, so a ``" review "`` entry would silently replace the ``review`` preset. Such a path is+ not a field path and keeps the unknown-key notice.+ """+ return (len(parts) == 4 and parts[:2] == ["moa", "presets"]+ and bool(parts[2]) and parts[2] == parts[2].strip() and parts[3] in _FLAT_PRESET_KEYS)++# When the reference fan-out runs. "user_turn" (default) runs the advisors ONCE per user turn (the original# MoA shape, and the cheapest cadence — #67199): the aggregator gets their upfront plan-level advice, then# acts alone for the rest of the tool loop. "per_iteration" re-runs the advisors whenever the advisory viewdiff --git a/tests/hermes_cli/test_config_runtime_keys.py b/tests/hermes_cli/test_config_runtime_keys.pyindex 1693c8b4ec0..3cfe5ba5554 100644--- a/tests/hermes_cli/test_config_runtime_keys.py+++ b/tests/hermes_cli/test_config_runtime_keys.py@@ -92,6 +92,9 @@ def test_moa_preset_fields_set_and_get_without_notice(name, hermes_home, capsys)pytest.param(r"moa.presets.review\.v2.fanoutt", id="field-typo-escaped-name"),pytest.param("moa.presets.review.unexpected.fanout", id="extra-segment-before-field"),pytest.param("moa.presets.review.fanout.unexpected", id="extra-segment-after-field"),+ # The normalizer strips names, so this entry would replace the ``review`` preset.+ pytest.param("moa.presets. review .fanout", id="space-padded-name"),+ pytest.param("moa.presets.review", id="whole-preset"),])def test_moa_non_field_paths_still_notice(key, hermes_home, monkeypatch, capsys):# Only the schema walk and the MoA rule decide these keys; skip the plugin scan they would fall through to.