Skip to content

The agent that grows with you

fix(config): route the config.yaml readers main added since the last rebase

Teknium4b25b27c8fd2
diff --git a/hermes_cli/config_version_stamp.py b/hermes_cli/config_version_stamp.py
index df82d834121..f33fde044f2 100644
--- a/hermes_cli/config_version_stamp.py
+++ b/hermes_cli/config_version_stamp.py
@@ -100,8 +100,9 @@ def stamp_missing_config() -> bool:
first stamp (:func:`note_first_stamp`) now, before callers trust that shortcut, or the browser those
settings chose is lost. A home without them stays without a config.yaml. Returns whether one was written."""
from hermes_cli.config import _secure_file, atomic_config_write, get_config_path, is_managed
+ from hermes_cli.config_backend import config_exists
path = get_config_path()
- if path.exists() or is_managed():
+ if config_exists(path) or is_managed():
return False
config = {"_config_version": _coerce_config_version(DEFAULT_CONFIG.get("_config_version", 1)) or 1}
if not note_first_stamp(path.parent, {}, config):
diff --git a/hermes_cli/left_core_migration.py b/hermes_cli/left_core_migration.py
index df5b886c4a1..096dbcdc3c9 100644
--- a/hermes_cli/left_core_migration.py
+++ b/hermes_cli/left_core_migration.py
@@ -521,9 +521,10 @@ def _record_migration(home: Path, feature: LeftCoreFeature) -> None:
under ``_left_core_scoped`` so a later run never undoes a choice the user made since
(``hermes tools``). Raises when config.yaml cannot be read or written."""
from hermes_cli.config import atomic_config_write, read_user_config_raw
+ from hermes_cli.config_backend import config_exists
from hermes_cli.toolset_validation import parse_platform_toolsets_value
path = home / "config.yaml"
- created = not path.exists()
+ created = not config_exists(path)
config = read_user_config_raw(path)
installed = plugin_present(feature.plugin, home) and not _marked(config, _INSTALLED_KEY, feature)
if _scope_kept(config, feature) and not installed:
diff --git a/hermes_cli/prune_advisor.py b/hermes_cli/prune_advisor.py
index 78ebfc02614..0433966dc61 100644
--- a/hermes_cli/prune_advisor.py
+++ b/hermes_cli/prune_advisor.py
@@ -346,14 +346,14 @@ def decide(enable: bool, home: Optional[Path] = None) -> bool:
"""Persist the user's answer as an explicit ``sessions.auto_prune``; ends the prompt for good.
False when the save failed or did not take effect (an administrator-managed value wins)."""
import hermes_yaml as yaml
+ from hermes_cli.config_backend import write_config_key
from hermes_constants import mkdir_under_hermes_home
- from utils import atomic_roundtrip_yaml_update
if managed():
return False
path = _home(home) / "config.yaml"
try:
mkdir_under_hermes_home(path.parent)
- atomic_roundtrip_yaml_update(path, "sessions.auto_prune", bool(enable))
+ write_config_key(path, "sessions.auto_prune", bool(enable))
except (OSError, ValueError, yaml.YAMLError) as exc:
logger.warning("Could not save sessions.auto_prune: %s", exc)
return False
diff --git a/hermes_cli/setup_agent_import.py b/hermes_cli/setup_agent_import.py
index 55006eecea2..a431cce0ae2 100644
--- a/hermes_cli/setup_agent_import.py
+++ b/hermes_cli/setup_agent_import.py
@@ -119,7 +119,7 @@ def _ensure_plugin(hermes_home: Path) -> bool:
def _snapshot(hermes_home: Path) -> tuple[Optional[bytes], ...]:
- return tuple(p.read_bytes() if p.is_file() else None
+ return tuple(p.read_bytes() if p.is_file() else None # config-reader: ok — child-run change snapshot
for p in (hermes_home / "config.yaml", hermes_home / ".env"))