From e648d7d22aec57f06f68e6518b9372a730315703 Mon Sep 17 00:00:00 2001 From: Blasius Patrick Date: Mon, 20 Jul 2026 17:20:49 +0700 Subject: [PATCH] fix: prevent duplicate WSS auto-start from dual plugin installs Adds module-level _auto_start_done flag. When the plugin is installed in both global and profile directories, only the first register() call attempts to start the WSS server. The second logs and returns. Signed-off-by: Blasius Patrick --- __init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/__init__.py b/__init__.py index 2f4a6f2..417d5e3 100644 --- a/__init__.py +++ b/__init__.py @@ -11,6 +11,11 @@ __version__ = "0.1.0" +# Module-level guard: prevent duplicate WSS auto-start when the plugin is +# installed in multiple locations (e.g. global + profile). The first +# ``register()`` that runs sets this True; subsequent calls no-op. +_auto_start_done = False + def register(ctx) -> None: """Hermes plugin entry point. @@ -165,6 +170,12 @@ def _log(msg: str) -> None: except Exception: pass + global _auto_start_done + if _auto_start_done: + _log("auto-start already handled by another registration, skipping") + return + _auto_start_done = True + _log("auto-start check running") if os.environ.get("HERMES_NODES_AUTO_START", "1") == "1":