Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 6.33 KB

File metadata and controls

49 lines (37 loc) · 6.33 KB

17 项 DoD 验收清单

来源08-可观测与可评估Agent深度设计.md §六「快速验证清单」(可观测 7 + 可评估 7 + 闭环 3 = 17 项)。 验收日期:2026-06-13 · 验收 commitdf02cf6(main)· baseline:weighted 0.838(v3,git c98987f)。 总评16 项 ✅ 满足 + 1 项 🔶 部分(第 16 项 CI 自动触发因账单 defer,逻辑已齐备)。每项证据均为代码 / 配置 / 账本的真实 文件:行,可点击核验。


可观测性验证(7/7 ✅)

# 判定 证据
1 每次运行的 trace 都被保存 observability/langfuse_client.py:35-65(lifespan 初始化 Langfuse 3 singleton);observability/span_hook.pyLangfuseSpanHook 建 root span);生产经 done_hook.py、CI 经 tests/eval/run_gold_set.py:109-115 两条路径都落 trace
2 trace 含每步 输入/输出/耗时/token observability/span_hook.py SpanFields 定义 9 字段 span(step/input/output/model/tool_name/tokens_in/tokens_out/latency_ms/error/status),_close() 写入 metadata(CLAUDE.md Rule #2 硬约束)
3 工具调用参数 + 返回值都记录 span_hook.py on_tool_start/end 捕获 tool input/output;agent/tool_dispatch.py 记录 ToolCall(input/output/error/latency_ms)
4 错误和重试都记录 span_hook.py on_chain_errorstatus="error"packages/eval/.../judge.py:103-125 judge parse 失败 retry+fallback;LLM 层 FallbackChainllm/registry.py)记录降级
5 可经 trace 完整复现决策过程 span_hook.py StepName 枚举覆盖 intent→retrieval(含 M2c 子步)→advisor→tool_dispatch 全链路 11+ 步,每步独立 span;CI 报告失败案例表逐例可溯
6 可经 trace 找性能瓶颈(哪步最慢) 每 span latency_ms;Prometheus raguide_retrieval_latency_seconds 直方图 + Grafana 面板;efficiency 维度按 latency 打分(agent_evaluator.py:267-275
7 可经 trace 找成本热点(哪步最耗 token) observability/tokens_capture.py 按步 record tokens_in/out 进 9 字段;run_gold_set.py track_trace_tokens 累计每 trace token;P4 月成本累计 billing/cost_guard.py

可评估性验证(7/7 ✅)

# 判定 证据
8 15+ 评估用例,覆盖多类别 tests/gold_set/{happy,edge,error,adversarial,regression}.yaml75 case(happy18 / edge14 / error13 / adversarial16 / regression14),5 类别覆盖(adversarial 含 prompt injection,Rule #4)。注:_baseline.json baseline 仍标 case_count 71(baseline 仅在 GATE PASSED 时更新,扩集后未重跑 → 数字滞后正常,评分 0.838 不动)
9 评估器能自动运行并打分 tests/eval/run_gold_set.py run() 逐 case 跑图 + AgentEvaluator 打分 + 聚合;CLI 一条命令全量
10 打分多维度(非单一总分) packages/eval/.../agent_evaluator.py WEIGHTS:task_completion .30 + output_quality .30 + process_quality .20 + efficiency .10 + safety .10(Rule #3 锁定)
11 LLM-as-Judge 已接入 packages/eval/.../judge.py 调 judge 模型(response_format=json_schema)评 output_quality + task/safety 交叉核验。设计值 Opus,因 newapi 限制实接 claude-sonnet-4-6(baseline judge_model 字段印证,spec §17 详)
12 评估报告能自动生成 run_gold_set.py write_report()--write-report)出 markdown(维度对比 + 失败案例 + 最弱维度建议),存 tests/eval/_reports/report-*.md(最新 report-20260612T165849Z.md
13 基线分数已记录 tests/gold_set/_baseline.json:weighted 0.838 + 5 维 + 5 类 + git_sha + timestamp + judge_model + case_count
14 优化前后可量化对比 packages/eval/.../ci_gate.py no-regression 对比 baseline↔current(容差 0.03);报告 Baseline/Current/Δ 列;README「评测驱动优化日志」记录 v1 0.712→v2 0.789→v3 0.838 全程

闭环验证(2/3 ✅ + 1/3 🔶)

# 判定 证据
15 评估问题可在 trace 定位根因 run_gold_set.py:109 每 case 独立 trace_id(secrets.token_hex);生产 done_hook.py 读 trace_id 经 client.create_score(trace_id=...) 把分数对齐进 Langfuse,trace 与 eval score 在 UI 同屏
16 优化后自动跑评估验证效果 🔶 gate 逻辑齐备(ci_gate.check no-regression + safety floor + schema + coverage)、.github/workflows/eval.yml 存在。但触发是 workflow_dispatch(手动),非 push/PR 自动——注释说明:需 judge secrets + 每次 push 成本高,故改手动;当前主路径为本地 caffeinate -is 手动全量跑。账单恢复后加回 push:/pull_request: 触发即转 ✅
17 生产日志可回流到评估数据集 done_hook.py:95-131 weighted<0.6 的生产 case 经 _insert_candidate 挖入 eval_candidate_cases 池(表 DDL infra/postgres/init.sql:164);池→gold-set 的人工审核升级遵循借鉴设计第 4 条「L0 写入门禁 / Action-Verified Only」(人工确认后入 gold-set)。2026-06-19 L0 富化:候选表加 signals JSONB,捕获阶段存 intent / slots / tools;approve 时据此构建 expected_slots(category / intent_type / preferences / mentioned_products / budget,空值丢弃)+ 富 notes 后由 writer 写入 gold-set,修复「采纳入库案例数据稀疏」;expected_safety 据实不捏造,pre-fix 旧候选降级为空槽(+1 backend 测试)

结论

17 项中 16 项满足、1 项部分(第 16 项 CI 自动触发 defer,非能力缺失,逻辑已就绪)。配合 07 文档 10 项 launch checklist(P4 已落地告警/降级/成本/回归项),raguide 在可观测性、可评估性、优化闭环三个维度上达到设计标准。

唯一已知 gap(如实记录,非阻断)

  • 第 16 项:eval gate 未在 CI 自动触发(账单未恢复,workflow_dispatch 手动 + 本地 caffeinate 跑)。一行 trigger 改动即可启用,待 repo secrets(judge API key)配置。
  • eval.yml 注释仍写「50 cases」(gold-set 2026-06-19 已扩至 75:happy18/edge14/error13/adversarial16/regression14),属注释过时,不影响 gate 行为。