The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(config): a skipped migration step is logged on the quiet auto-migrate path
teknium1290a99aac34b
diff --git a/hermes_cli/config_migrations.py b/hermes_cli/config_migrations.pyindex e0e663bfc35..de1d2caae9d 100644--- a/hermes_cli/config_migrations.py+++ b/hermes_cli/config_migrations.py@@ -9,10 +9,13 @@ from __future__ import annotationsimport copyimport functools+import loggingimport refrom typing import Any, Callable, Dict, List, Optional, Tuplefrom urllib.parse import urlparse+logger = logging.getLogger(__name__)+#: Auto-migration support floor. Configs whose on-disk ``_config_version`` is below this are NOT#: auto-migrated (v12 predates ~two years of releases; carrying the sub-v12 steps and the env#: bridges they consumed forever is not worth it). Below-floor configs are left byte-for-byte@@ -740,5 +743,9 @@ def run_migrations(current_ver: int, results: Dict[str, Any], quiet: bool) -> No# ladder (config loading itself fails otherwise). Loud, not silent.warning = f"config migration to v{target_ver} failed and was skipped: {exc}"results.setdefault("warnings", []).append(warning)+ # Quiet callers (profile creation, unattended update) discard ``results`` and+ # migrate_config still stamps the latest version, so without a log line the+ # skipped step vanishes for good.+ logger.warning("%s", warning)if not quiet:print(f" ⚠ {warning}")diff --git a/tests/hermes_cli/test_config_migration_nested_guards.py b/tests/hermes_cli/test_config_migration_nested_guards.pyindex b5c98a90861..ac52aaff06c 100644--- a/tests/hermes_cli/test_config_migration_nested_guards.py+++ b/tests/hermes_cli/test_config_migration_nested_guards.py@@ -6,6 +6,7 @@ a step that still raises so one bad value cannot wedge ``hermes config migrate````hermes update`` and leave the config unversioned."""+import loggingimport osfrom unittest.mock import patch@@ -61,9 +62,11 @@ def test_malformed_nested_value_is_migrated_not_crashed(tmp_path, current_ver, cassert not results["warnings"], "a guarded shape must migrate cleanly, not be skipped"-def test_failing_step_is_skipped_with_warning_and_config_still_migrates(tmp_path):+def test_failing_step_is_skipped_with_warning_and_config_still_migrates(tmp_path, caplog):"""``migrate_config`` (the ``hermes config migrate`` / ``hermes update`` path) keeps going- past a raising step, records the skip in ``warnings`` and stamps the latest version."""+ past a raising step, records the skip in ``warnings`` and stamps the latest version. The+ quiet path (profile creation, unattended update) discards ``results``, so the skip must+ also reach the log or it is silent and, once stamped, permanent."""from hermes_cli import config_migrationsfrom hermes_cli.config import migrate_config@@ -73,8 +76,11 @@ def test_failing_step_is_skipped_with_warning_and_config_still_migrates(tmp_path_write_config(tmp_path, {"_config_version": 12, "model": {"default": "x/y"}})ladder = tuple((v, _boom if v == 13 else fn) for v, fn in config_migrations.MIGRATIONS)with patch.dict(os.environ, {"HERMES_HOME": str(tmp_path)}), \- patch.object(config_migrations, "MIGRATIONS", ladder):+ patch.object(config_migrations, "MIGRATIONS", ladder), \+ caplog.at_level(logging.WARNING, logger="hermes_cli.config_migrations"):results = migrate_config(interactive=False, quiet=True)assert any(w.startswith("config migration to v13 failed and was skipped") for w in results["warnings"])assert _read_config(tmp_path)["_config_version"] == config_migrations.MIGRATIONS[-1][0]+ assert any("config migration to v13 failed and was skipped" in r.getMessage()+ and r.levelno == logging.WARNING for r in caplog.records)