AgentEvalTool/tests/unit
sinohqb 867d4e3ff1 fix(engine): dynamic 生成失败原因持久化到 run.summary.case_errors
## 背景
用户反馈动态问诊评测「执行不下去」。诊断发现:dynamic 用例的 LLM 消息
生成 API 调用失败(0.2s 瞬间 failed,凭证/参数问题),引擎正确地标记
case 失败——但失败的具体原因(如 401 详情)只 emit 到 WebSocket,从不
写入 run.summary。导致 run 记录只有 total_rules:0 failed,DB/报告查不到
任何原因,用户和排查者都无从下手。

## 修复
- EvalEngine 新增 self._case_errors 收集致命的 case 级错误
- _generate_messages 的 8 个失败点统一走 _fail() helper:既 emit 到
  WebSocket,也记录到 _case_errors(含 case_id + stage + 具体 error)
- run() 汇总时把 _case_errors 写入 summary["case_errors"]
- 新增测试:dynamic 生成失败时 summary.case_errors 必须含原因(补上
  之前 KNOWN-2 记录的 _generate_messages 测试盲区)

## 注
这不是导致失败的 bug(失败源于外部 API 凭证/参数),而是让失败「可诊断」
的可用性修复。用户需自查 llm_config 的 api_key 是否有效/model 是否被
该端点接受。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-17 16:29:51 +08:00
..
__init__.py v0.2.0-dev: 文件管理 + 页面布局统一 + 6 个 bug 修复 2026-07-16 15:25:22 +08:00
mock_channel.py v0.2.0-dev: 文件管理 + 页面布局统一 + 6 个 bug 修复 2026-07-16 15:25:22 +08:00
test_cascade.py v0.2.0-dev: 文件管理 + 页面布局统一 + 6 个 bug 修复 2026-07-16 15:25:22 +08:00
test_engine.py fix(engine): dynamic 生成失败原因持久化到 run.summary.case_errors 2026-07-17 16:29:51 +08:00
test_file_repository.py v0.4-t1t2: 测试覆盖率 62%→77% + UTC 时区根本修复 2026-07-17 14:19:16 +08:00
test_http_channel_and_rules.py v0.4-t3t4: OpenClaw 通道 + 前端 bundle 优化 2026-07-17 15:37:14 +08:00
test_llm_score.py fix(llm_score): 修复多轮用例 question 提取错位导致普遍打 0 分 2026-07-17 16:15:07 +08:00
test_report.py v0.4-t1t2: 测试覆盖率 62%→77% + UTC 时区根本修复 2026-07-17 14:19:16 +08:00
test_s2_rules_and_logic.py v0.3-s2: 3 个新规则 + 组合逻辑 + 33 个测试 2026-07-17 11:23:22 +08:00
test_scenarios.py v0.4-t1t2: 测试覆盖率 62%→77% + UTC 时区根本修复 2026-07-17 14:19:16 +08:00
test_settings.py v0.2.0-dev: 文件管理 + 页面布局统一 + 6 个 bug 修复 2026-07-16 15:25:22 +08:00
test_utils_llm.py v0.4-t1t2: 测试覆盖率 62%→77% + UTC 时区根本修复 2026-07-17 14:19:16 +08:00
test_webhook.py v0.4-t1t2: 测试覆盖率 62%→77% + UTC 时区根本修复 2026-07-17 14:19:16 +08:00