Skip to content

【No.3】feat(inference): unify Rollout, GenRM, and Teacher service - #356

Closed
Arazyu wants to merge 60 commits into
redai-studio:mainfrom
Arazyu:codex/rfc71-unified-inference-service
Closed

Arazyu wants to merge 60 commits into
redai-studio:mainfrom
Arazyu:codex/rfc71-unified-inference-service

Conversation

@Arazyu

@Arazyu Arazyu commented Sep 22, 2026 •

Copy link
Copy Markdown

Summary

Implements the RFC #71 unified inference service scope for Rollout, GenRM, and Teacher, with integration of GenRM elastic scaling from #370.

  • Add the CPU-only InferenceGateway, shared InferenceManager/lifecycle, placement planner, routing schema, and compatibility client.
  • Validate decoupled, split, and defer placement before startup, with shared drain/offload/onload and deferred Teacher writeback.
  • Preserve static-model protection, logical-head discovery, legacy interfaces, PG ownership, and rollback semantics.
  • Add CPU/GPU tests, validation launchers, and bilingual interface and usage documentation.

GenRM integration

Commit 36ee4ba8edca29fcf6d1d563eaabc503842b5512 integrates #370 at da4acbbab530f082f37c1633c811c704be5a044e into the previous #356 head, 9eec00a186b4b92f32dc2aba9c23e673e2375b13. This PR now includes #370's implementation and original commit history, together with the compatibility fixes:

  • Route canonical discovery and legacy clients through the same published engine states; exclude candidates, draining engines and retired slots from admission.
  • Preserve legacy GenRM sampling and response attribution through the shared gateway. Count raw and streaming requests through completion, and bind closed admission to engine identity so recovered engines can reuse retired addresses.
  • Preserve split placement offsets and shared Teacher PG ownership. Retain owned PGs until Ray confirms REMOVED, reconcile unfinished cleanup, and create a fresh PG when recovering a failed elastic engine.
  • Reject deferred sharing, training-offload pools (--offload-rollout) and multi-GPU elastic engines before taking the training lifecycle lock or allocating resources.
  • Preserve global sglang_* tuning inheritance without overriding GenRM role defaults; per-model engine configuration keeps priority. Cover this contract in CPU tests that do not require SGLang.
  • Update the English/Chinese GenRM and Rollout API documentation and regenerate the GenRM OpenAPI schema.

Elastic scaling retains #370's scope: single-GPU elastic engines and drain accounting within one Gateway. Consistent direct-client routing does not establish direct-client or cross-Gateway graceful drain. Pools that participate in training offload do not support live elastic scaling in this integration.

Acceptance evidence

The following are previously reported results from before the integration with #370. They have not been rerun after integration with #370 and do not establish GPU acceptance of the integrated head:

  • Contract suite: 91 passed, 1 skipped; the skip was the Ray-only port allocator check on a workstation without Ray.
  • GPU allocation 6654867: PP/PD routing and complete Megatron data flow passed.
  • GPU allocation 6772050: four-node split training passed, including Teacher writeback before GenRM and completed Megatron steps.
  • GPU allocation 6780723: four-node decoupled training passed, including Teacher results before training and dynamic Rollout updates.

Evidence inherited from #370 and demos/task4_genrm/ likewise belongs to its original producing revisions, not a new integration run.

The public API pages document the unified inference interfaces and usage:

  • docs/en/api/inference.md
  • docs/zh/api/inference.md

Validation

Current head: 0e1b7228bf3f058e9cca8e16bdea43357f9f2e5d.

The current follow-up isolates the test-only SGLang import bridge: module-cache and parent-package bindings are restored on both success and failure, while an available runtime is imported unchanged. The isolation regressions passed 9 tests; the combined manager/precheck run passed 31 tests with 20 missing-SGLang skips and 5 passing subtests. These counts overlap. All pre-commit hooks passed before committing. The current head requires fresh remote CI results.

Remote validation on the preceding functional head bf354e7:

The following functional regression results were also collected on bf354e7. Local environment: macOS arm64, Python 3.12.13, Ray 2.59.0, pytest 9.1.1, CPU only. Python commands ran through uv in a temporary test environment.

Validation Result
Unified inference, engine/Teacher lifecycle, GenRM routing/scaling, watcher, registry and Autoscaler regressions 454 passed, 4 skipped, plus 5 passing subtests
Engine lifecycle and SGLang argument contracts, included in the preceding suite 31 passed, including global tuning inheritance, override precedence and static-model defaults
pre-commit run --all-files All hooks passed

The four skips concern an unavailable Rollout import. The suite uses the existing test-only import bridges for unavailable optional dependencies; the argument regressions execute the production builder with a minimal supported ServerArgs schema and do not require an installed SGLang runtime. Broader local CPU testing remains incomplete because this macOS environment lacks some Linux/runtime dependencies; it is not reported as a full-suite pass. Multi-node GPU acceptance has not been rerun after the integration; remote CI results must be assessed on the current head separately.

The GenRM routing tests now consume canonical discovery snapshots and verify immediate admission changes, round-robin continuity and recovery. The watcher regression injects the exception at the processing boundary without a real deadline wait. Registry tests cross reduced test-only capacity limits repeatedly and verify eviction while protecting live and dirty records; production limits and CI timeouts are unchanged.

The VitePress documentation build passed on integration commit 36ee4ba; the subsequent fixes do not modify documentation.

Test commands

TEST_PYTHON is the Python executable in the temporary test environment.

uv run --no-project --python "$TEST_PYTHON" python - <<'PYTEST'
from tests.utils._dep_stubs import import_genrm_component
import_genrm_component()
import pytest
raise SystemExit(pytest.main([
    '-q', 'tests/inference',
    'tests/distributed/ray/test_multi_engine_manager.py',
    'tests/distributed/ray/test_genrm_scale_placement.py',
    'tests/distributed/ray/test_teacher_manager.py',
    'tests/distributed/ray/test_teacher_manager_factory.py',
    'tests/components/test_genrm_engine_pick.py',
    'tests/components/test_genrm_scale_endpoints.py',
    'tests/components/test_genrm_scale_watcher.py',
    'tests/utils/test_genrm_scale_registry.py',
    'tests/utils/autoscaler',
    'tests/backends/megatron/test_model_provider_vpp.py',
    '--disable-warnings', '--tb=short', '-ra',
]))
PYTEST

