From 3c3ca061a6893afbff94efec66b67e97845eee29 Mon Sep 17 00:00:00 2001 From: HexLab98 Date: Fri, 4 Sep 2026 08:09:58 +0900 Subject: [PATCH] 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). --- tui_gateway/server.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tui_gateway/server.py b/tui_gateway/server.py index a218deef08..32e589dbd9 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)