Skip to content

refactor(evolution): move reviewer feedback orchestration into core rails - #451

Open
openjiuwen-sync-bot[bot] wants to merge 4 commits into
openJiuwen-ai:developfrom
openjiuwenai:sync/pr-2272
Open

refactor(evolution): move reviewer feedback orchestration into core rails#451
openjiuwen-sync-bot[bot] wants to merge 4 commits into
openJiuwen-ai:developfrom
openjiuwenai:sync/pr-2272

Conversation

@openjiuwen-sync-bot

@openjiuwen-sync-bot openjiuwen-sync-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Paired: GitHub #451GitCode !2272

把控制代码放进core部分

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@openjiuwen-collaboration-bot

openjiuwen-collaboration-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

head_sha: 85e2d7dbdeae2f5063a0acf01f3b51746ce8bea8

变更摘要

此 PR 将 reviewer 反馈驱动的 Skill 进化编排逻辑从平台层迁移到核心(core)层。新增了传输和产品无关的 ReviewFeedbackEvolutionCoordinator 协调器,统一管理归因、成员/全局进化、重复模式检测与 Skill 创建路由。TeamScheduler 不再通过 build_context.extras 获取外部处理器,改为从 harness 中查找已挂载的 TeamSkillEvolutionRailTeamSkillEvolutionRail 则通过新增的配置与生命周期方法直接承载反馈进化流程。同时引入了 MemberSkillEvolutionRail 与写时复制机制,确保成员进化隔离于全局 Skill。

主要改动

  • 新增 ReviewFeedbackEvolutionCoordinator 核心协调器:在 review_feedback_evolution.py 中新增该类和辅助数据结构(TaskFeedbackObservationNewSkillPatternObservation),提供 __call__ 处理单任务失败反馈的归因与成员进化、on_team_completed 聚合全局进化,以及重复模式检测后路由到 TeamSkillCreateRail 的完整编排能力。

  • TeamScheduler 反馈分发从平台回调改为核心 Rail 查找scheduler.py 中新增 _review_feedback_rail() 方法,通过 harness 查找 TeamSkillEvolutionRail 并绑定 TeamSkillCreateRail_dispatch_review_feedback_dispatch_team_review_feedback 不再依赖 build_context.extras["review_feedback_handler"],改为调用 Rail 的 handle_review_feedbackfinalize_review_feedback

  • TeamSkillEvolutionRail 扩展以承载 reviewer 反馈进化:新增 configure_review_feedback_evolution() 创建内部 _ReviewFeedbackGlobalSkillEvolutionRailReviewFeedbackEvolutionCoordinator,新增 handle_review_feedback/finalize_review_feedback 作为调度器入口,approve_record/reject_record 中增加了对子 Rail(全局进化 Rail 和 Skill 创建 Rail)审批请求的路由处理,以及 _relay_review_feedback_events 将子 Rail 事件中继到父 Rail 宿主事件队列。

  • 新增 MemberSkillEvolutionRail 与写时复制隔离member_skill_evolution_rail.py 继承 SkillEvolutionRail,在 _handle_evolution_from_signals_evolve_skill_with_sharing 中先调用 _ensure_private_skillmember_skill_workspace.pyensure_member_skill_copy 通过文件锁和原子替换,将全局 Skill 复制到成员私有目录,防止通过符号链接污染全局 Skill。

  • TeamSkillCreateRail 审批事件统一到进化审批通道:将审批源从 "skill_creation_approval" 改为 "skill_evolution_approval",schema 改为 "openjiuwen.skill_evolution_approval.v1",request_id 前缀改为 "team_skill_evolve_create_",并在事件 payload 中新增 evolution_meta 字段携带审批元数据(approval_kindrail_kindsource),使创建审批与进化审批共用同一传输通道。

@openjiuwen-collaboration-bot

openjiuwen-collaboration-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

head_sha: 85e2d7dbdeae2f5063a0acf01f3b51746ce8bea8

代码审查

审查总结

逐文件审查结果

