fix: fail loud when diagnosis video tree not covered (algo #7 input)

This commit is contained in:
2026-07-15 22:25:30 -04:00
parent d6c595c4a4
commit c5fff7f8b3
2 changed files with 90 additions and 1 deletions
+8 -1
View File
@@ -2142,7 +2142,14 @@ async def run_diagnosis(
key = (prediction.get("video_id", ""), prediction.get("question_id", ""))
traces = traces_by_question.get(key, [])
vid = prediction.get("video_id", "")
td = tree_data_by_video.get(vid, {})
if vid not in tree_data_by_video:
# P5 fail-loud:诊断需真实树,调用方须为每个诊断视频加载 tree_data;
# 静默回退空树会让 ground_truth 恒空、error_type 归因坍缩(本次修复的根因)。
raise ValueError(
f"诊断视频树未覆盖: video_id={vid!r} 不在注入的 tree_data 中"
"(调用方须为每个诊断视频加载树,P5 fail loud"
)
td = tree_data_by_video[vid]
skill_content = skill_cache.get(prediction.get("task_type", ""), "")
try: