kin: KIN-ARCH-022 Рефакторинг: pm.md строка 134 + дублированное присваивание в context_builder.py

This commit is contained in:
Gros Frumos 2026-03-17 16:03:49 +02:00
parent 950a2251e0
commit a46157b22b

View file

@ -1162,7 +1162,7 @@ def _execute_department_head_step(
},
}
return {
ret = {
"success": sub_result.get("success", False),
"output": json.dumps(summary, ensure_ascii=False),
"cost_usd": sub_result.get("total_cost_usd", 0),
@ -1170,6 +1170,10 @@ def _execute_department_head_step(
"duration_seconds": sub_result.get("total_duration_seconds", 0),
"last_sub_role": last_sub_role,
}
if not sub_result.get("success"):
ret["blocked_reason"] = sub_result.get("blocked_reason") or sub_result.get("error")
ret["error"] = sub_result.get("error")
return ret
# ---------------------------------------------------------------------------
@ -1585,8 +1589,9 @@ def run_pipeline(
total_tokens=total_tokens,
total_duration_seconds=total_duration,
)
error_msg = f"Department {role} sub-pipeline failed"
models.update_task(conn, task_id, status="blocked", blocked_reason=error_msg)
blocked_reason = dept_result.get("blocked_reason") or dept_result.get("error") or f"Department {role} sub-pipeline failed"
error_msg = f"Department {role} sub-pipeline failed: {dept_result.get('output', '')[:200]}"
models.update_task(conn, task_id, status="blocked", blocked_reason=blocked_reason)
return {
"success": False,
"error": error_msg,