Skip to content

The agent that grows with you

fix(profiles): log the tolerated failure when a rename cannot record its previous name

teknium1680dd93b2621
diff --git a/hermes_cli/profiles.py b/hermes_cli/profiles.py
index 32ed22a11c4..3f42e7be318 100644
--- a/hermes_cli/profiles.py
+++ b/hermes_cli/profiles.py
@@ -1987,14 +1987,17 @@ def _migrate_honcho_profile_host(old_name: str, new_name: str, new_dir: Path) ->
def _record_profile_rename(new_dir: Path, old_canon: str) -> None:
"""Append ``old_canon`` to the renamed profile's ``previous_names`` history.
- Best-effort: never raises, so a metadata write failure cannot fail the rename."""
+ Best-effort: never raises, so a metadata write failure cannot fail the rename.
+
+ Only reached for a real slug change — ``rename_profile`` returns early for the
+ default profile (display-name only) and refuses ``old == new`` (target exists)."""
try:
history = read_profile_meta(new_dir).get("previous_names") or []
if old_canon not in history:
history = [*history, old_canon]
write_profile_meta(new_dir, previous_names=history)
- except Exception:
- pass
+ except Exception as exc: # unwritable / corrupt profile.yaml — history is advisory
+ logger.debug("profile rename: could not record previous name %r in %s: %s", old_canon, new_dir, exc)
def rename_profile(old_name: str, new_name: str) -> Path: