From 1dd3f9aad52c77a328b4da113e2eee2209a30793 Mon Sep 17 00:00:00 2001 From: hmo Date: Wed, 5 Aug 2026 09:57:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20watchdog=20revival=20=E2=80=94=20port=20?= =?UTF-8?q?5807=20in=20registry,=20skip=20remote/self-managed=20services,?= =?UTF-8?q?=20add=20to=20start.bat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - service_registry: xmpp_bot port 5802 -> 5807 (matches xmpp_agent_core), fix health_url/log - xmpp_watchdog: skip services without script or pid_file (dashboard self-managed, gateway_* remote) — previously crashed on open(None) - start.bat: launch watchdog after xxm bot so crash auto-recovery runs on boot --- deploy/windows/start.bat | 4 ++++ gateway/scripts/service_registry.py | 6 +++--- gateway/scripts/xmpp_watchdog.py | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/deploy/windows/start.bat b/deploy/windows/start.bat index 58d8804..ca34734 100644 --- a/deploy/windows/start.bat +++ b/deploy/windows/start.bat @@ -14,6 +14,10 @@ echo [2/3] xxm Bot... start /b "" /D "D:\F\NewI\opencode\daily-workspace\projects\AgentsMeeting" "C:\Users\hmo\AppData\Local\Programs\Python\Python310\python.exe" xmpp_agent_core.py --agent xxm timeout /t 10 /nobreak >nul +echo [2.5/3] Watchdog (auto-restart guard)... +start /b "" /D "D:\F\NewI\opencode\daily-workspace\projects\AgentsMeeting\gateway\scripts" "C:\Users\hmo\AppData\Local\Programs\Python\Python310\python.exe" xmpp_watchdog.py +timeout /t 3 /nobreak >nul + echo [3/3] EasyTier... curl -s -X POST http://127.0.0.1:5807/easytier -H "Content-Type: application/json" -H "X-Api-Key: xxm_bridge_8f3a2c" -d "{\"action\":\"start\"}" >nul diff --git a/gateway/scripts/service_registry.py b/gateway/scripts/service_registry.py index d2c0347..60c4504 100644 --- a/gateway/scripts/service_registry.py +++ b/gateway/scripts/service_registry.py @@ -18,11 +18,11 @@ SERVICES = [ "args": ["--agent", "xxm"], "workdir": BASE, "pid_file": os.path.join(TEMP, ".xmpp_bot.pid"), - "port": 5802, - "health_url": "http://127.0.0.1:5802/health", + "port": 5807, # xxm 的 HTTP bridge 已从 5802 迁移到 5807(见 xmpp_agent_core.py AGENTS.xxm.http_port) + "health_url": "http://127.0.0.1:5807/health", "accept_401": False, # /health 现在返回 200(免认证) "depends_on": [], - "log_files": lambda: [os.path.join(GATEWAY_DIR, "logs", "xmpp_bot.log"), + "log_files": lambda: [os.path.join(GATEWAY_DIR, "logs", "xmpp_xxm.log"), os.path.join(GATEWAY_DIR, "logs", "bridge.log")], "description": "XMPP Bot (xxm@yoin.fun)", }, diff --git a/gateway/scripts/xmpp_watchdog.py b/gateway/scripts/xmpp_watchdog.py index 6d9c53e..705369f 100644 --- a/gateway/scripts/xmpp_watchdog.py +++ b/gateway/scripts/xmpp_watchdog.py @@ -28,6 +28,13 @@ from service_registry import SERVICES as _SR SERVICES = {} for svc in _SR: name = svc["name"] + # watchdog 只管理「本机可拉起」的进程服务: + # - script 为 None → 远程服务(gateway_mohe/zhiwei),由 246 crontab/systemd 管 + # - pid_file 为 None → dashboard,自管进程 + # 否则 start_service 会 open(None) 崩溃,且无 pid_file 无法追踪。 + if not svc.get("script") or not svc.get("pid_file"): + print(f"[watchdog] skip {name}: remote/self-managed service", flush=True) + continue SERVICES[name] = { "script": svc["script"], "args": svc["args"],