三层统一自检集成到 BOSSAGENTS 默认任务(2026-07-13)
用户要求澄清
"放到 BOSSAGENTS 的默认任务里面,不是放到你的任务里面" —— 指集成进 BOSSAGENTS 自有的数字员工调度系统(boss-scheduler),而非 OpenClaw 的 cron。
"就算是加也不要默认自动启动,手工启动" —— 代码就位但默认不自动跑三层自检,由用户手工触发。
操作记录
- 删除误加的 OpenClaw cron 任务:
b036d7fc-...(三层统一自检巡检)已 remove。 - 定位 BOSSAGENTS 默认巡检入口:
- 调度系统:
server/boss-scheduler/(lite-scheduler.js+workers/) - 数字员工注册:
server/boss-scheduler/profiles/local.yaml - 系统巡检员工:
DS-BOSS-002 小智-系统运维师,worker: system-health,cron: 0 /3,enabled: true,checks: [database, SCSAI_connection, template_coverage, rules_v2, consistency] - worker 实现:
server/boss-scheduler/workers/system-health.js(DS-BOSS-002 轻量健康巡检)
- 路径基准修正(
server/scripts/health-check.js):
DB_PATH:path.resolve(__dirname, '..', 'data', 'rule_engine.db')(scripts→server/data)✅require('../core/rule-engine')(scripts→server/core)✅- 报告写到
path.resolve(__dirname, '..', '..', 'health-report.json')(→ 项目根)✅
- worker 集成新 check
unified_health(system-health.js):
- 在 checks 分发末尾新增
if (checksEnabled.has('unified_health'))分支 - 用
execFileSync(process.execPath, [scriptPath])调用server/scripts/health-check.js - 读取
health-report.json,解析 summary.health → check.status(HEALTHY=ok / DEGRADED=warning / 其他=error) - 报告路径:
path.resolve(__dirname, '..', '..', '..', 'health-report.json')(workers→项目根)✅
- 未在
local.yaml的DS-BOSS-002.checks添加unified_health(默认不自动启动,符合用户约束)。
验证结果
- 脚本直跑:
health-check.js正常生成 health-report.json / .md(L1 全 PASS,L2/L3 取决于服务在线) - worker 集成测试:
checks:['unified_health']触发 → 正确返回{name:'三层统一自检', status:'warning', health:'DEGRADED', pass:8, warn:10, fail:0} - WARN 偏多原因:3006 服务当前未运行(L2 六能力 HTTP、L3 治理工具 HTTP 连不上),L1 本地直查仍 PASS
- 服务端口 3006 当前 NOT listening;无 node server 进程在跑
手工启动三层自检的方式(供用户选择)
- 方式A(接入系统运维师定时巡检):
local.yaml的DS-BOSS-002.checks加一行- unified_health,重启服务后每3小时自动带三层自检 - 方式B(单次手动):
node server/scripts/health-check.js - 方式C(单次触发 worker):单独调用
runSystemHealth({checks:['unified_health']}, ...)
结论
三层统一自检已作为 BOSSAGENTS 系统运维师的可选检查项(unified_health)就位,代码路径全部对齐,但未默认启用。符合"放进去但不自动启动"的要求。待用户决定手工启动方式(建议先启动 3006 服务再做完整 L2/L3 验证)。
BossAgents