From 9970886156edb9bdc66ec7420604e3c9bafb45a0 Mon Sep 17 00:00:00 2001 From: xxm Date: Mon, 24 Aug 2026 09:13:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8D=AB=E7=94=9F=E5=AE=A1=E8=AE=A1?= =?UTF-8?q?=E4=B8=89=E5=A4=84=E8=AF=AF=E6=8A=A5=E2=80=94=E2=80=94=E6=8C=87?= =?UTF-8?q?=E4=BB=A4=E5=86=BB=E7=BB=93=E6=B4=BB=E8=B7=83=E5=BA=A6=E5=88=97?= =?UTF-8?q?=E5=90=8Dcreated=5Fat=E2=86=92timestamp(=E6=AD=BBsession?= =?UTF-8?q?=E8=AF=AF=E6=8A=A58=E4=B8=AA),=E8=BF=9B=E7=A8=8B=E7=99=BD?= =?UTF-8?q?=E5=90=8D=E5=8D=95+ocg=5Frouter/guard=5Fmonitor,stale=5Ftable?= =?UTF-8?q?=E9=9D=9E=E4=BA=A4=E6=98=93=E9=98=88=E5=80=BC48=E2=86=9272h?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E5=91=A8=E6=9C=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/system_hygiene_audit.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deploy/profile-scripts/system_hygiene_audit.py b/deploy/profile-scripts/system_hygiene_audit.py index d3a28d5d..9f8b94ec 100644 --- a/deploy/profile-scripts/system_hygiene_audit.py +++ b/deploy/profile-scripts/system_hygiene_audit.py @@ -51,6 +51,8 @@ PROCESS_WHITELIST = [ 'wechat_webhook.py', 'qq-poll', 'afw', 'mcp_server', 'uvicorn', 'agentmemory', 'kimi_collect', 'mohe_knowledge_relay', 'wechat_watchdog', 'todo_scanner', 'miner.py', + 'ocg_router.py', # 2026-08-24 OCG Router(:19878) 知微LLM命脉,合法常驻 + 'mofin_guard_monitor.py', # 2026-08-24 知微消息合规监控,设计常驻(已systemd纳管) ] CORE_TABLES = [ @@ -328,7 +330,7 @@ def check_stale_sessions(): try: conn2 = _sq.connect(f"file:{state_db}?mode=ro", uri=True, timeout=10) last_msg = conn2.execute( - "SELECT MAX(created_at) FROM messages WHERE session_id=?", + "SELECT MAX(timestamp) FROM messages WHERE session_id=?", (r['id'],)).fetchone()[0] conn2.close() lm = last_msg or 0 @@ -354,13 +356,15 @@ def check_db_freshness(): c = sqlite3.connect(os.path.join(DATA_DIR, 'mofin.db'), timeout=10) now = datetime.now() is_trading_time = now.weekday() < 5 and 9 <= now.hour <= 16 + # 2026-08-24 周末豁免:非交易阈值需覆盖周末休市(周五17:00→周一09:30≈64.5h), + # 48h 导致周一早上必误报;真停滞会在下一交易时段被 4h 阈值抓住,不会漏 for table, col, label in CORE_TABLES: try: row = c.execute(f"SELECT MAX({col}) FROM {table}").fetchone() if row and row[0]: last = datetime.fromisoformat(str(row[0]).replace('Z', '')) age_h = (now - last).total_seconds() / 3600 - threshold = 4 if is_trading_time else 48 + threshold = 4 if is_trading_time else 72 # 72h覆盖周末(2026-08-24) if age_h > threshold: issues.append({ 'type': 'stale_table', 'table': table, 'label': label,