uv run --no-project --python "$TEST_PYTHON" python -m pytest \
  tests/inference/test_engine_contract.py -q --tb=short
uv run --no-project --python "$TEST_PYTHON" python -m pytest -q \
  tests/utils/test_dep_stubs.py \
  tests/distributed/ray/test_genrm_scale_placement.py \
  tests/distributed/ray/test_scale_weight_sync_precheck.py --tb=short
uv run --no-project --python "$TEST_PYTHON" pre-commit run --all-files

Refs #71, #351; integrates #370.

# ⭐ Feature

## Share the inference control plane

- Add the CPU-only gateway, common manager, lifecycle coordinator, placement planner, routing schema, and compatibility client for Rollout, GenRM, and Teacher.
- Validate split, defer, decoupled placement and reject same-phase co-residency before startup.
- Coordinate drain, offload, onload, deferred Teacher publication, and dynamic Rollout updates without changing role workloads.

---

# ✅ Tests

## Cover RFC redai-studio#71 contracts and GPU workflows

- Add CPU tests for routing, discovery, placement, lifecycle rollback, PG ownership, static-weight protection, legacy clients, and deferred publication.
- Add opt-in PP/PD topology and three-role GPU integration tests and validation launchers.
- Record passing split and decoupled multi-node training evidence in the bilingual validation guide.

---

# 📝 Documentation

## Document the acceptance evidence

- Add English and Chinese API and validation guides with reproducible commands and acceptance mapping.
- Keep the scope limited to the explicit RFC redai-studio#71 acceptance checks.
@rai-studio-bot

rai-studio-bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Nyanpasu 审查看板

审查状态: ✅ 已通过

审查版本: cb6f63e

目标分支: main

完成 cb6f63e 五文件增量复查:缺配置时静态 Teacher 清理可继续,四组回归与 readiness、SFT 可选角色、logical-head 和资源清理契约一致;指定 CPU 用例通过,未发现新增问题。117 个未变文件沿用前序已审证据。拆分复核覆盖 122 文件,新增差异全部归 A,A→B→C 边界保留。当前头仅三项辅助检查有通过结果,尚无 GPU 单测与训练集成结果;本地缺少 GPU/多节点硬件,未执行相应集成。

审查阶段进度范围与结果
常规审查 ✅ 已完成 122 文件全部受理;完成 498087c..cb6f63e 全部五文件增量与调用核对。生产仅一行缺配置保护;上一头 11 个失败用例均对应本次四组测试契约修正。F1–F6 修复保持,未发现新增问题。
深度审查 ✅ 已完成 指定 missing_config 回归通过(1 passed),执行真实 Controller 方法、替换 Ray 与外部清理;源码核对四组回归的独立预期与调用。117 个未变 blob 复用前序证据,无重复测试。缺少 GPU/多节点硬件,未验证真实后端、NCCL、PD/HiCache 或资源释放。

审查发现

待处理
编号 严重性 问题状态规则来源
暂无待处理的记录。
已解决或已取代
编号 严重性 问题状态规则来源
F1 Medium severity 首次异步权重同步后未发布网关就绪状态 ✅ 已解决 —
F2 Medium severity 同步更新旧握手测试的 Manager 替身 ✅ 已解决 —
F3 Low severity 更新 PR 描述中的验收资料引用 ✅ 已解决 —
F4 Medium severity GenRM 引擎丢失全局 sglang_* 参数继承 ✅ 已解决 —
F5 Medium severity 路由清理尚未完成时 dispose 失去重试能力 ✅ 已解决 —
F6 Medium severity Teacher 继承学生 indexer replay,特定拓扑启动失败 ✅ 已解决 RFC #71:隔离静态模型与 Rollout 参数

改进建议(非阻塞)

拆分

💡 1 个拆分方案

建议保留 A→B→C 的非阻塞拆分:统一推理及安全生命周期保持完整,手动 GenRM 弹性和分服务 Autoscaler 各有独立验收且存在真实依赖。本次五文件增量全部归 A,未改变原边界;22,460 行本身不是强制拆分理由。

箭头表示前置部分 → 后续部分;目标分支为 main。

flowchart LR
    target["目标分支"]
A["PR A"]
target --> A
B["PR B"]
A --> B
C["PR C"]
B --> C
Loading
部分PR 主题内容与范围验证
A 统一推理与安全生命周期 统一 inference、Gateway/client/ports、固定 GenRM 池、Rollout/Teacher/OPD、Actor/Controller/Service、DCS 与 NPU provider,携带对应测试、hpc 脚本、中英文档及 OpenAPI 迁移。混合文件只取通用契约并保留兼容构造器及主线 PD/S3/offline 适配,本次 config 缺失保护与四个回归更新全部归本层。 验证静态模型隔离、参数优先级、logical-head/PD 路由、清理重试、启动回滚、权重就绪及四个更新回归。拆分后重跑对应契约,并在具备硬件时验证多节点 split/defer/decoupled 与训练前 Teacher 写回。
B GenRM 手动弹性扩缩 加入 scale registry、GenRM scale/status/reconcile/容量、弹性 PG、Gateway 准入和流式完成计数及确定性采样,复用 A 的生命周期和清理原语。混合源码与 fixture 仅追加弹性及确定性 hunks,携带相应测试、genrm 脚本、非 Autoscaler demos/results、README/EVIDENCE 对应段和中英 API,并重生 GenRM OpenAPI。 验证单 Gateway、单 GPU、非 training-offload 池的带载 1→2→1、候选准入、raw/chat/SSE 排空、超时/reconcile、PG 回收、评分一致性和训练继续。保留历史证据的产出 SHA,不能据此宣称新头或直连及跨 Gateway 排空已验收。
C 分服务自动伸缩 迁移全部 Autoscaler 差异与测试,并带上 Rollout 两个 status response 的 cleanup_required、响应模型测试、中英清理契约及 rollout.json。携带 Autoscaler/Rollout 导入桩、identity-window fixture 保护、两个自动伸缩 driver、预注册及结果文件和 README/EVIDENCE 对应段,三层合成须保留固定头全部内容。 验证旧 Rollout 兼容、双服务策略与循环隔离、指标有效性、未知提交恢复、dirty cleanup、热配置及 monitor。随后验证预注册负载和闲置 GPU 回收,并核对三层合成树与固定头一致。
如何按依赖提交(stack)

