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

The lazy _get_db() singleton followed get_hermes_home(), so a first touch
inside the multiplex cron ticker's per-profile override window permanently
bound the default backend to another profile's state.db (#102526).
This commit is contained in:
HexLab98
2026-09-04 08:09:58 +09:00
committed by Teknium
parent 3a350508f7
commit 3c3ca061a6

View File

@@ -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)