Skip to content

The agent that grows with you

fix(update): print each sibling profile's config-step notices

Tekniumbde104d2ff68
diff --git a/hermes_cli/update_cmd_config.py b/hermes_cli/update_cmd_config.py
index 27ced4041f4..bc0993ce41d 100644
--- a/hermes_cli/update_cmd_config.py
+++ b/hermes_cli/update_cmd_config.py
@@ -28,11 +28,13 @@ def _run_migrate_config_fresh(*, interactive: bool = False, quiet: bool = False)
stop_for_relaunch(incomplete=True)
-def _migrate_sibling_profile_configs() -> list[tuple[str, int, int]]:
+def _migrate_sibling_profile_configs(notes: dict[str, list[str]] | None = None) -> list[tuple[str, int, int]]:
"""Migrate every SIBLING profile's config.yaml (the shared checkout serves all profiles). Per
sibling (active skipped): scope via the context-local HERMES_HOME override (never ``os.environ``)
and run the NON-INTERACTIVE quiet migration — prompt-requiring settings wait for that profile's
- own session. Returns ``[(name, from_version, to_version), ...]``; never raises.
+ own session. Returns ``[(name, from_version, to_version), ...]``; never raises. *notes* receives
+ each migrated sibling's display lines for what quiet mode muted (a reset/removed setting, a
+ warning), as the active profile's quiet path re-prints them; the tuple shape stays for old updaters.
91277 Phase 2 (fleet-wide config migration; #20438/#54926/#79048): the shared checkout serves every
profile, but ``hermes update`` historically migrated only the active profile's config — siblings drifted
@@ -42,7 +44,7 @@ def _migrate_sibling_profile_configs() -> list[tuple[str, int, int]]:
``_get_default_hermes_home()``, not under ``profiles/``, so a named-profile
``hermes update`` still migrates it.
"""
- from hermes_cli.config import check_config_version, migrate_config
+ from hermes_cli.config import check_config_version, get_missing_config_fields, migrate_config
migrated: list[tuple[str, int, int]] = []
with _best_effort('Sibling profile enumeration failed: %s'):
from hermes_constants import (
@@ -57,10 +59,15 @@ def _migrate_sibling_profile_configs() -> list[tuple[str, int, int]]:
current_ver, latest_ver = check_config_version(raise_on_parse_error=True)
if current_ver >= latest_ver:
continue
- migrate_config(interactive=False, quiet=True)
+ results = migrate_config(interactive=False, quiet=True)
after_ver, _ = check_config_version(raise_on_parse_error=True)
if after_ver > current_ver:
migrated.append((name, current_ver, after_ver))
+ if notes is not None:
+ # config_added also lists the new default keys; those are not changes.
+ new_keys = {field["key"] for field in get_missing_config_fields()}
+ notes[name] = [f"ℹ {note}" for note in results["config_added"] if note not in new_keys]
+ notes[name] += [f"⚠️ {warning}" for warning in results["warnings"]]
except Exception as exc:
logger.debug("Config migration for profile %s failed: %s", name, exc)
finally:
@@ -243,8 +250,11 @@ def _check_and_apply_config_migration(
# The migration above touched only the active profile; run the same NON-INTERACTIVE
# migration per sibling home via the context-local HERMES_HOME override (never os.environ).
with _best_effort('Sibling config migration failed: %s'):
- for _name, _from_ver, _to_ver in _migrate_sibling_profile_configs():
+ sibling_notes: dict[str, list[str]] = {}
+ for _name, _from_ver, _to_ver in _migrate_sibling_profile_configs(sibling_notes):
print(f" ✓ Profile '{_name}': config format updated (v{_from_ver} → v{_to_ver})")
+ for _note in sibling_notes.get(_name, ()):
+ print(f" {_note}")
_restore_snapshot_safety_nets(pre_update_snapshot_id)
if owed_error is not None:
diff --git a/tests/hermes_cli/test_sibling_config_migration.py b/tests/hermes_cli/test_sibling_config_migration.py
index 2b01b671b08..de959cccd14 100644
--- a/tests/hermes_cli/test_sibling_config_migration.py
+++ b/tests/hermes_cli/test_sibling_config_migration.py
@@ -165,3 +165,28 @@ def test_default_active_still_migrates_named_siblings(monkeypatch, tmp_path):
on_disk = yaml.safe_load((sibling / "config.yaml").read_text())
assert on_disk["_config_version"] == _latest_version()
assert yaml.safe_load((default_home / "config.yaml").read_text())["_config_version"] == _latest_version()
+
+
+def test_sibling_step_notices_reach_the_update_output(monkeypatch, tmp_path, capsys):
+ """A sibling migrates quietly; what its steps changed (v52: `backend: off` gone, and how to turn
+ browsing off now) is printed under its profile line, as for the active profile. New default keys
+ are not changes and stay out."""
+ active = _write_profile(tmp_path / "profiles", "active", _latest_version())
+ work = tmp_path / "profiles" / "work"
+ work.mkdir(parents=True)
+ (work / "config.yaml").write_text("_config_version: 51\nbrowser:\n backend: off\n", encoding="utf-8")
+ _setup(monkeypatch, tmp_path, active)
+ monkeypatch.setenv("HERMES_HOME", str(active))
+ monkeypatch.setattr(update_cmd_config, "_restore_snapshot_safety_nets", lambda _sid: None)
+ monkeypatch.setattr("hermes_cli.config.get_missing_env_vars", lambda **_: [])
+ monkeypatch.setattr("hermes_cli.config.get_missing_config_fields", lambda: [{"key": "display.new_option"}])
+
+ update_cmd_config._check_and_apply_config_migration()
+
+ out = capsys.readouterr().out
+ profile_line = out.index("Profile 'work': config format updated (v51")
+ notice = out.index("removed browser.backend: off")
+ assert profile_line < notice
+ assert "`browser` toolset in `hermes tools`" in out[notice:]
+ assert "display.new_option" not in out[profile_line:]
+ assert "backend" not in (yaml.safe_load((work / "config.yaml").read_text()).get("browser") or {})