From 8862d72a6025cb86a3e5da84a60dc7342aaf7b95 Mon Sep 17 00:00:00 2001 From: ymq Date: Tue, 25 Aug 2026 17:01:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(sdlc):=20=E6=A0=B9=E6=B2=BB=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=90=8D=E7=BB=A7=E6=89=BF=20bug(design=20=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=90=8D=E4=B8=8D=E5=86=8D=E8=B7=9F=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E5=90=8D=E4=B8=80=E6=A0=B7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:_create_next_task 用 new_title=f'{title}({next_role}阶段)' 直接继承上一任务 title + 追加角色后缀。导致 design 任务名变成「需求规格说明书(agent.design阶段)」 跟需求名混同;回退重做后更叠加成「...(回退重做)(agent.develop阶段) (agent.deploy_test阶段)」越叠越长。 修:title 改按 next_role 的声明式 task_title 生成语义标题(项目名 + 阶段语义), 阶段模板由 RoleSpec.task_title 声明(design=应用架构与模块设计 / develop=应用脚手架开发 / deploy_test=部署测试 / test=功能测试),代码不硬编码。 --- pipeline_service/agent_loop.py | 22 +++++++++++++++++++++- pipeline_service/sdlc_ability.py | 4 ++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/pipeline_service/agent_loop.py b/pipeline_service/agent_loop.py index 2bff03f..af74b58 100644 --- a/pipeline_service/agent_loop.py +++ b/pipeline_service/agent_loop.py @@ -947,7 +947,27 @@ async def _create_next_task(sor, project_id, task, next_role, pm_comment=''): params = json.loads(params_str) if isinstance(params_str, str) else params_str except (json.JSONDecodeError, TypeError): params = {} - new_title = f"{title}({next_role}阶段)" + # 标题:不再继承上一任务 title + 追加「({next_role}阶段)」——那是 title 继承 bug 的根源, + # 导致 design 任务名变成「需求规格说明书(agent.design阶段)」跟需求名混同,回退重做后更叠加成 + # 「...(回退重做)(agent.develop阶段)(agent.deploy_test阶段)」。改为按 next_role 的声明式 + # task_title 生成语义标题(项目名 + 阶段语义),阶段标题模板由 RoleSpec.task_title 声明。 + stage = next_role + try: + pid = await _resolve_pipeline_id(project_id) + from pipeline_core import get_role_spec + spec = get_role_spec(pid, next_role) + if spec and getattr(spec, 'task_title', ''): + stage = spec.task_title + except Exception: + pass + pname = '' + try: + _p = await sor.sqlExe("SELECT name FROM sd_projects WHERE id=${pid}$", {"pid": project_id}) + await sor.sqlExe("COMMIT", {}) + pname = getattr(_p[0], 'name', '') if _p else '' + except Exception: + pname = '' + new_title = f"{pname} {stage}" if pname else stage new_params = {**params, 'previous_role': _normalize_role(getattr(task, 'role', '')), 'previous_task_id': getattr(task, 'id', ''), 'pm_comment': pm_comment} # 任务来源标记:系统自动派生(design→develop→deploy_test→test)都是「新开发」链, diff --git a/pipeline_service/sdlc_ability.py b/pipeline_service/sdlc_ability.py index 2c8d939..581cc24 100644 --- a/pipeline_service/sdlc_ability.py +++ b/pipeline_service/sdlc_ability.py @@ -271,6 +271,7 @@ SDL_ROLES = [ aliases=["requirements", "requirement_analysis"], system_prompt="""你是需求分析师。先 load_skill 加载 role 技能,按其中的职责与应遵守规范执行任务。""", next_role="agent.design", + task_title="应用架构与模块设计", ), RoleSpec( name="agent.design", @@ -278,6 +279,7 @@ SDL_ROLES = [ aliases=["designer", "ui", "ux"], system_prompt="""你是系统设计师。先 load_skill 加载 role 技能,按其中的职责与应遵守规范执行任务。""", next_role="agent.develop", + task_title="应用脚手架开发", ), RoleSpec( name="agent.develop", @@ -285,6 +287,7 @@ SDL_ROLES = [ aliases=["developer", "dev", "development", "coding"], system_prompt="""你是开发工程师。先 load_skill 加载 role 技能,按其中的职责与应遵守规范执行任务。""", next_role="agent.deploy_test", + task_title="部署测试", ), RoleSpec( name="agent.deploy_test", @@ -292,6 +295,7 @@ SDL_ROLES = [ aliases=["deploy_staging", "staging"], system_prompt="""你是测试环境部署工程师。先 load_skill 加载 role 技能,按其中的职责与应遵守规范执行任务。""", next_role="agent.test", + task_title="功能测试", ), RoleSpec( name="agent.test",