Skip to content

The agent that grows with you

fix(profiles): a stored <root>/profiles/<name> home names its profile even when the root carries no markers

kshitijk4poorc402bcf1d8d6
diff --git a/hermes_constants.py b/hermes_constants.py
index 21dda94ba5f..96d83312441 100644
--- a/hermes_constants.py
+++ b/hermes_constants.py
@@ -223,6 +223,10 @@ def profile_name_for_home(path: str | Path | None) -> str | None:
named = named_profile_home(candidate)
if named is not None:
return named.name
+ # A stored profile home is authoritative: its owner already resolved it, so the
+ # <root>/profiles/<name> shape names the profile even when <root> carries no markers.
+ if candidate.parent.name == "profiles" and not candidate.name.startswith("."):
+ return candidate.name
except (OSError, RuntimeError, ValueError):
return None
return None