Skip to content

The agent that grows with you

fix(desktop): pin launch SessionDB handle to the launch home

HexLab983c3ca061a689
diff --git a/tui_gateway/server.py b/tui_gateway/server.py
index a218deef082..32e589dbd9c 100644
--- a/tui_gateway/server.py
+++ b/tui_gateway/server.py
@@ -385,7 +385,11 @@ def _get_db():
if _db is None:
from hermes_state_registry import acquire
try:
- _db, _db_error = acquire(), None
+ # Pin to import-time launch home (#102526). A bare acquire() follows
+ # get_hermes_home(), which the desktop multiplex cron ticker temporarily
+ # overrides per profile at startup — first touch inside a foreign window
+ # permanently binds this process-wide handle to the wrong state.db.
+ _db, _db_error = acquire(Path(_hermes_home) / "state.db"), None
except Exception as exc:
_db_error = str(exc)
logger.warning("TUI session store unavailable — continuing without state.db features: %s", exc)