文件 审查结果
openjiuwen/agent_teams/agent/scheduling/__init__.py 无问题 — 正确导出新增符号
openjiuwen/agent_teams/agent/scheduling/review_feedback_evolution.py 1 个 P3 问题(_get_member_trajectorybreak 跳过后备 member_id)
openjiuwen/agent_teams/agent/scheduling/scheduler.py 1 个 P3 问题(_review_feedback_rail() 每次调用重复全量 Rail 发现)
openjiuwen/agent_teams/workspace_layout.py 无问题 — 透传包装函数正确
openjiuwen/harness/rails/__init__.py 无问题 — 正确导入并导出 MemberSkillEvolutionRail
openjiuwen/harness/rails/evolution/__init__.py 无问题 — 正确导入并导出 MemberSkillEvolutionRail
openjiuwen/harness/rails/evolution/member_skill_evolution_rail.py 无问题 — 正确的 copy-on-write 隔离子类
openjiuwen/harness/rails/evolution/member_skill_workspace.py 无问题 — 原子替换 + 锁保护实现正确
openjiuwen/harness/rails/evolution/team_skill_evolution_rail.py 无问题 — 审批路由、事件中继、continuation 管理均正确
openjiuwen/harness/rails/skills/team_skill_create_rail.py 1 个 P2 问题(审批事件 schema/source/request_id 常量变更)
tests/unit_tests/agent_teams/agent/test_review_feedback_evolution.py 无问题 — 测试覆盖 member 演化、全局聚合、重复模式创建、禁用路径
tests/unit_tests/agent_teams/agent/test_team_scheduler.py 无问题 — 测试适配新的 Rail 接口,mock 正确
tests/unit_tests/agent_teams/test_workspace_layout.py 无问题 — 覆盖 unsafe name 拒绝 + copy 替换流程
tests/unit_tests/harness/rails/evolution/test_team_skill_rail.py 无问题 — 覆盖 lifecycle、child events、partial approval
tests/unit_tests/harness/test_team_skill_create_rail.py 无问题 — 断言已同步更新至新的 schema/source/request_id

按优先级统计

  • P0: 0
  • P1: 0
  • P2: 1(审批事件 schema/source/request_id 常量变更,可能破坏外部消费者)
  • P3: 2(break 跳过备选格式、重复 Rail 发现)

整体风险评估

中等风险。核心架构变更(将 reviewer feedback 演化从 platform extras 移到 Core Rail)设计合理,内部逻辑正确。主要风险在于 team_skill_create_rail.py 中审批事件 payload 的 source/approval_schema/request_id 字段值变更——需确保平台前端审批 UI 同步部署,否则审批卡将无法正常显示。两个 P3 问题影响有限,可在后续迭代中优化。

类型 数量
🔴 阻塞 0
🟡 建议 1

💬 仅评论

@openjiuwen-collaboration-bot

Copy link
Copy Markdown

head_sha: 85e2d7dbdeae2f5063a0acf01f3b51746ce8bea8

任务名称 结果 日志操作
静态检查 ❌FAILED 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A

member_skills_dir=self._member_skills_dir,
global_skills_dir=self._global_skills_dir,
skill_name=skill_name,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

head_sha: 85e2d7dbdeae2f5063a0acf01f3b51746ce8bea8

🟡 Medium Priority

changed line: MemberSkillEvolutionRail (新文件 member_skill_evolution_rail.py) 的第 39、52 行在 async 方法 _handle_evolution_from_signals_evolve_skill_with_sharing 中调用了同步方法 self._ensure_private_skill(skill_name)

affected behavior: _ensure_private_skill(第 58-63 行)调用 ensure_member_skill_copy()member_skill_workspace.py),该函数在第 46 行执行 portalocker.Lock(str(lock_path), timeout=30),是一个同步阻塞调用,最长可阻塞 30 秒等待文件锁。此外还有 shutil.copytree() 同步复制整个目录,对大 Skill 目录也可能较慢。

failure mode: 在 asyncio 事件循环中执行阻塞 I/O 会导致事件循环在此期间无法处理其他任务(如心跳、超时、其他成员的进化等)。当多个成员同时触发 Skill 进化时,这些阻塞调用会串行化并阻塞整个事件循环,可能导致超时、任务堆积或服务无响应。

suggested fix: 使用 asyncio.to_thread() 或在执行器中将 ensure_member_skill_copy() 调用卸载到线程池;或者将 MemberSkillEvolutionRail._ensure_private_skill() 改为异步方法并在其中使用 loop.run_in_executor() 执行阻塞 I/O。

建议:将 _ensure_private_skill 改为异步方法,使用 asyncio.to_thread() 将阻塞的 ensure_member_skill_copy() 调用卸载到线程池以避免阻塞事件循环。

@openjiuwen-collaboration-bot

Copy link
Copy Markdown

head_sha: 9f35fb3fc2f6c8f05fece84dd630b7175aad7a24

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A

@openjiuwen-collaboration-bot

Copy link
Copy Markdown

head_sha: b2329dad4fa8c40f0be6ac9f129da60e7803353e

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants