sinohqb
da7dd434dd
perf(intelligent-eval): 修复 N+1 查询和参数名混淆
...
- expire_stale_running_sessions: 使用单次 JOIN 查询替代 N+1 查询
将每个会话单独查询最后消息时间改为一次性获取所有 running 会话及其最后消息时间
- submit_report/evals_needing_analyst_nudge: 消除 session/sessions 参数名混淆
将局部变量 sessions 重命名为 eval_sessions,避免与数据库会话参数 session 混淆
这些改进提升了查询性能并增强了代码可读性。
2026-08-24 01:52:05 +08:00
sinohqb
84627a3c6a
refactor(intelligent-eval): 消除 lifecycle.py 和 scheduler.py 中的重复延迟导入
...
CI / test (push) Successful in 3m16s
- 将延迟导入移至模块顶部,消除 Shotgun Surgery 气味
- lifecycle.py: 移除 41 行重复导入
- scheduler.py: 移除 14 行重复导入
- 修复测试:更新 monkeypatch 以补丁 scheduler 模块的引用而非原始模块
- 符合代码规范:避免函数内重复导入
Closes code-review finding: repeated deferred imports (Shotgun Surgery)
2026-08-24 01:47:47 +08:00
sinohqb
876d75f9ed
refactor(intelligent-eval): 将 _get_raw 改为公开方法 get_including_deleted
...
CI / test (push) Successful in 3m22s
- 消除 lifecycle.delete_eval 对私有方法的访问
- 明确该方法用于删除幂等性检查的用途
- 符合代码规范:避免跨模块访问私有接口
2026-08-24 01:37:58 +08:00
sinohqb
2d2c5a2904
feat(intelligent-eval): logical delete for terminal evals
...
CI / test (push) Successful in 3m24s
Add `deleted` terminal status: completed/cancelled/failed → deleted via
DELETE /api/intelligent-evals/{id} (idempotent, 409 for non-terminal).
Deleted evals are hidden from list, detail, stats, and all sub-resource
endpoints (sessions/report/decision-logs/config-snapshots); child tables
are untouched (audit-safe). Frontend shows a Popconfirm-guarded delete
button for terminal evals only.
2026-08-21 14:34:04 +08:00
sinohqb
58c2ad0227
refactor(intelligent-eval): unify watchdog failures behind fail_eval seam
...
CI / test (push) Successful in 3m10s
架构审查候选③(状态机归一):_TRANSITIONS 成为评估状态机的唯一真相。
三个 watchdog(planning 双闸 / executing 兜底 / 触发失败闸门)原先直接
row.status = FAILED 绕过转换表、手工重复写字段。收编到新的公开接缝
fail_eval(session, eval_id, reason, decision_type, context):表校验 →
repo CAS 条件写(status/plan_feedback/updated_at/completed_at 一条 SQL)
→ append_decision_log 留痕。
CAS 冲突(如用户在扫描间隙抢先取消)跳过并留日志,不当故障。API 路径
本已在表内,不动。新增 4 个契约测试,870 tests passed,零行为变化。
2026-08-21 03:35:05 +08:00
sinohqb
182b0e59cb
refactor(intelligent-eval): extract scheduler runtime + internalize decision-log dedup
...
CI / test (push) Successful in 3m9s
架构深化两则(架构审查候选①②):
① scheduler 抽取:web/app.py 约 400 行触发式执行编排(60s 扫描循环、
docker exec 触发、失败落账)沉入 intelligent_eval/scheduler.py,runtime
单例 start()/stop()/scan_once() 与 campaign_runtime 惯例一致;worker/planner
两处重复触发代码合并为一个触发原语;_supplement_decision_logs 归入
decision_logs.py。测试改为直接驱动 scan_once(interface 即测试面)。
② 决策日志去重内化:create_decision_log 的去重只服务 agent 上报路径;
新增 append_decision_log(平台落账纯追加)与 count_decisions(计数原语),
lifecycle/task_queue 全部平台落账切换,调用方不再需要塞 attempt 骗去重。
零行为变化:提示词、60s 节拍、编排顺序、闸门语义原样保留,866 tests passed。
2026-08-21 03:20:14 +08:00
sinohqb
d0487b54b4
fix(intelligent-eval): respect time-window slots before nudging analyst
...
冒烟发现 analyst_nudge 不考虑时间窗口:首会话完成后 10 分钟即催促,
但后续时段尚未到期,导致报告提前收敛、漏掉计划内会话。催促闸门新增
"窗口未结束且会话数未达计划则跳过";worker 触发指令同步明确仅当所有
时段会话都达终态才转 analyst。
2026-08-20 16:27:05 +08:00
sinohqb
eb4944a8bd
feat(intelligent-eval): terminal-state discipline watchdogs (ADR-0011)
...
常见故障自愈有上限,超限收敛终态且可见:任务 attempts 上限、会话过期、
planning 双闸、executing 超窗兜底、触发失败计数判死、孤儿 agent 双管、
fire-and-forget 触发;open_session 预算硬闸门、settle 按终态区分、报告
scores 归一化;cron 池遗留面全删。
2026-08-20 14:34:17 +08:00
sinohqb
56d709c44f
fix(intelligent-eval): reject report until all sessions closed
...
CI / test (push) Successful in 3m59s
t480 实测:评估 completed 但 completed_sessions=0(进度 0%)。根因
(diagnosing-bugs):submit_report 无条件 CAS executing→completed,不看会话
状态——worker 建会话未 close 时,analyst 仍可提交报告把评估标完成。
- lifecycle.submit_report 加校验:存在会话时须全部 close(completed),
否则抛 IntelligentEvalTransitionError(409)——杜绝'评估完成但进度 0%'
- 无会话的评估仍可直接提交(analyst 正常路径不变)
回归测试(诊断闭环 Phase 1 反馈环先红后绿):
- +test_submit_report_rejects_when_sessions_not_closed(running 会话→409)
- +test_submit_report_allows_when_sessions_closed(全 close→200)
900 passed
2026-08-18 15:30:51 +08:00
sinohqb
00ad929d68
feat(intelligent-eval): v4.2 UI — stat bar + single-line table + unified detail drawer
...
CI / test (push) Successful in 3m58s
评估列表页(v4.2):
- 顶部状态统计条(stat-chip 点击筛选,后端列表接口新增 stats 状态分布 +
status 筛选参数)
- 单行表格(名称/评测对象 ellipsis 省略)+ 会话进度迷你进度条 +
最后一列醒目查看按钮 + 整行可点击
- 详情/报告合一单层抽屉(1000px,Tabs:概览/决策过程/配置历史/报告),
审批/取消在抽屉头部;移除独立详情页 /intelligent-evals/detail 与
intelligentEvalNav store
任务队列页:
- 与列表页统一 stat-chip 统计条 + 单行表格(评估状态小标、失败原因 tooltip)
清理:删除 IntelligentEvalDetail.tsx / intelligentEvalNav.ts;App.tsx 移除
detail 路由。任务队列保持独立菜单页。tsc 0 错误 vitest 19 passed 895 passed
2026-08-17 20:03:55 +08:00
sinohqb
cc2ac8da89
feat(intelligent-eval): paginate the eval list
...
CI / test (push) Successful in 4m5s
GET /api/intelligent-evals 支持 page/page_size(默认不传仍返回全部,向后兼容):
repository 加 count/list_page,lifecycle 加 list_evals_page,router 返回 total。
前端服务端分页:useIntelligentEvalRead 接 page/pageSize,list 存 total,
IntelligentEvals 表格 showSizeChanger + 页码切换重新加载;5s 轮询保持当前页。
测试:+3 后端分页 + hook 页码透传/总数断言,895 passed,vitest 19 passed
2026-08-17 14:09:17 +08:00
sinohqb
e6f98aaa6d
feat(intelligent-eval): implement config snapshot management (ticket 05)
...
- Add config_snapshot.py with save/list/get/compare functions
- Auto-save snapshots on eval creation and plan submission
- Implement snapshot query APIs (list, get single)
- Implement snapshot comparison API (diff two snapshots)
- Add 8 unit tests and 7 integration tests
Snapshots track config changes over time (created/plan_submitted/config_updated).
All 813 tests passing.
2026-08-12 10:19:07 +08:00
sinohqb
62485684ca
fix(architecture): enforce lifecycle consistency
2026-08-07 10:59:27 +08:00
sinohqb
c896ab3f71
refactor(architecture): deepen evaluation lifecycle and read model
2026-08-07 03:11:37 +08:00
sinohqb
1317552701
feat(intelligent-eval): add backend for OpenClaw-driven intelligent evaluation (tickets 01-04)
...
Introduce 智能评估 as an evaluation paradigm parallel to static evaluation,
driven by OpenClaw. The platform supplies storage, lifecycle, and reporting;
OpenClaw plans and executes.
- Data model: IntelligentEval + Session + Message tables (new, not reusing exploration)
- Lifecycle state machine: draft → planning → pending_approval → executing → completed/cancelled/failed
- Session API: create/message (channel-forwarded)/close with turn accounting
- Report API: pydantic-validated structured report, executing → completed, Markdown export (pure renderer)
- Alembic migration for the three tables; domain glossary added to CONTEXT.md
2026-08-05 03:18:52 +08:00