diff --git a/hermes_cli/banner.py b/hermes_cli/banner.py index c8446f04d9c..1cfb0d51f76 100644 --- a/hermes_cli/banner.py +++ b/hermes_cli/banner.py @@ -206,9 +206,12 @@ def check_for_updates() -> Optional[int]: if embedded_rev: behind = _check_via_rev(embedded_rev) else: - repo_dir = hermes_home / "hermes-agent" + # Prefer the running code's location over the profile-scoped path. + # $HERMES_HOME/hermes-agent/ may be a stale copy from --clone-all; + # Path(__file__) always resolves to the actual installed checkout. + repo_dir = Path(__file__).parent.parent.resolve() if not (repo_dir / ".git").exists(): - repo_dir = Path(__file__).parent.parent.resolve() + repo_dir = hermes_home / "hermes-agent" if not (repo_dir / ".git").exists(): return None behind = _check_via_local_git(repo_dir) @@ -222,11 +225,16 @@ def check_for_updates() -> Optional[int]: def _resolve_repo_dir() -> Optional[Path]: - """Return the active Hermes git checkout, or None if this isn't a git install.""" - hermes_home = get_hermes_home() - repo_dir = hermes_home / "hermes-agent" + """Return the active Hermes git checkout, or None if this isn't a git install. + + Prefers the running code's location over the profile-scoped path + because ``$HERMES_HOME/hermes-agent/`` may be a stale copy carried + over by ``--clone-all``. + """ + repo_dir = Path(__file__).parent.parent.resolve() if not (repo_dir / ".git").exists(): - repo_dir = Path(__file__).parent.parent.resolve() + hermes_home = get_hermes_home() + repo_dir = hermes_home / "hermes-agent" return repo_dir if (repo_dir / ".git").exists() else None