AgentEvalTool/docs/adr/0009-trigger-driven-execution-replaces-cron-pool.md
sinohqb 2dd023fdd9
All checks were successful
CI / test (push) Successful in 4m2s
docs(intelligent-eval): align domain language with trigger-driven execution (ADR-0009)
方案③落地后,智能评估执行机制从'常驻 cron 每分钟自唤醒'改为'平台每 60s
扫描入队 + 按需触发无状态 headless agent'(触发式执行)。对齐领域语言:
- CONTEXT.md:Cron 池/工作单元(Worker)标 deprecated;新增触发式执行词条;
  修正时间窗口(cron 自唤醒→平台扫描时段到期)、任务队列(消费端)、决策日志
- ADR-0009 新增:记录触发式执行取代 cron 池的决策(原因:cron 需外部 channel,
  OpenClaw webchat 非 channel 账号无法 delivery);ADR-0007 标 superseded
- 代码标 deprecated:cron_pool / fault_tolerance / openclaw_cron_pool 路由 /
  CronPoolMonitor 页(导航入口已从 App.tsx 移除,监控由 TaskQueueMonitor 承担)
895 passed, vitest 19 passed
2026-08-17 16:16:12 +08:00

33 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ADR-0009: 智能评估执行改为触发式执行(取代 Cron 池)
**状态**: 已接受
**日期**: 2026-08-17
**决策者**: 架构团队
**相关**: 取代 ADR-0007Cron 池模式、CONTEXT.md智能评估词汇
## Context
智能评估原按 ADR-0007 采用 **Cron 池模式**:平台维护 5-20 个 OpenClaw cron工作单元每个 cron 每分钟自唤醒、从平台任务队列取任务执行。2026-08 实际部署验证发现该机制**依赖外部 IM channel**OpenClaw 的 cron delivery 需要一个 channel 账号,而 webchat 是 Control UI 内置、非 channel 账号,无法用于 delivery`--command` cron 同样 fail-closed。结果 cron worker 永远无法被唤醒执行,评估卡在 assigned。
## Decision
将智能评估执行改为**触发式执行Trigger-driven**
1. **平台掌控节奏**lifespan 后台循环每 60s 扫描 executing 评估 → 判断时段到期/欠账 → 入队(任务队列语义不变)
2. **平台按需触发**:有 pending 任务时 `docker exec openclaw-eval openclaw agent --agent main -m "<worker skill + 立即完成,不要等待下一节拍>" --json`,触发一个**无状态 headless agent**`--deliver` 默认 false免外部 channel执行 worker skill从任务队列取任务完成即退
3. **平台兜底**assigned 超时(>10min重入队`requeue_stale_assigned_tasks`agent 未上报决策日志时按状态补录(`cron_id=platform`
任务队列、决策日志、评估状态机等共享层原样保留;变化只在"执行主体":常驻 cronpull、有状态→ 按需触发的一次性 agentpush、无状态
### 已否决的方案
- **常驻 cron worker**ADR-0007 原方案):需外部 IM channelOpenClaw webchat 非 channel 账号,`--command` cron fail-closed——cron 无法被唤醒
- **平台静态执行**:平台直接驱动对话会退化为静态评测,失去 OpenClaw 的自主决策ADR-0007 已否决过)
### Consequences
- **Cron 池代码遗留**cron_pool.py / fault_tolerance.py / openclaw_cron_pool 路由 / Cron 池监控页为遗留,标注 deprecated导航入口移除t480 上旧 `intelligent-eval-worker` cron 已禁用(保留 `agenteval-patrol` 独立 cron
- **卡死检测机制变化**cron 的 busy/last_active stuck 检测对无状态 agent 不适用,改为平台 assigned 超时重入队
- **触发指令必须带"立即完成"语义**`openclaw agent` 无 cron state若只发 skill 名会按 worker skill 的"跨节拍"设计决策后等下一拍而死锁
- **监控载体变化**:旧"定时触发"可视化由任务队列监控页TaskQueueMonitor取代