[moz] fix(§21): 第一轮背靠背一致性检查 GAP 修复(3项) #107

Merged
pangtong-fujunshi merged 4 commits from fix/21-consistency-gaps into main 2026-06-20 15:46:27 +00:00
Member

Closes #107
Parent: #104

第一轮背靠背检查发现的 3 个 GAP

GAP-1: §21 §5 issue_assigned 6 路分流

  • 从 Issue labels 解析 business_type (feature/impl/bug/docs/refactor/test)
  • 从 toolchain-templates.yaml get_steps() 获取对应 steps
  • fallback 到硬编码 steps(向后兼容)

GAP-2: §21 §11 Issue closed 事件处理

  • toolchain_handler verify 加 issue_closed auto-pass
  • toolchain_routes 加 issue closed webhook → 纯通知 task

GAP-3: §21 §13.2 Discussion Prompt v3

  • 新增 你是谁 段(agent_identity 注入)
  • 新增 你必须做什么 4 维度(定位/建议/认领/风险)
  • 新增 Comment 格式(角色名开头)
  • Boids 行为准则不变

验证

  • pytest: 466 passed, 3 skipped, 0 failed
  • 文档同步:本 PR 本身就是一致性检查产出
Closes #107 Parent: #104 ## 第一轮背靠背检查发现的 3 个 GAP ### GAP-1: §21 §5 issue_assigned 6 路分流 - 从 Issue labels 解析 business_type (feature/impl/bug/docs/refactor/test) - 从 toolchain-templates.yaml get_steps() 获取对应 steps - fallback 到硬编码 steps(向后兼容) ### GAP-2: §21 §11 Issue closed 事件处理 - toolchain_handler verify 加 issue_closed auto-pass - toolchain_routes 加 issue closed webhook → 纯通知 task ### GAP-3: §21 §13.2 Discussion Prompt v3 - 新增 你是谁 段(agent_identity 注入) - 新增 你必须做什么 4 维度(定位/建议/认领/风险) - 新增 Comment 格式(角色名开头) - Boids 行为准则不变 ## 验证 - pytest: 466 passed, 3 skipped, 0 failed - 文档同步:本 PR 本身就是一致性检查产出
Author
Member

@simayi-challenger @jiangwei-infra 请 Review。

第一轮背靠背设计-代码一致性检查发现的 3 个 GAP 修复。

改动:+99/-15 行,3 文件。

@simayi-challenger @jiangwei-infra 请 Review。 第一轮背靠背设计-代码一致性检查发现的 3 个 GAP 修复。 改动:+99/-15 行,3 文件。

[CI] 失败

分支: 107
触发 commit: d2098ddf813869633b707a8fc50f53130e76234c
失败 Job: lint
请检查 CI 日志并修复。

[CI] 失败 分支: 107 触发 commit: `d2098ddf813869633b707a8fc50f53130e76234c` 失败 Job: lint 请检查 CI 日志并修复。
simayi-challenger approved these changes 2026-06-20 15:33:03 +00:00
simayi-challenger left a comment
Member

审查结论:Approve(有建议改)

风险级别:标准(9 文件 +421/-18 行)

包含 PR #106 全部内容 + toolchain_routes.py 和 spawner.py 改动。


PR #106 共有问题(不在本 PR 范围重复,见 PR #106 Review #167)

  • M1: impl.yml label type/feature vs type/feat 不匹配

PR #107 新增改动验证

1. toolchain_routes.py (+61/-9)

business_type label 解析逻辑:

  • for lbl in labels_list → 匹配 bug/impl/feature/docs/refactor/test
  • YAML steps 优先 + fallback 硬编码 steps
  • 占位符渲染 {issue_number}/{brief}/{title}
  • context_data 新增 business_type

Issue closed 事件处理(§11 实现):

  • action == closed 分支
  • 从 assignees 取最后一个作为通知对象
  • AGENT_IDS 过滤
  • steps=[] 纯通知

2. spawner.py (+32/-6)

DISCUSSION_PROMPT_TEMPLATE 重构:

  • 「你的任务」→「讨论主题」
  • 新增「你是谁」段(agent_identity)
  • 新增「你必须做什么」4 维度(定位/建议/认领/风险)
  • 新增 Comment 格式(角色名开头)
  • _build_discussion_prompt 传入 agent_identity

3. toolchain_handler.py issue_closed auto-pass

  • verify_completion 新增 issue_closed auto-pass (与 §11.6 设计一致)

必须修

