--- scripts/watcher.py +++ scripts/watcher.py @@ -49,6 +49,7 @@ BLUE_CLICK_Y = 425 MASTER_PROFILES_DIR = SYSTEM_DIR / "profiles" # 只讀 master LOGS_DIR = SYSTEM_DIR / "logs" +LOGS_DIR.mkdir(parents=True, exist_ok=True) # kit fix v1: 唔經 start-all.sh 起都唔會「第一個 log 就 crash」 RECALL_MSG = "Continue SESSION 2147483647" CHECK_INTERVAL = 30 # 秒 @@ -60,7 +61,7 @@ if not line or line.startswith("#"): continue parts = line.split() - if len(parts) >= 6: + if len(parts) >= 5: # kit fix v1: 5 欄都收(原本 >=6 會靜默掉行) sid, profile, vpn, url, account = parts[0], parts[1], parts[2], parts[3], parts[4] status = parts[5] if len(parts) > 5 else "active" seats[sid] = { @@ -1388,11 +1389,14 @@ } ts = int(_t.time()) # 經 SSH 寫去 server bus(host inbox) - _sp.run([ + _r = _sp.run([ "/home/hatch/workspace/ssh-newserver.sh", f"cat > /root/muse-mesh/inbox/host/{ts}-watcher-{sid.lower()}.json && chmod 600 /root/muse-mesh/inbox/host/{ts}-watcher-{sid.lower()}.json" ], input=_json.dumps(msg).encode(), timeout=30, capture_output=True) - log(sid, "已寫 bus 訊息去 server:conversation_too_long(host 會掃到)") + if _r.returncode != 0: + log(sid, f"⚠️ bus 寫入失敗 rc={_r.returncode}:{( _r.stderr or b'')[:200]!r}(人手要知)") + else: + log(sid, "已寫 bus 訊息去 server:conversation_too_long(host 會掃到)") except Exception as e: log(sid, f"寫 bus 訊息出錯: {e}") # 停呢個 watcher,等 Muse AI 開新 URL