auto-sync: 2026-05-17 18:36:46

This commit is contained in:
cfdaily
2026-05-17 18:36:46 +08:00
parent 6f6deee1ad
commit c9cdd2f2d4
+19
View File
@@ -227,6 +227,25 @@ class Dispatcher:
"reason": "Unknown dispatch level",
}
def _build_retry_context(self, task: Task) -> str:
"""构建重试上下文(前轮产出摘要 + 审查意见)
如果任务是从 failed/pending 重新调度(有历史 attempts),
注入前轮的产出摘要和审查意见,让 Agent 知道上轮哪里不对。
"""
if not hasattr(task, 'retry_count') or (task.retry_count or 0) == 0:
return ""
parts = ["## ⚠️ 重试上下文(上次执行失败,请注意以下反馈)"]
parts.append(f"这是第 {task.retry_count + 1} 次尝试。上次执行的问题:")
# 尝试从 task 的 metadata 获取上次失败原因
if hasattr(task, 'notes') and task.notes:
parts.append(f"上轮说明: {task.notes}")
parts.append("请仔细检查上次的错误,避免重复犯错。")
return "\n".join(parts)
def _build_message(self, task: Task, action_type: str) -> str:
"""构建给 Agent 的消息"""
parts = [f"Task: {task.title}"]