From eb2f34d2e450de6f3d999d22633af42cef7e4b1d Mon Sep 17 00:00:00 2001 From: luomeng119 <18701608563@163.com> Date: Sun, 8 Mar 2026 14:10:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20kanban=5Fupdate.py=20=E7=9B=B8=E5=AF=B9?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=AF=BC=E8=87=B4=E5=A4=9A=20Agent=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=A4=E5=B2=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sync_scripts_to_workspaces() 将脚本物理复制到各 workspace 后, kanban_update.py 的 __file__ 相对路径指向 workspace 私有目录, 导致 11 个 Agent 各自写入孤岛数据,中央看板断连。 修复:优先读取 EDICT_HOME 环境变量定位中央仓库, run_loop.sh 启动时自动 export EDICT_HOME,向后兼容。 --- scripts/kanban_update.py | 4 +++- scripts/run_loop.sh | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/kanban_update.py b/scripts/kanban_update.py index 0566cac..cd6ed22 100644 --- a/scripts/kanban_update.py +++ b/scripts/kanban_update.py @@ -24,7 +24,9 @@ """ import json, pathlib, datetime, sys, subprocess, logging, os, re -_BASE = pathlib.Path(__file__).resolve().parent.parent +# 优先使用环境变量 EDICT_HOME,兜底才用脚本相对路径 +# 这样脚本被 sync 到各 workspace 后仍能正确写入中央数据库 +_BASE = pathlib.Path(os.environ['EDICT_HOME']) if 'EDICT_HOME' in os.environ else pathlib.Path(__file__).resolve().parent.parent TASKS_FILE = _BASE / 'data' / 'tasks_source.json' REFRESH_SCRIPT = _BASE / 'scripts' / 'refresh_live_data.py' diff --git a/scripts/run_loop.sh b/scripts/run_loop.sh index 53eef5c..53b3c8f 100755 --- a/scripts/run_loop.sh +++ b/scripts/run_loop.sh @@ -5,6 +5,8 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# EDICT_HOME 指向中央仓库根目录,供各 workspace 里的 kanban_update.py 定位中央数据库 +export EDICT_HOME="$(dirname "$SCRIPT_DIR")" INTERVAL="${1:-15}" LOG="/tmp/sansheng_liubu_refresh.log" PIDFILE="/tmp/sansheng_liubu_refresh.pid"