fix(human_task): 人类待办答复即权威,不再送agent QC(2026-09-15用户裁定)——原complete→human_task_qc→LLM审查人类答复→不合规退回pending→用户再说忽略又被退的死循环(甘肃项目45EbV3Nw实测堆3个QC任务);人工override权威守卫须跳过铁律,complete直接done+qc_status=passed

This commit is contained in:
ymq 2026-09-15 21:51:22 +08:00
parent b0342db38e
commit ecc113f9b3

View File

@ -284,31 +284,18 @@ async def complete_human_task(human_task_id, result_data, operator_id=None):
if task_type == T_BUG_ACCEPT:
return False, "bug 验收任务请走 bug_accept 接口"
# generaldone + 触发 QC创建 qc_review 任务)
# 2026-09-15 用户裁定(人类答复权威):人类待办的答复不再送 agent QC。
# 原链路 complete→human_task_qc→通用QC提示词审查人类答复→LLM 判「答复不合规」
# →qc_reject→待办回 pending→用户再说「忽略」又被退——实测甘肃项目用户答复
# 「忽略任这些问题」被连退45EbV3Nw 一个待办堆了 3 个 QC 任务)。
# 待办的本质是「请人类办事」,人类说完成/忽略 = 最终裁定agent 审查人类是倒挂;
# 与「人工 override 权威守卫须跳过」铁律一致(确定性规则,不靠 LLM 自觉)。
await sor.sqlExe(
"UPDATE pipeline_human_tasks SET status='done', result_data=${rd}$, "
"qc_status='passed', qc_comment='人类答复即权威不送agent QC', "
"submitted_by=${oid}$, submitted_at=NOW() WHERE id=${hid}$",
{"rd": result_json, "oid": operator_id, "hid": human_task_id})
await sor.sqlExe("COMMIT", {})
# 创建 QC 任务(复用 qc poller → qc_review_run
qid = getID()
qparams = {
"task_kind": "human_task_qc",
"human_task_id": human_task_id,
"title": ht.get('title', '') or '',
"description": (ht.get('description', '') or '')[:2000],
"iteration_id": ht.get('iteration_id', '') or '',
}
# 补 titlepipeline_human_tasks 有 title 列,已在上方 result 里带)
await sor.C('pipeline_tasks', {
'id': qid, 'tenant_id': pid, 'pipeline_id': 'role_task',
'owner_id': 'human_task_qc',
'title': f"人类任务 QC 检查({human_task_id[:8]}",
'state': 'qc_review', 'role': 'agent.qc',
'params': json.dumps(qparams, ensure_ascii=False),
})
await sor.sqlExe("COMMIT", {})
return True, human_task_id