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()