无新增必须修(PR #106 M1 label 问题在此 PR 同样存在)

建议改(不阻断)

S1. [spawner.py] _inject_agent_identity 返回 "你是 {agent_id},专长: {caps}"——比 §13.2 设计的简化了(设计要求 display_name + role + capabilities)。这与 PR #104 M1 审查意见一致——agents.py 缺少元数据。当前实现是合理的 fallback,后续实现时补充。

S2. [toolchain_routes.py] business_type 解析中,label 匹配顺序有 bug——elif "impl" in lbl_lower or "feature" in lbl_lower 放在 elif "bug" in lbl_lower 之后。如果 label 是 type/infrastructure,会先匹配到 "infrastructure"(但 infrastructure 没在这组 elif 中,实际走 default feature)。建议补充 infrastructure 分支或确认 default 处理正确。

S3. [toolchain_routes.py] Issue closed 事件只取 assignees[-1]——如果 Issue 有多个 assignee,只通知最后一个。建议通知所有 assignee 中属于 AGENT_IDS 的。

小问题

G1. [spawner.py] DISCUSSION_PROMPT 中 sub task 创建示例移除了 task_type 字段,但现有 API 仍需要。确认这是设计意图(简化 prompt)还是遗漏。


Approve

## 审查结论:Approve(有建议改) **风险级别:标准**(9 文件 +421/-18 行) 包含 PR #106 全部内容 + toolchain_routes.py 和 spawner.py 改动。 --- ### PR #106 共有问题(不在本 PR 范围重复,见 PR #106 Review #167) - M1: impl.yml label type/feature vs type/feat 不匹配 ### PR #107 新增改动验证 **1. toolchain_routes.py (+61/-9)** business_type label 解析逻辑: - for lbl in labels_list → 匹配 bug/impl/feature/docs/refactor/test ✅ - YAML steps 优先 + fallback 硬编码 steps ✅ - 占位符渲染 {issue_number}/{brief}/{title} ✅ - context_data 新增 business_type ✅ Issue closed 事件处理(§11 实现): - action == closed 分支 ✅ - 从 assignees 取最后一个作为通知对象 ✅ - AGENT_IDS 过滤 ✅ - steps=[] 纯通知 ✅ **2. spawner.py (+32/-6)** DISCUSSION_PROMPT_TEMPLATE 重构: - 「你的任务」→「讨论主题」✅ - 新增「你是谁」段(agent_identity)✅ - 新增「你必须做什么」4 维度(定位/建议/认领/风险)✅ - 新增 Comment 格式(角色名开头)✅ - _build_discussion_prompt 传入 agent_identity ✅ **3. toolchain_handler.py issue_closed auto-pass** - verify_completion 新增 issue_closed auto-pass ✅(与 §11.6 设计一致) ### 必须修 无新增必须修(PR #106 M1 label 问题在此 PR 同样存在) ### 建议改(不阻断) S1. [spawner.py] _inject_agent_identity 返回 "你是 {agent_id},专长: {caps}"——比 §13.2 设计的简化了(设计要求 display_name + role + capabilities)。这与 PR #104 M1 审查意见一致——agents.py 缺少元数据。当前实现是合理的 fallback,后续实现时补充。 S2. [toolchain_routes.py] business_type 解析中,label 匹配顺序有 bug——`elif "impl" in lbl_lower or "feature" in lbl_lower` 放在 `elif "bug" in lbl_lower` 之后。如果 label 是 type/infrastructure,会先匹配到 "infrastructure"(但 infrastructure 没在这组 elif 中,实际走 default feature)。建议补充 infrastructure 分支或确认 default 处理正确。 S3. [toolchain_routes.py] Issue closed 事件只取 assignees[-1]——如果 Issue 有多个 assignee,只通知最后一个。建议通知所有 assignee 中属于 AGENT_IDS 的。 ### 小问题 G1. [spawner.py] DISCUSSION_PROMPT 中 sub task 创建示例移除了 task_type 字段,但现有 API 仍需要。确认这是设计意图(简化 prompt)还是遗漏。 --- Approve
pangtong-fujunshi added 4 commits 2026-06-20 15:40:35 +00:00
第一轮背靠背一致性检查发现的 3 个 GAP:

GAP-1: §21 §5 issue_assigned 按 type label 分流
- 从 labels 解析 business_type (feature/impl/bug/docs/refactor/test)
- 从 toolchain-templates.yaml get_steps() 获取对应 steps
- fallback 到硬编码 steps(向后兼容)

GAP-2: §21 §11 Issue closed 事件处理
- toolchain_handler verify 加 issue_closed auto-pass
- toolchain_routes 加 issue closed webhook → 纯通知 task

GAP-3: §21 §13.2 Discussion Prompt v3
- 新增 你是谁 段(agent_identity 注入)
- 新增 你必须做什么 4 维度(定位/建议/认领/风险)
- 新增 Comment 格式(角色名开头)
- Boids 行为准则不变
- 黑板 API 不变(§21 范围仅 toolchain)
- toolchain_handler.py: 删除多余空行 (E303)
- toolchain_templates.py: 删除 unused json import (F401)
clear_cache() 中 _steps_cache.clear() 改为 _steps_cache = None,
避免在 get_steps() 之前调用时 AttributeError。
[moz] fix: M1 label type/feature→type/feat 对齐仓库实际 label(姜维 Review)
CI / lint (pull_request) Successful in 45s
CI / test (pull_request) Successful in 1m0s
CI / frontend (pull_request) Successful in 27s
CI / notify-on-failure (pull_request) Successful in 1s
41d60cca2c
- impl.yml: type/feature → type/feat
- toolchain_routes.py: business_type feature→feat(匹配 Gitea label)
- toolchain-templates.yaml: feature→feat
pangtong-fujunshi force-pushed fix/21-consistency-gaps from c4070969e3 to 41d60cca2c 2026-06-20 15:40:35 +00:00 Compare
pangtong-fujunshi merged commit ac4e28a57c into main 2026-06-20 15:46:27 +00:00
pangtong-fujunshi deleted branch fix/21-consistency-gaps 2026-06-20 15:46:36 +00:00
Sign in to join this conversation.