只读 GitHub 元数据再次确认作者 Arazyu 为 FIRST_TIME_CONTRIBUTOR,head 为 Arazyu/Relax、base 为 redai-studio/Relax,作者上游权限查询返回 read。

先按表重组混合提交,每部分携带对应测试和文档;逐层验证,并核对顶层最终树与原 PR 一致。独立部分各自向目标分支开普通 PR;只将有依赖的线性链组成 stack,分叉或多前置依赖按图分别安排提交。

Fork 贡献者: 分支保留在 fork,先将底层向上游目标分支提交;上层暂留本地,或在 fork 内以其前置分支为 base 开 draft PR。底层合入后,只将上层独有提交 rebase 到更新后的上游目标分支,再提交下一层;若底层被 squash,注意排除其旧提交。

Fork 内 PR 只用于增量审阅;上游 PR 的 base 不能指向 fork 独有分支。多个累计 PR 同时指向上游目标分支会包含重复差异。GitHub 原生 stack 要求所有分支位于同一仓库。

相关 PR

💡 实现与合入建议

#347、#368、#381 与本 PR 的 RFC #71 核心行为实质重叠,应由维护者选择一个核心并迁移独有行为;它们均不能直接全量替换 #356 已集成的 #370 弹性功能。

https://github.com/redai-studio/Relax/pull/347 · 62ae8c1f2ae6f1e35a40b15f61ce35f4bf4f70f5 · 目标分支 main

https://github.com/redai-studio/Relax/pull/368 · 9f5cae1a365c0e559c0c68ceddc6b5f55c613f03 · 目标分支 main

https://github.com/redai-studio/Relax/pull/381 · e29cc71324c6dd0c97d7f23f18fae96fe92f3ab9 · 目标分支 main

实现取舍: 保留既有 facade 并同时交付 GenRM 弹性时,可选择 #356;严格 defer 的提交门控可借鉴 #347 在 TQ put/finalizer 后 commit 的设计。若本轮要完成 engine ownership 与 workload 分离,#381 的任务级 Manager 和共用请求 executor 更完整,但涉及 discovery v2、旧 manager/具名 actor/handles 迁移。#368 的 EnginePool 与 characterization 测试可供比较,当前仍为 draft。现有证据不支持仅凭体量或历史 approval 选唯一实现。

当前 PR 调整: 无论选哪一核心,都保留 #356 的静态模型/权重隔离、logical-head/PD 路由、Teacher 写回和 #370 的幂等伸缩、单 Gateway 请求计数、候选/退役准入与 PG 回收。若采用 #381 的 executor,合并 legacy/raw 两条执行协议时仍须保留 sampling/chat-template/response 适配;不能只按测试名称去重。

合入顺序: 相关 PR 无必须先合入的技术依赖;#370 已在本 PR,PD #433 和 HiCache #442 已在 main。维护者可先落聚焦且独立可用的核心,后续广泛重构 rebase 并删除重叠实现;也可先落更完整的统一核心,再将本 PR 缩为 GenRM 弹性与必要适配。前者降低单次迁移范围但增加适配轮次,后者减少过渡代码但需要更广验收;不能直接丢弃 #370 的独有行为。

依据与验证范围: 498087c 仅修复既有清理/Teacher 隔离缺陷,未改变相关核心边界;父级据此复核并沿用已完成比较。依据 RFC #71 https://github.com/redai-studio/Relax/issues/71、各自固定 diff/调用链/测试定义、#347 提交门控 https://github.com/redai-studio/Relax/blob/62ae8c1f2ae6f1e35a40b15f61ce35f4bf4f70f5/relax/inference/defer.py#L286 与 #381 共用执行器 https://github.com/redai-studio/Relax/blob/e29cc71324c6dd0c97d7f23f18fae96fe92f3ab9/relax/engine/inference/executor.py#L114。发布前重新核对三 PR 仍 open、head/base/merge-base 未漂移;未执行跨实现 GPU/NCCL 性能或完整训练比较,非阻塞建议不构成正确性全覆盖。

提交范围 · 接收 122 · 建议移出 0 · 待确认 0

接收 122 个文件 · 建议移出 0 个文件 · 待确认 0 个文件。移出与待确认部分暂停深审,不代表审查通过。

