fix(qa-feedback): raise_problem 归一化 question,修复 QC 改进意见丢失(1241)

根因:QC 审核的决策里 questions 是 list(7 条改进意见数组),qc_review_run 把
decision.get("questions") 直接传给 raise_problem 的 question 参数,而 raise_problem
未做 str 化,导致 INSERT pipeline_agent_questions 时 question 字段是 list,MySQL 报
OperationalError(1241, 'Operand should contain 1 column(s)'),改进意见根本没落库。

后果链:QC 意见丢失 → develop 重做时 _build_qna_section 读不到任何 pending 退回意见
→ 每次裸重做(看不到「为什么被驳回、该怎么改」)→ 反复产出同样的空交付件。

修复:raise_problem 里 question 若为 list/tuple,先 join 成换行字符串再入库。
This commit is contained in:
ymq 2026-08-19 18:34:58 +08:00
parent 3ffe39e885
commit 4d543f529c

View File

@ -56,6 +56,11 @@ async def raise_problem(problem_type, question, from_role, from_agentid="",
question_id
"""
db, dbname = _get_db()
# 归一化 question:QC 决策的 questions 可能是 list(多条意见数组),须 join 成字符串,
# 否则 INSERT 报 OperationalError(1241, 'Operand should contain 1 column(s)'),改进意见丢失、
# develop 重做时读不到任何退回意见 → 反复产出空交付件。
if isinstance(question, (list, tuple)):
question = "\n".join(str(x) for x in question)
async with db.sqlorContext(dbname) as sor:
hr = first_handler_role or "agent.main_agent"
ha = first_handler_agentid or ""