Skip to content

The agent that grows with you

refactor(serve): name the Desktop backend lock file once

kshitijk4poorc044b80d865b
diff --git a/hermes_cli/dashboard_procs.py b/hermes_cli/dashboard_procs.py
index fe08440178b..4eacbab780c 100644
--- a/hermes_cli/dashboard_procs.py
+++ b/hermes_cli/dashboard_procs.py
@@ -829,6 +829,7 @@ def _process_ppid(pid: int) -> int | None:
_LOCKFILE_SCHEMA_VERSION = 2
_PROTOCOL_VERSION = 1
_REMOTE_LOCK_SUBDIR = "desktop-ssh"
+BACKEND_LOCK_NAME = "backend.lock.json"
_HEX32 = set("0123456789abcdef")
@@ -894,7 +895,7 @@ def _lock_owned_serve_pids(base_dir: Path | None = None) -> set[int]:
except OSError:
continue
for entry in entries:
- lock = read_valid_backend_lock(entry / "backend.lock.json")
+ lock = read_valid_backend_lock(entry / BACKEND_LOCK_NAME)
if lock is not None:
owned.add(lock["pid"]) # validated as int
return owned
diff --git a/hermes_cli/main.py b/hermes_cli/main.py
index c106809785c..6e2d6269307 100644
--- a/hermes_cli/main.py
+++ b/hermes_cli/main.py
@@ -2814,6 +2814,7 @@ def cmd_dashboard(args):
_ssh_session_token = _read_ssh_session_token_file(_token_file) if _token_file else None
_mcp_discovery_after_bind = _dashboard_prepare_runtime(args, _headless_backend)
+ from hermes_cli.dashboard_procs import BACKEND_LOCK_NAME
from hermes_cli.web_server import start_server
# Interactive auth setup: if this bind will engage the auth gate but no
@@ -2840,7 +2841,7 @@ def cmd_dashboard(args):
ssh_owner_nonce=_ssh_owner_nonce,
start_mcp_discovery_after_bind=_mcp_discovery_after_bind,
# The validated token file lives in desktop-ssh/<ownershipId>/, next to the Desktop's lock.
- ssh_lock_path=Path(_token_file).parent / "backend.lock.json" if _token_file else None,
+ ssh_lock_path=Path(_token_file).parent / BACKEND_LOCK_NAME if _token_file else None,
)