文件结论仓库维护必要性依据替代去向或方案
relax/inference/__init__.py
relax/inference/lifecycle.py
relax/inference/manager.py
relax/inference/placement.py
relax/inference/routing.py
relax/distributed/ray/inference_ports.py
relax/utils/inference_client.py
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 RFC #71 统一推理服务验收范围;controller 启动路径与 Rollout/GenRM/Teacher 服务为既有调用方,前几轮已核对生产调用链。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
relax/components/genrm.py
relax/components/inference_gateway.py
relax/distributed/ray/genrm.py
relax/distributed/ray/multi_engine_manager.py
relax/distributed/ray/teacher_manager.py
relax/components/rollout.py
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 集成提交 36ee4ba 的 --cc 解析内容与 PR 描述列出的兼容修复;两侧(#356 统一推理、#370 弹性扩缩容)都改动了这些文件。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
relax/utils/autoscaler/autoscaler_service.py
relax/utils/autoscaler/config.py
relax/utils/autoscaler/metrics_collector.py
relax/utils/autoscaler/monitor.py
relax/utils/autoscaler/scaling_decision.py
relax/utils/genrm_scale_registry.py
relax/backends/sglang/sglang_engine.py
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 PR #370(GenRM 弹性扩缩容与自动伸缩)经集成提交并入本 PR;#370 评审线程为其规范讨论。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
relax/backends/megatron/actor.py
relax/backends/megatron/model_provider.py
relax/components/actor.py
relax/core/controller.py
relax/core/service.py
relax/distributed/checkpoint_service/backends/device_direct.py
relax/distributed/ray/multi_instance_orchestrator.py
relax/distributed/ray/rollout.py
relax/engine/rollout/on_policy_distillation.py
relax/engine/rollout/sglang_rollout.py
relax/utils/arguments.py
relax/utils/opd/opd_utils.py
relax/utils/utils.py
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 RFC #71 与既有调用链;前几轮已逐项核对并批准,本回合这些文件相对 9eec00a 字节一致。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
scripts/training/hpc/run-unified-inference-2gpu.sh
scripts/training/hpc/run-unified-inference-3role.sh
scripts/training/hpc/unified_inference_reward.py
scripts/training/genrm/run-qwen3-0.6B-4xgpu-genrm-continuity.sh
scripts/training/genrm/run-qwen3-0.6B-4xgpu-genrm-smoke.sh
demos/task4_genrm/contract_demo.py
demos/task4_genrm/e2e_autoscaler_load.py
demos/task4_genrm/e2e_autoscaler_preregistered.py
demos/task4_genrm/e2e_failure_injection.py
demos/task4_genrm/e2e_genrm_scale.py
demos/task4_genrm/e2e_reward_consistency.py
demos/task4_genrm/e2e_sampling_divergence.py
demos/task4_genrm/e2e_train_continuity.py
demos/task4_genrm/probe_sglang_serve.py
demos/task4_genrm/render_demo.py
demos/task4_genrm/README.md
demos/task4_genrm/README_zh.md
demos/task4_genrm/test_contract_demo.py
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 PR 描述与 demos/task4_genrm/README;#370 评审线程为演示内容的规范讨论。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
demos/task4_genrm/EVIDENCE.md
demos/task4_genrm/results/autoscaler_prereg_v2_20260925_r5/verdicts.json
demos/task4_genrm/results/autoscaler_preregistration_20260925.md
demos/task4_genrm/results/autoscaler_preregistration_v2_20260925.md
demos/task4_genrm/results/autoscaler_run_20260924_v3/verdicts.json
demos/task4_genrm/results/b2_train_smoke_20260925/verdicts.json
demos/task4_genrm/results/b2_train_smoke_20260925_r2/verdicts.json
demos/task4_genrm/results/b2_train_smoke_20260925_r3/verdicts.json
demos/task4_genrm/results/e2e_run_20260924/verdicts.json
demos/task4_genrm/results/failure_injection_20260925_r2/verdicts.json
demos/task4_genrm/results/reward_consistency_20260925_r2/verdicts.json
demos/task4_genrm/results/reward_consistency_20260925_r3/verdicts.json
demos/task4_genrm/results/sampling_divergence_20260925_r3/verdicts.json
demos/task4_genrm/results/train_continuity_20260925_r4/verdicts.json
demos/task4_genrm/results/train_continuity_20260925_r5/verdicts.json
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 #370 的验收证据策略与 demos/task4_genrm/EVIDENCE.md;.gitignore 新增排除规则。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
tests/components/test_genrm_scale_endpoints.py
tests/components/test_genrm_scale_watcher.py
tests/components/test_scale_response_models.py
tests/distributed/ray/test_genrm_scale_placement.py
tests/distributed/ray/test_teacher_manager.py
tests/backends/sglang/test_sglang_engine.py
tests/utils/_dep_stubs.py
tests/utils/autoscaler/test_autoscaler_service.py
tests/utils/autoscaler/test_metrics_validity.py
tests/utils/autoscaler/test_monitor_service_view.py
tests/utils/autoscaler/test_scaling_decision.py
tests/utils/autoscaler/test_service_targets.py
tests/utils/data/test_identity_window_sampler.py
tests/utils/test_genrm_scale_registry.py
tests/utils/test_dep_stubs.py
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 PR #370 的测试族经集成提交并入;#370 评审线程为规范讨论。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
tests/inference/test_engine_contract.py
tests/distributed/ray/test_multi_engine_manager.py
tests/components/test_genrm_engine_pick.py
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 集成提交 36ee4ba 的 --cc 测试解析;对应 relax/components/inference_gateway.py 与 relax/distributed/ray/multi_engine_manager.py 的兼容修复。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
tests/inference/test_control_plane.py
tests/inference/test_deferred_pipeline.py
tests/inference/test_genrm_gateway_compatibility.py
tests/inference/test_rollout_contract.py
tests/inference/test_training_startup.py
tests/inference/test_validation_scripts.py
tests/inference/test_weight_update_transport.py
tests/integration/test_unified_inference_gpu.py
tests/integration/test_unified_inference_topology_gpu.py
tests/examples/test_unified_inference_reward.py
tests/backends/megatron/test_model_provider_vpp.py
tests/backends/sglang/test_genrm_offload_drain.py
tests/components/test_rollout_weight_update_handshake.py
tests/core/test_controller_s3_model_cleanup.py
tests/core/test_service_affinity.py
tests/distributed/ray/conftest.py
tests/distributed/ray/test_opd_multi_teacher_orchestration.py
tests/distributed/ray/test_opd_teacher_controller_colocate.py
tests/distributed/ray/test_utils.py
tests/engine/rollout/test_on_policy_distillation_payload.py
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 PR 描述的 CPU/GPU 测试范围与前几轮已核对结论;本回合这些文件相对 9eec00a 内容一致或仅并侧保留。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
docs/.vitepress/config.mts
docs/en/api/genrm.md
docs/en/api/inference.md
docs/en/api/rollout.md
docs/zh/api/genrm.md
docs/zh/api/inference.md
docs/zh/api/rollout.md
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 PR 描述列出的文档页;集成提交在两种语言中记录支持范围与限制。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
docs/public/openapi/genrm.json
docs/public/openapi/rollout.json
scripts/tools/generate_openapi.py
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 集成提交重新生成 GenRM OpenAPI;scripts/tools/generate_openapi.py 为其生成器。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
.gitignore
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 集成提交新增的忽略规则;demos/task4_genrm/results/ 仅保留最终判定文件。 保留现有职责目录;本轮未出现要求迁移这些既有文件的新证据。
relax/distributed/ray/placement_group.py
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 RFC #71 split/defer 放置及既有 Ray placement group 调用。 沿用主线 placement_group.py 工厂而非重复实现。
tests/backends/sglang/test_router_registration.py
tests/core/test_pd_disposal.py
接收 沿用已审 7d981ed 的仓库放置判断;本轮仅清理重试、Teacher 标志隔离及对应回归测试增量,路径职责与验收范围不变。 主线 PD 管理与本 PR SGLangEngine profile 统一入口。 保留原测试位置并同步接口契约。
tests/backends/megatron/test_actor_rollout_recovery.py
tests/core/test_controller_sft_colocate.py
tests/distributed/ray/test_engine_metadata.py
tests/entrypoints/test_startup_failure.py
接收 主线合并后既有回归需对齐统一推理 readiness、SFT 角色与 logical-head 契约。 RFC #71;Megatron 权重更新及 Controller 启动/清理的现有调用。 沿用所属模块的持久回归测试位置,无需引入独立验证入口。
Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

已完成审查,有一项非阻塞的启动就绪问题,详见行级评论。

本地 CPU 契约测试为 91 通过、1 跳过;未发现需要阻塞合并的问题。GitHub 暂无 CI 检查记录,完整训练及多节点 GPU 验证未在本机复跑。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

complete
and group.lifecycle_status == EngineGroupLifecycle.ACTIVE
and not self._is_weight_updating
and self._policy_weights_ready.get(name, False)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 优先级:P2

请在纯 fully-async 的首次权重同步成功后发布就绪状态。包含 Actor 的默认模型初始为 False,但 Controller 启动时调用的 Actor.update_weights_fully_async → MegatronTrainRayActor.update_weights_fully_async 只完成 DCS 传输,没有更新此标志;目前异步路径要等首次训练后的 /end_update_weight 才设为 True。因此首次同步已成功、引擎可用时,/rollout/generate、/rollout/v1/chat/completions 和新客户端仍会返回 503。建议在初始同步确认成功后解除门控,并补充“首次训练前即可通过网关生成”的回归测试;失败同步仍应保持不可用。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

已确认在 4335eab 修复。Actor 在等待全部训练 worker 的初始异步同步成功后发布 Rollout 就绪状态;同步异常和 actor_fwd-only 分支不会发布。已核对启动调用链,并复跑 CPU 契约测试:94 通过、1 跳过。F1 已解决。

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

复查通过:此前的启动就绪问题已修复,本轮增量未发现新的审查问题。CPU 契约测试 94 通过、1 跳过(缺少 Ray);GitHub 暂无 CI 检查记录,本机未复跑多节点 GPU 验证。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

@Arazyu

Arazyu commented Sep 22, 2026

Copy link
Copy Markdown
Author

@SigureMo 任务已完成,请求 review。

@SigureMo SigureMo changed the title feat(inference): unify Rollout, GenRM, and Teacher service 【No.3】feat(inference): unify Rollout, GenRM, and Teacher service Sep 22, 2026

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

新到达的 CI 结果确认了一项测试替身兼容性回归,详见行级评论;此前 F1 仍已解决。本次补充意见不要求阻塞合并。

Pre-commit 检查 也因 ruff-format、docformatter 修改文件而失败,需要应用格式化结果。GPU 检查仍在运行。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

await self._weight_update_ready.wait()

self.status = "running"
await self.rollout_manager.set_policy_weights_ready.remote(True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 优先级:P2

新增 RPC 后需要同步更新 tests/components/test_rollout_weight_update_handshake.py 的 _ManagerStub。它目前仅提供 health_monitoring_pause 和 set_weight_updating,因此现有 test_end_update_weight_does_not_block_after_failed_can_do 在此处抛出 AttributeError: '_ManagerStub' object has no attribute 'set_policy_weights_ready'。此提交的 Python 3.11 CI 已复现该失败(458 通过、47 跳过后停止)。请给替身补充可等待的就绪 RPC,并保留故障后恢复握手的原有断言;新增的 inference 契约测试没有覆盖这个旧测试调用链。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

已确认 c519b19 修复 F2:测试替身补充了可等待的就绪 RPC,原有故障恢复断言保留。由于本机缺少 Ray,我提取生产方法并隔离 Ray 导入边界,执行该文件的 6 项握手测试,全部通过;CPU inference 契约测试另有 94 通过、1 跳过。完整 CI 仍需以新提交结果为准。

# 🐛 Bug Fix

## Keep weight readiness test doubles compatible

- Add the rollout readiness RPC to the handshake manager stub.
- Preserve failed synchronization behavior while allowing successful resume.

---

# 🎨 Style

## Apply required CI formatting

- Apply the repository's ruff and docformatter output to touched Python files.
@Arazyu

Arazyu commented Sep 22, 2026

Copy link
Copy Markdown
Author

@rai-studio-bot review

@Arazyu

Arazyu commented Sep 22, 2026

Copy link
Copy Markdown
Author

@SigureMo 不好意思,只验证了rai-studio-bot,忘记检查CI了,我先修复下CI错误

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

复查通过:F1、F2 均已解决,本轮其余变更仅为格式化,未发现新增问题。

CPU 契约测试 94 通过、1 跳过;隔离 Ray 导入边界后的 6 项握手测试通过。新提交暂未显示 CI 结果,本机未复跑多节点 GPU 验证。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

Comment thread docs/.vitepress/config.mts Outdated
{ text: 'Distributed Checkpoint', link: '/zh/guide/distributed-checkpoint' },
{ text: '健康检查管理器', link: '/zh/guide/health-check-manager' }
{ text: '健康检查管理器', link: '/zh/guide/health-check-manager' },
{ text: '统一推理服务验收记录', link: '/zh/guide/unified-inference-validation' }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

先自己检查一下代码吧,比如这个应该是要提交上来的吗?

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

已复核当前提交 c519b19:与上次审查相同,F1、F2 仍已解决,未发现新增代码问题。

Pre-commit 已通过,Python 3.10–3.12 及 GPU 检查仍在运行。此前本地结果为 94 通过、1 跳过,以及隔离 Ray 导入后的 6 项握手测试通过,不能替代完整 CI。

还需回应维护者关于验收记录进入正式文档的意见,确认文档范围;此前代码审查通过不代表该意见已解决或 PR 已满足合并条件。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

# 🐛 Bug Fix

## Preserve legacy engine discovery and startup fixtures

- Keep `get_engines_info()` compatible with managers created without the unified inference manager.
- Update the startup cleanup fixture for the fully async weight-update arguments and metrics state.

---

# 📝 Documentation

## Keep the public inference API focused

- Remove internal acceptance reports and experiment details from the public API docs.
- Move shared inference links into the related lifecycle and placement sections.

---

# 🔩 Chore

## Remove private validation wrappers

- Delete one-off cluster scripts containing site-specific paths and runtime settings.
@Arazyu

Arazyu commented Sep 22, 2026

Copy link
Copy Markdown
Author

@rai-studio-bot

@rai-studio-bot rai-studio-bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

本轮代码兼容性修复及文档清理未发现新增运行时问题;F1、F2 仍已解决。CPU 契约测试 94 通过、1 跳过,另有 4 项隔离的引擎信息兼容检查通过;当前提交 Pre-commit 已通过,Python/GPU CI 仍在运行,本机未复跑多节点 GPU 验证。

P3 优先级:P3 — 非行级:PR 描述。请同步更新 Acceptance evidence:其中仍列出已删除的中英文 guide/unified-inference-validation.md,并称 API 页面包含验收记录和复现信息,但这些段落也已移除。建议把验收结果及复现信息放在 PR 描述或可访问的附件中,删除失效的文件引用,并将剩余 API 页面说明改为接口与用法文档。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

复查通过:F3 已解决,PR 描述已移除失效引用,并准确说明 API 页面的用途。此前 F1、F2 仍已解决。

代码提交未变化,沿用此前验证结果;Pre-commit 已通过,Python/GPU CI 仍在运行。本审查结论不替代 CI 结果或维护者的合并决定。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

@Arazyu

Arazyu commented Sep 22, 2026

Copy link
Copy Markdown
Author

@rai-studio-bot

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

复查 375ed00a 通过:合并 main 后,算法注册与奖励处理、critic 放置及设备/权重同步接口未发现新增回归;此前 F1–F3 仍已解决。

推理契约测试 94 通过、1 跳过,另有 6 项隔离握手检查通过。Pre-commit 已通过,Python/GPU CI 仍在运行;本机缺少相应运行环境,未复跑多节点 GPU 验证。

Powered by Nyanpasu with gpt-6-astra medium, please check the suggestions carefully.

@Arazyu

Arazyu commented Sep 24, 2026

Copy link
Copy Markdown
Author

@SigureMo 任务已完成,请求 review。

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

复查结论:通过(9eec00a1)

新提交相对上轮已通过的 904b4b8 仅新增两个文件(+25 行):relax/backends/megatron/model_provider.py 在 NPU 分支整体拷贝 vars(args) 时排除运行时放置计划 _inference_placement,配套回归测试用真实 PlacementPlanner 构造放置计划并参数化 NPU 可用性。已核对该字段唯一写入方为 relax/inference/placement.py:171,NPU 拷贝循环是唯一会把该 frozen dataclass 计划带上 provider(随后被整体 pickle)的路径;排除后 args 仍持有计划供运行时消费,无其他泄漏面。本地 20 项 provider 测试与 104 项 inference 契约测试通过,该提交 CI 全绿。其余 57 个变更文件与上轮已通过内容一致,结论沿用;F1–F3 修复均保留。多节点 GPU 验证未在本机复跑,沿用 PR 描述中的验收记录。

看板:nyanpasu-review

说明:当前合并因维护者此前的 changes-requested 决定而阻塞;其中验收记录页的意见已由该页移除落实,是否放行由维护者复核决定。

Powered by Nyanpasu with glm-5.3-flash max, please check the suggestions carefully.

Merge the GenRM elasticity implementation with the unified inference
service. Preserve legacy generation, sampling and attribution through the
gateway, count raw and streaming requests during drain, and bind closed
admission to engine identities so recovered engines may reuse endpoints.

Use the same published engine states for discovery and legacy routing.
Preserve split placement offsets, retain owned placement groups until Ray
confirms removal, and recreate elastic placements during engine recovery.
Exclude retired slots from recovery and keep failed cleanup retryable.

Reject deferred, training-offload and multi-GPU elastic layouts before
taking the lifecycle lock or allocating resources. Document the supported
scope in both languages and regenerate the GenRM API schema.

Validation: focused CPU suite 426 passed, 4 optional-dependency skips;
latest lifecycle/gateway regression rerun 34 passed (overlaps that suite);
additional contract tests 12 passed, 17 optional-dependency skips.
All pre-commit hooks and the VitePress documentation build passed.
Real SGLang and multi-node GPU execution were not rerun on this CPU host.

Refs redai-studio#71, redai-studio#351, redai-studio#356, redai-studio#370
@Arazyu

Arazyu commented Oct 11, 2026

Copy link
Copy Markdown
Author

/review

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

复查结论:有一项非阻塞回归(P2)

本轮增量是提交 36ee4ba 把 #370 的 GenRM 弹性扩缩容并入本 PR。已逐块核对集成提交对网关、放置与 Teacher 共享语义的兼容改造:legacy /generate 与网关原生请求共用同一 in-flight 计数与 drain 证明命名空间;生命周期操作通过非阻塞 _exclusive_lifecycle 与弹性扩缩容互斥,发现快照不持转移锁、扩缩容期间发现服务仍可用;弹性 PG 保留至 Ray 确认 REMOVED,失败清理保持 fail-closed 并可重试。本地 CPU 套件 330 例:328 通过、2 失败,失败项即下方行级评论的 P2——并入的 #370 测试断言 GenRM 继承全局 sglang_* 参数,而该继承循环在本 PR 早期提交中已从 _compute_genrm_server_args 删除;CI 环境缺少真实 sglang 而跳过这两条测试,未能暴露。F1–F3 修复均保留;#370 引入的弹性扩缩容本体沿其在 #370 的审查讨论评估,此处不复述。

看板:nyanpasu-review

说明:多节点 GPU 与真实 SGLang 运行未在本机复跑,沿用 PR 描述披露的验收边界;当前合并因维护者此前的 changes-requested 决定而阻塞,是否放行由维护者复核决定。

Powered by Nyanpasu with glm-5.3-flash max, please check the suggestions carefully.

# (re-review finding). A failed probe defers to SGLang's default instead
# of pinning ``None`` over it; per-instance ``--genrm-engine-config``
# overrides still take priority over both (applied after the loop).
if getattr(args, "sglang_attention_backend", None) is None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Medium severity P2 · 恢复 GenRM 对全局 sglang_ 参数的继承*

合并基线(7c4e5371)的 _compute_genrm_server_args 内含 sglang_* 继承循环;本 PR 在 a3bbb30 删除了其中两行(if hasattr(args, f"sglang_{attr.name}") and attr.name not in kwargs: 及其赋值,见 hunk @@ -1632,8 +1699,6),而 #370 并入时新增的注释("the sglang_* inheritance loop below backfills only fields absent from kwargs … (applied after the loop)")与两条测试仍按该循环存在来断言。

本地装有真实 sglang 0.5.17 的环境复跑 tests/backends/sglang/test_sglang_engine.py:test_genrm_attention_backend_respects_global_user_choice 与 test_genrm_attention_backend_probe_failure_defers_to_global_and_default 均失败(用户显式 sglang_attention_backend 未出现在 kwargs);CI 环境因缺少真实 sglang 由 importorskip 跳过,故未能暴露。rollout 侧 _compute_server_args 的同名循环保留完好,两侧行为已分叉。

影响:用户显式 --sglang-attention-backend(以及其他未在 kwargs 显式计算的全局 sglang_* 项)对 GenRM 引擎静默失效;此时确定性推理落到 SGLang 通用默认后端,即上方注释所述 radix cache 被禁、48 路并发评分预填楔死场景的入口。

建议:恢复 genrm 函数内被删的两行继承循环(保留当前 guard "仅在用户未显式选择时探测" 的语义),或在文档中明确 GenRM 不继承全局 sglang_* 并同步修正此注释与两条测试;修改 relax/utils/arguments.py 或后端参数语义需按仓库约定先征求维护者确认。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

已在 bf354e7 确认修复:`compute_genrm_server_args` 恢复了被删的两行 `sglang*` 继承循环,与合并基线 1632–1637 行逐字节一致(rollout 侧同构,两侧行为不再分叉)。原先两条依赖真实 SGLang 的测试恢复通过,且 tests/inference/test_engine_contract.py 已改用真实 dataclasses schema 直接执行生产构建器(31 例通过,不要求安装 SGLang),原先 CI 因 `importorskip` 跳过而无法暴露此回归的盲区随之消除。另:bf354e70 的 CPU 测试失败源于 `_dep_stubs` 导入桥的桩模块泄漏污染 `sys.modules`,已在 0e1b722 隔离修复,与本条发现无关。

Exercise canonical discovery on every engine pick while preserving round-robin, recovery and lifecycle admission coverage. Inject watcher failures at the processing boundary and test repeated registry eviction with small caps instead of long waits and large scans.

Validation: 444 passed, 4 dependency skips in focused CPU regressions; 36 registry tests passed after strengthening protected-record eviction coverage; all pre-commit hooks passed.
Backfill supported global SGLang fields without replacing GenRM role defaults, then apply per-model overrides. Add CPU-only builder regressions for attention precedence, memory tuning, static-model defaults and the decode cache exclusion so missing SGLang cannot hide this regression.

Validation: 31 engine contract tests passed; 454 focused tests passed with 4 dependency skips; all pre-commit hooks passed.
Restore both the SGLang engine module cache entry and its parent-package attribute after importing the GenRM manager, including failed imports. This prevents later CPU tests from mistaking a dependency bridge for an installed engine runtime.

Validation: 9 import-isolation regressions passed; ordered manager/precheck regression passed 31 tests with 20 missing-SGLang skips; all pre-commit hooks passed before this commit.
@Arazyu

Arazyu commented Oct 11, 2026

Copy link
Copy Markdown
Author

/review

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

复查结论:通过(APPROVE)

本轮增量(36ee4ba8..0e1b722,三笔提交)均已逐项核实:79d98456 将 engine-pick 回归测试改写为按规范发现快照逐次取准入——旧断言对应集成前的缓存列表语义,且该头 36ee4ba 的 CI 失败(get_inference_snapshot 缺失)证实其已失效,watcher 测试改为在处理边界注入异常并断言 poll/sleep 次数,registry 洪水测试限界后覆盖等价并加强驱逐断言;bf354e70 恢复 _compute_genrm_server_args 对全局 sglang_* 的继承(与合并基线 1632–1637 行逐字节一致,rollout 侧同构),F4 随之解决,契约测试改用真实 dataclasses schema,不安装 SGLang 即可执行,消除了原先 importorskip 造成的 CI 盲区;0e1b7228 以 try/finally 恢复 _dep_stubs 引擎导入桥的 sys.modules 与包属性绑定,修复了 bf354e7 CPU 测试失败的模块缓存污染机制。本地逐文件复跑共 224 例加 5 子测试全部通过;bf354e70 的 GPU Unit Tests 与 Integration Tests(Qwen3-4B 4GPU/2GPU/4NPU)经 GitHub API 核实成功,该头与本头仅差测试文件。当前头的 CPU Tests 因 bypass 门未开尚未运行,待其完成后如有失败由后续跟进处理。说明:上轮在 36ee4ba 发布时该头 CI 已有 engine-pick 旧测试失败而未及时纳入结论,本轮已核对并确认由 79d9845 修复;多节点 GPU 完整训练流程未在本机复跑,沿用 PR 描述披露的验收边界。

看板:nyanpasu-review

Powered by Nyanpasu with glm-5.3-flash max, please check the suggestions carefully.

@Arazyu

Arazyu commented Oct 11, 2026

Copy link
Copy Markdown
Author

辛苦解决下冲突~

已解决冲突

@SigureMo

Copy link
Copy Markdown
Member

辛苦再解决下冲突,今天合入了一个大 PR 冲突项比较多~

Merge main 9cd70b8 into the unified inference branch, preserving managed
PD/HiCache, role routing and static-model weight isolation.

Use cached engine metadata with whole-replica readiness checks, retain PG
ownership through follower cleanup, adapt deferred rewards and per-service
autoscaler observations, and close startup rollback gaps.

Validation: 746 CPU regressions passed, 11 subtests passed, 56 skipped for
missing SGLang/GPU dependencies; pre-commit run --all-files passed.
GPU and multi-node validation must run on this new revision in remote CI.

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

复查结论:有补充意见

已完成 7d981ed5 合入主线后的增量复查,确认两项非阻塞问题,详见行级意见。既有修复仍保留。本轮证据包括源码、1 个指定 CPU 回归及受控探针;未验证真实 GPU/多节点集成,当前头仅有辅助 CI 检查通过,历史训练结果不覆盖本次合并。

审查看板与非阻塞拆分/相关 PR 建议

Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.

if inference is None:
self._dispose()
else:
inference.transition("shutdown", self._dispose)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Medium severity P2 · 路由进程尚待清理时保留 dispose 重试能力

_dispose() 最后调用的 stop_launched_routers() 会捕获终止异常,并保留仍存活的进程供重试,但正常返回。因此第一次清理失败仍会让这里的 transition 发布 dead;之后再次 dispose() 会直接跳过 action,保留的路由进程再也收不到终止请求。主线原实现每次 dispose 都会重试,合入后丢失了这一行为。

在 9cd70b8 与 7d981ed 的生产方法 CPU 对照探针中,让第一次 terminate 抛出 OSError、第二次成功:主线第二次清理移除了进程,当前头则保持 dead、只尝试一次。这证明重试失效,未证明真实 Ray worker 退出后进程一定残留。请在路由清理未确认完成时让 shutdown 保持可重试,或允许终态 dispose 继续协调残留资源。

Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

已在 498087ce 确认修复:路由进程仍被保留时 _dispose() 抛错,生命周期停在 failed,后续 shutdown 会再次执行清理;清理成功后才进入 dead。指定回归 test_rollout_contract.py::test_dispose_retries_unconfirmed_router_cleanup[terminate] 通过,覆盖首次失败、二次成功及成功后幂等。此测试使用进程替身,未复验真实 Ray 进程退出。

Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.

teacher_args.sglang_ep_size = 1
teacher_args.sglang_router_ip = None
teacher_args.sglang_router_port = None
teacher_args.use_rollout_routing_replay = False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Medium severity P2 · 清除 Teacher 继承的学生 indexer replay 开关

这里清除了学生的 sglang_* 配置和 routing replay,却保留了 use_rollout_indexer_replay。合入主线后,共享 _compute_server_args() 会据此为 Teacher 设置 enable_return_indexer_topk=True。当学生使用 indexer replay、托管 DSA/DeepSeek-V4 Teacher 为 TP=2 且未单独配置 DP attention 时,这里的 DP 重置使 attention TP=2;固定 SGLang 的 capturer 初始化要求 attention TP=1,Teacher 启动因此断言失败。

三版本参数构建探针确认:主线继承 DP attention,旧分支未开启 Teacher capture,当前头则组合出 TP2/DP1/capture=true;固定依赖的 CUDA factory CPU 提取探针在分配显存前触发断言。未进行 GPU 启动复现;无 indexer 层的 Teacher 不受该断言影响。建议同样清除这个学生开关,保留后续独立 teacher_sglang_* overrides 的优先级,并补充组合回归:

Suggested change
teacher_args.use_rollout_routing_replay = False
teacher_args.use_rollout_routing_replay = False
teacher_args.use_rollout_indexer_replay = False
Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

已在 498087ce 确认修复:Teacher 复制参数后清除学生的 indexer replay 标志,后续独立 teacher_sglang_* 覆盖仍生效,学生参数保持不变。指定回归 test_engine_contract.py::test_teacher_does_not_inherit_student_indexer_replay[None] 和 [True] 均通过,分别验证默认隔离与显式开启。未进行真实 GPU Teacher 启动验证。

Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.

Keep shutdown retryable when router processes remain after cleanup instead
of publishing dead. Clear student indexer replay for managed teachers while
preserving explicit teacher SGLang overrides.

Add CPU regressions for termination errors, surviving routers, successful
shutdown idempotence, and Teacher TP2 configuration with indexer replay.
Validation: 127 passed, 32 skipped (missing runtime dependencies); all
pre-commit hooks passed. GPU and multi-node integration were not run.

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

复查结论:通过

已核对 498087ce 的四文件增量,两项修复均已在原线程确认,三个指定 CPU 回归通过,未发现新增可操作问题;未变部分沿用 7d981ed5 的已审证据。GPU/多节点集成因本环境缺少相应硬件未执行,当前头的 GPU 单测与训练集成仍在运行,历史验收不覆盖本次合并。

审查看板与非阻塞拆分建议

Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.

Keep partial-startup cleanup working when Controller config is unavailable.
Bind real static-inference cleanup in its regression and assert Teacher
shutdown and kill. Update merged tests for readiness fencing, valid SFT
colocation, and head-only discovery while retaining follower observation.

Validation: 197 CPU tests passed; 2 runtime-dependent modules skipped.
The 3 affected Megatron/discovery cases also passed controlled CPU probes
using production methods and the actual test functions. All pre-commit
hooks passed. Full GPU validation remains for CI.

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

复查结论:通过

完成 cb6f63e5 五文件增量复查:缺配置清理保护及四组回归与既有契约一致,指定 CPU 用例通过,未发现新增问题;未变部分沿用前序已审证据。当前仅辅助 CI 有结果;GPU/多节点集成因缺少相应硬件未在本地执行。

审查看板与非阻塞拆分建议

Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.

@Arazyu

Arazyu commented Oct 28, 2026

Copy link
Copy Markdown
Author

辛苦再解决下冲突,今天合入了一个大 PR 冲突项比较多~

已解决冲突 辛苦看看

@Arazyu
Arazyu requested a review from SigureMo November 3, 2026 01:14
Merge main 09e456c into the unified inference branch. Preserve topology-aware
multimodal transport defaults alongside deferred CPU backups and static
model memory-saver settings. Combine flattened DCS buckets with main's
lock-release error handling without hiding the original synchronization error.

Adapt initial-sync and DCS regression fixtures to the unified contracts,
and cover lock-release failures in both regular and fully-async modes.

Validation: 726 passed, 14 subtests passed, 33 optional SGLang/router skips.
All pre-commit hooks passed. Real GPU and multi-node integration were not
run on this CPU host; remote CI must validate the new merge head.

Refs redai-studio#71, redai-studio#356
Merge main a155b62, retaining process-owned router cleanup and the unified
inference shutdown retry contract. Resolve moved CPU test imports, preserve
static-manager cleanup assertions, and adapt new router cleanup tests to
the shared lifecycle owner.

Validation: 734 passed, 14 subtests passed, 42 optional runtime skips.
All pre-commit hooks passed. GPU and multi-node validation remain for CI.

Refs redai-studio#71, redai-studio#356
@SigureMo

SigureMo commented Nov 4, 2026

Copy link
Copy Markdown
Member

本赛题已经由 #381 锁定,感谢参与~

@SigureMo SigureMo closed this Nov 4, 2026
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.

6 participants