From 8cfae215e0e19bf9e5c4130ace87d6fd17a77027 Mon Sep 17 00:00:00 2001 From: ymq Date: Mon, 17 Aug 2026 18:13:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BB=BA=E4=BB=BB=E5=8A=A1=E6=97=B6?= =?UTF-8?q?=E5=BD=92=E4=B8=80=E5=8C=96=20role=EF=BC=88=E8=A3=B8=E5=90=8D?= =?UTF-8?q?=20design/test=20=E2=86=92=20agent.design/agent.test=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 会话agent create_task 工具(_h_create_task)和 storage.create_task 把 LLM 传来的 裸角色名原样入库,而角色agent认领时 _claim_task→_normalize_role 用规范名 (agent.{role})匹配,导致裸名任务永远匹配不上、卡 submitted 无人认领 (poller 每10秒空转 dispatch)。统一在建任务入口归一化 role 根治。 --- pipeline_service/sdlc_ability.py | 6 ++++++ pipeline_service/storage.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/pipeline_service/sdlc_ability.py b/pipeline_service/sdlc_ability.py index 8f50889..e089ebe 100644 --- a/pipeline_service/sdlc_ability.py +++ b/pipeline_service/sdlc_ability.py @@ -313,6 +313,12 @@ async def _h_create_task(sor, p, ctx): if not title: return "需要任务标题" + # 归一化角色名:裸名(design/test/develop/requirement) → agent.{role}。 + # 角色agent认领时(_claim_task→_normalize_role)用规范名匹配,裸名入库会永远匹配不上, + # 任务卡 submitted 无人认领(poller 每10秒空转 dispatch)。 + from .agent_loop import _normalize_role + role = _normalize_role(role) + tid = getID() await sor.C("pipeline_tasks", { "id": tid, "tenant_id": pid, "pipeline_id": "role_task", diff --git a/pipeline_service/storage.py b/pipeline_service/storage.py index 48190c2..4c1cfe9 100644 --- a/pipeline_service/storage.py +++ b/pipeline_service/storage.py @@ -61,6 +61,11 @@ async def create_task(tenant_id: str, pipeline_id: str, owner_id: str, title: st role: 目标角色(需求/设计/开发/测试/运维)。空串=不限角色(兼容旧任务)。 带角色的任务由角色agent循环认领执行,不带步骤记录。 """ + if role: + # 归一化角色名(裸名 design/test/develop → agent.{role}),与 _claim_task 匹配口径一致, + # 避免裸名入库导致角色agent认领时匹配不上、任务卡 submitted。 + from .agent_loop import _normalize_role + role = _normalize_role(role) db, dbname = _get_db() async with db.sqlorContext(dbname) as sor: task_id = getID()