--- scripts/watcher.py 2026-10-05 15:36:41.277744391 +0000 +++ scripts/watcher.py 2026-10-05 15:36:41.277744391 +0000 @@ -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" RECALL_BASE = 2147483647 # 固定起始數字(owner 2026-10-04 14:58 HKT:每次推減1,重啟重置) _recall_counter = RECALL_BASE # 內存計數器,重啟 watcher 即重置 @@ -72,7 +73,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] = { @@ -1401,11 +1402,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