fix(cli): release SessionDB handles when deleting a profile

delete_profile already force-closes holographic memory_store.db in this
process, but the shared SessionDB registry kept state.db open. Recreate
then failed with a replaced/locked database. Close every shared handle
under the doomed directory, same contract as MemoryStore.release_all_under.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Sora-bluesky
2026-09-10 06:27:54 +09:00
committed by Teknium
parent d956e05e5e
commit f1ee8e0f39
4 changed files with 118 additions and 20 deletions
+5
View File
@@ -1184,6 +1184,11 @@ def delete_profile(name: str, yes: bool = False) -> Path:
_released = _MemoryStore.release_all_under(profile_dir)
if _released:
print(f"✓ Released {_released} memory-store connection(s) held by this process")
with contextlib.suppress(Exception):
from hermes_state_registry import close_all_under as _close_session_dbs_under
_closed = _close_session_dbs_under(profile_dir)
if _closed:
print(f"✓ Released {_closed} session database connection(s) held by this process")
# 3. Remove wrapper script
if has_wrapper and remove_wrapper_script(canon):