fix(sdlc): 根治任务名继承 bug(design 任务名不再跟需求名一样)

根因:_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=功能测试),代码不硬编码。
This commit is contained in:
ymq 2026-08-25 17:01:19 +08:00
parent 9bb1c5ce65
commit 8862d72a60
2 changed files with 25 additions and 1 deletions

View File

@ -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都是「新开发」链

View File

@ -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",