fix: route stray HERMES_HOME hardcodes through get_hermes_home() (profile + native-Windows safety)

This commit is contained in:
teknium1
2026-07-29 08:57:48 -07:00
committed by Teknium
parent b8ceba97ed
commit 19055492aa
12 changed files with 50 additions and 58 deletions
+9 -17
View File
@@ -62,11 +62,9 @@ except ImportError:
def _get_sessions_dir() -> Path:
"""Return the sessions directory using HERMES_HOME."""
try:
from hermes_constants import get_hermes_home
return get_hermes_home() / "sessions"
except ImportError:
return Path(os.environ.get("HERMES_HOME", Path.home() / ".hermes")) / "sessions"
from hermes_constants import get_hermes_home
return get_hermes_home() / "sessions"
def _get_session_db():
@@ -194,13 +192,9 @@ def _load_sessions_index_from_json() -> dict:
def _load_channel_directory() -> dict:
"""Load the cached channel directory for available targets."""
try:
from hermes_constants import get_hermes_home
directory_file = get_hermes_home() / "channel_directory.json"
except ImportError:
directory_file = Path(
os.environ.get("HERMES_HOME", Path.home() / ".hermes")
) / "channel_directory.json"
from hermes_constants import get_hermes_home
directory_file = get_hermes_home() / "channel_directory.json"
if not directory_file.exists():
return {}
@@ -450,11 +444,9 @@ class EventBridge:
eliminating the old dual-file (sessions.json + state.db) race that
could drop brand-new conversations (#8925).
"""
try:
from hermes_constants import get_hermes_home
db_file = get_hermes_home() / "state.db"
except ImportError:
db_file = Path(os.environ.get("HERMES_HOME", Path.home() / ".hermes")) / "state.db"
from hermes_constants import get_hermes_home
db_file = get_hermes_home() / "state.db"
try:
db_mtime = db_file.stat().st_mtime if db_file.exists() else 0.0