Repository navigation
refactor(rollout): isolate rollout utilities and strengthen tests - #439
Conversation
Extract rollout metrics and scale request types into focused modules while preserving existing public import paths. Reapply KL coefficient validation and synchronous PPO normalization after custom YAML configuration overrides. Remove redundant and self-contained tests, exercise the real SFT colocate method and Bridge conversion path, and cover configuration conflicts, metrics, state transitions, and import compatibility. Validation: focused refactor regression suite: 268 passed, 38 skipped. Test cleanup suite: 110 passed, 11 skipped; 13 environment-related failures were also reproduced with the original tests (torchao/PyTorch mismatch and missing TransferQueue interfaces). Multi-node GPU integration was not run.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Thanks for contributing to Relax, @NINGBENZHE! 感谢你为 Relax 做出贡献! 📚 Contribution guide / 贡献指南Describe the problem, your changes, and how you validated them. Keep each PR focused and run 请说明问题、改动和验证方式,保持 PR 聚焦,并在提交前运行 🛠️ CI commands / CI 指令
Put one command on the first line of a new PR comment. Rerun/cancel require PR authorship or repository write access. 在新 PR 评论的首行写一条指令。PR 作者或有仓库写权限的贡献者可以重跑、取消 CI。 🔎 Merge requirements / 合入条件GitHub:✅ 满足合入条件
|
Nyanpasu 审查看板审查状态: 💬 已完成 · 有补充意见 审查版本: a9681c2 目标分支: main 审查完成:无阻塞性问题。生产改动(两处纯搬迁抽取 + arguments.py YAML 覆盖后校验重跑)经实测验证无正确性缺陷;删除测试均有存活归属。唯一发现 F1(P2,colocate 测试用纯字符串模拟角色、str(角色) 渲染契约失去存活覆盖)已由作者在 a9681c2 修复:测试改为用 registry 源码中的真实枚举成员驱动门控(stdlib StrEnum 与 pre-3.11 fallback 双路径参数化),并补齐 _validate_gpu_resources 第三位置参数与 _actor_rollout_pg_roles 转发断言;经变异实验验证检出力(移除 fallback __str__ 后用例按预期失败)。另在 review 备注中说明 PR 勾选的「Refactoring (no functional changes)」与实际的 YAML 校验收紧不符。多节点 GPU 集成测试未运行(作者已说明)。
审查发现待处理
已解决或已取代
提交范围 · 接收 22 · 建议移出 0 · 待确认 0接收 22 个文件 · 建议移出 0 个文件 · 待确认 0 个文件。移出与待确认部分暂停深审,不代表审查通过。
精简审查与验证依据
生产代码的必要性与替代方案
测试的必要性与替代方案
Powered by Nyanpasu with glm-5.3-flash max, please check the suggestions carefully.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rai-studio-bot
left a comment
There was a problem hiding this comment.
审查结论:常规与深度审查完成,无阻塞性问题
本次范围覆盖全部 22 个变更文件。生产改动为两处纯搬迁抽取(rollout 扩缩容请求类型、rollout 指标统计)与 relax/utils/arguments.py 在 YAML 覆盖后重跑 KL 系数校验及同步 PPO 归一化:re-export 身份与 pickle 协议 0 兼容、旧导入路径、import 纯净性均已实测验证,未发现正确性缺陷;删除的测试经逐一核对与变异实验确认均有存活归属,重写用例对本次要堵的洞有实测检出力。唯一发现是新增 colocate 判定测试对枚举渲染契约的检出力缺口(P2,见行内评论)。分组索引与验证依据见审查看板。
非行级备注:PR 勾选的「Refactoring (no functional changes)」与实际行为不符——--custom-config-path 此前可绕过的校验现在会告警或直接报错,属于校验收紧,建议在描述中更正或说明。
Drive the actual colocate gate with role enums from the registry source, covering both standard StrEnum and the pre-3.11 fallback without loading backend components. Assert placement-group role forwarding as well. Validation: four test cases pass; mutation checks detect broken enum rendering, missing fallback __str__, and incorrect placement-group roles.
rai-studio-bot
left a comment
There was a problem hiding this comment.
复审结论:a9681c21 已修复 F1,无阻塞性问题
本轮针对 synchronize 后的新提交 a9681c21 test(core): restore colocate enum rendering coverage 复审。生产代码与本轮此前审查的 24d35bd1 逐字节一致,此前的全部结论(抽取契约保全、YAML 覆盖后校验重跑可达且顺序一致、删除测试均有存活归属、必要性审计)原样成立。
F1(P2)已解决
新增 colocate 判定测试此前用纯字符串模拟角色,str(角色) 渲染契约失去存活覆盖。a9681c21 的修复已在 F1 线程中独立验证:
- 用例改为从
relax/core/registry.py源码经 AST 提取真实枚举定义执行(不导入 Ray Serve 组件),并参数化 stdlibStrEnum与 pre-3.11 fallback 两条渲染路径;提取范围核对无误(顶层仅一个Try+ 一个enumImportFrom + 两个目标 ClassDef)。 - 变异实验:移除 fallback
__str__后,仅fallback-strenum两个用例在渲染断言处按预期失败,stdlib-strenum不受影响——原缺口((str, Enum)缺__str__时静默关闭 colocate)现在可被检出。 - 同时补齐了
_validate_gpu_resources第三位置参数(pg_roles)与_actor_rollout_pg_roles转发断言。
F1 线程已由作者标记 resolved,本 Bot 已在原线程附上验证证据(讨论)。
其余范围
未变动,详见此前审查与状态板。两点既存备注仍然有效:PR 勾选的「Refactoring (no functional changes)」与实际的 YAML 校验收紧不符,建议更正;多节点 GPU 集成测试未运行(作者已说明),test_dcs_weight_conversion.py 与 test_rollout_import_compatibility.py 依赖 megatron.core,本地无法执行,由 CI 验证。
状态板已更新至第 4 版(F1 → resolved):#439 (comment)
| import sys | ||
| from types import SimpleNamespace | ||
|
|
||
| class NoRuntimeImports(importlib.abc.MetaPathFinder): |
…rence Resolve conflicts with upstream redai-studio#433 (managed PD), redai-studio#437 (native image OPD), redai-studio#439 (rollout utility extraction), redai-studio#361 (multinode scale-out) and the placement factory relocation, porting their intent onto InferenceManager. - Managed static PD: start_servers defers the Router until P/D engines are ready and seeds it with them; replacements still join after weight sync. - Recovery broadcasts rank-0 failures before weight sync; pool monitors stop within one shared 5s budget; Controller bounds shutdown_all to 35s. - Teacher engines get SGLANG_MM_AVOID_RETOKENIZE in config_adapters; the removed RELAX_OPD_PREEXPANDED_PATCH reference is dropped. - Drop RolloutManager/TeacherManager-only code and tests; adapt new upstream tests to EngineGroupSpec/InferenceModelSpec and the inference manager.
…rence Resolve conflicts with upstream redai-studio#433 (managed PD), redai-studio#437 (native image OPD), redai-studio#439 (rollout utility extraction), redai-studio#361 (multinode scale-out) and the placement factory relocation, porting their intent onto InferenceManager. - Managed static PD: start_servers defers the Router until P/D engines are ready and seeds it with them; replacements still join after weight sync. - Recovery broadcasts rank-0 failures before weight sync; pool monitors stop within one shared 5s budget; Controller bounds shutdown_all to 35s. - Teacher engines get SGLANG_MM_AVOID_RETOKENIZE in config_adapters; the removed RELAX_OPD_PREEXPANDED_PATCH reference is dropped. - Drop RolloutManager/TeacherManager-only code and tests; adapt new upstream tests to EngineGroupSpec/InferenceModelSpec and the inference manager.

What
Extract rollout metrics and scale request types, tighten KL configuration validation, and simplify tests.
Why
Reduce module coupling, catch conflicting YAML overrides, and replace redundant tests with meaningful regression coverage.
How
Preserve existing import paths, centralize KL checks, and test actual production logic—including enum rendering and colocate decisions.
Testing
268 regression tests and 4 enum/colocate cases passed. Full pre-commit passed. Runtime-dependent checks were skipped; broader testing reproduced 13 existing environment failures. Multi-node GPU integration was not run.
pre-commit run --all-filespassespytest tests/)Type of Change
Screenshots / Logs