Files
hermes-agent/tui_gateway
Teknium e7136f1694 fix(tui_gateway): profile sessions never read or write through the launch store
Three wrong-store paths in the TUI/Desktop backend under multiplexing:

- insights.get was scoped=True and then called _get_db(): before the launch
  handle was pinned (#102526, #108074) a scoped first touch bound the
  process-wide handle to the requested profile's state.db; even pinned, the
  RPC answered for the launch profile whatever `profile` said. Route it
  through _profile_db so it counts the requested profile's sessions.

- prompt.background side agents were handed the launch handle, so a
  named-profile Bot Chat's bg_* rows appeared in the default profile's
  session list and were missing from the profile's own history. Inherit the
  parent agent's dedicated _session_db.

- session_lifecycle's gateway-owned-source guard and the notification
  poller's compression-tip resolver looked the session up in the launch
  store, where a named-profile row does not exist: the guard was dead and
  a compression-rotated profile session lost every post-compression
  delegation/background completion (the fail-closed owner gate never
  matched the compressed parent's key). Both now use the session's own
  store via _session_db(session).

Addresses #102157, #102526.
2026-09-11 15:26:09 -07:00
..