feat: Turn轮次策略解耦为可插拔 Policy Hook#450
Open
benemorphy wants to merge 43 commits into
Open
Conversation
added 30 commits
May 10, 2026 07:07
added 13 commits
May 21, 2026 09:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
将
ga.py中turn_end_callback硬编码的轮次策略(if turn % N == 0连锁)重构为可插拔策略链,保持行为完全一致的前提下,允许外部注册/取消自定义策略。动机
turn_end_callback中硬编码了5个if/elif轮次策略:这些策略与核心流程耦合,新增/修改策略需要修改核心代码,不利于模块化扩展。
改动内容
核心改动
Before (硬编码):
After (可插拔策略链):
每个策略独立为方法:
行为等价性
所有策略的触发阈值、输出内容与重构前完全一致。