Repository navigation
feat(sglang): upgrade to 0.5.21 and support PD+R3 - #495
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Thanks for contributing to Relax, @yuanlehome! 感谢你为 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 审查看板审查状态: ✅ 已通过 审查版本: 41e67c5 目标分支: main 已完成41e67c5在新main基线上的复查,未发现新增可行动问题。37文件中36个内容未变,PR增删代码与已审版本仅一条Docker注释不同;补查了镜像依赖/manifest、TE/Kimi补丁、ABI及GDN FP32衔接。结论基于源码与依赖契约,本轮未执行测试、镜像构建或GPU/PD/多节点验收。
审查发现待处理
已解决或已取代
改进建议(非阻塞)拆分💡 1 个拆分方案 固定37文件/10937行仍建议四层,仅B依赖A;完整6779行.21版本补丁留在A,避免拆散迁移。main已含的Energon/MSC、Qwen算子/兼容性记录和checkpoint修复不计为本PR增量。此建议非阻塞。 箭头表示前置部分 → 后续部分;目标分支为 flowchart LR
target["目标分支"]
A["PR A"]
target --> A
B["PR B"]
A --> B
C["PR C"]
target --> C
D["PR D"]
target --> D
如何按依赖提交(stack)作者为yuanlehome(MEMBER),head为其fork。本轮权限接口返回403,当前上游write未能复核;不依据成员身份或fork推断权限。 先按表重组混合提交,每部分携带对应测试和文档;逐层验证,并核对顶层最终树与原 PR 一致。独立部分各自向目标分支开普通 PR;只将有依赖的线性链组成 stack,分叉或多前置依赖按图分别安排提交。 有上游写权限: 将各层分支放在上游仓库,在已按依赖拆好的一条分支链上注册并提交(替换目标分支与分支名): gh stack init --base <target> <layer-1> <layer-2>
gh stack view
gh stack submit下层更新后用 Fork 贡献者: 分支保留在 fork,先将底层向上游目标分支提交;上层暂留本地,或在 fork 内以其前置分支为 base 开 draft PR。底层合入后,只将上层独有提交 rebase 到更新后的上游目标分支,再提交下一层;若底层被 squash,注意排除其旧提交。 Fork 内 PR 只用于增量审阅;上游 PR 的 base 不能指向 fork 独有分支。多个累计 PR 同时指向上游目标分支会包含重复差异。GitHub 原生 stack 要求所有分支位于同一仓库。 相关 PR💡 实现与合入建议新main仍未覆盖MOPD canonical配置/说明与公共fixture清理;#495继续替代已关闭#459,#347仅重叠fixture修复,均无生产合入前置依赖。 https://github.com/redai-studio/Relax/pull/459 · https://github.com/redai-studio/Relax/pull/347 · 实现取舍: 保留#495基于当前0.5.20的迁移、PD真路由/JSON/SSE、HiCache/retraction、Session lineage、最终拓扑transport和确定性BF16修复。#459的共同升级不能替代这些新增行为;#347只重叠fixture/constructor清理,#495现有写法可独立交付,无需为统一外层try/finally改写。 当前 PR 调整: 可选择性移植#459三份MOPD脚本的SGLANG_ENABLE_LOGPROB_CHUNK、SGLANG_LOGPROB_CHUNK_SIZE=8192及RELAX_PROPAGATE_ENV_VARS,并更新OPD说明,按#495已合并的.21主patch和CUDA12/latest→.17布局改写。.17/.20也支持canonical名称;.21忽略旧名仅使显式8192失效,默认仍true/2048,不据此认定chunking关闭或8192性能更好。保留两处fixture清理及ImageSFT的严格单次detach断言。 合入顺序: 不合入或重新开启已关闭未合并#459。canonical配置可独立先行或随#495交付,再rebase去重;升级可聚焦先落、PD/R3后续rebase,或完整组合验收后整体交付。#347仍open/unmerged,任一先合后另一方rebase删除已覆盖的fixture清理,保留各自其余功能;共享测试不构成等待或关闭另一PR的理由。 依据与验证范围: 三方实时head/base/merge-base及需求已复核,新main尚未包含这两项尾差。MOPD参考:https://github.com/redai-studio/Relax/blob/5d271167b7bdb4974db92998bdff6cbecfbe38bc/examples/on_policy_distillation/mopd/run-mopd-qwen35-9b-8xgpu-colocate.sh#L34-L38 ;.21默认值:https://github.com/sgl-project/sglang/blob/e00930c5489053f26d86b179cee0d087f846acbb/python/sglang/srt/environ.py#L1327-L1328 。fixture对照:https://github.com/redai-studio/Relax/blob/41e67c5ee921ae2922bfda5662ef223199c87741/tests/components/test_component_background_loop.py#L14-L34 与 https://github.com/redai-studio/Relax/blob/62ae8c1f2ae6f1e35a40b15f61ce35f4bf4f70f5/tests/components/test_component_background_loop.py#L14-L37 。协调分析只读,未运行测试或构建;作者历史结果不证明当前组合的运行时验收。 提交范围 · 接收 37 · 建议移出 0 · 待确认 0接收 37 个文件 · 建议移出 0 个文件 · 待确认 0 个文件。移出与待确认部分暂停深审,不代表审查通过。
Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| torch.zeros(1, dtype=torch.long), | ||
| ) | ||
| monkeypatch.setattr(base_processor.envs.SGLANG_MM_AVOID_RETOKENIZE, "get", lambda: avoid_retokenize) | ||
| result = await processor._process_mm_data_uncached( |
There was a problem hiding this comment.
保留的 CUDA12 镜像仍使用 SGLang 0.5.17,但该版本的 QwenVLImageProcessor 只有 process_mm_data_async,没有这里调用的 _process_mm_data_uncached;其基类与 0.5.17 补丁也未提供此方法。该新增测试没有版本/能力限制,因此在受支持的 0.5.17 环境中会抛出 AttributeError,无法验证图像 token 保留行为。
请按 API 能力适配入口,或只对依赖新 API 的新增测试加限定,同时保留原有 0.5.17 OPD 回归;不要把整个测试文件跳过。
There was a problem hiding this comment.
复查 6cd6c9c:此处由 16 个参数组合缩为 2 个,但仍直接调用 _process_mm_data_uncached,没有新增 API/版本保护。保留的 0.5.17 源码和补丁仍无该方法,因此原来的 AttributeError 路径未消除,本项保持未解决。请仅适配或限定这个依赖新 API 的用例,保留其它 0.5.17 OPD 回归。
There was a problem hiding this comment.
复查 8ef631b:测试现在按 API 能力选择新版 _process_mm_data_uncached 或 0.5.17 的 process_mm_data_async,并显式设置 fixture 的 use_cuda_ipc=False;原有 sampled IDs 和 mRoPE 断言仍保留。已对照固定 0.5.17 方法及调用路径,原入口缺失问题已修复,本项代码问题已解决。此结论为源码核对,未宣称本轮完整测试通过。
| + } | ||
| + let total_rows = prefix_rows.checked_add(completion) | ||
| + .ok_or_else(|| "PD routing replay token count overflow".to_string())?.saturating_sub(1); | ||
| + let mut p = routes(prefix)?; |
There was a problem hiding this comment.
这个新要求也会随共享 router 进入 CUDA12 镜像,但该镜像仍使用未改动的 0.5.17 补丁。该版本的成功 P 端交接路径 在释放 KV 前没有调用 _maybe_collect_routed_experts,因而响应不含 routed_experts。对应收集调用目前只补进了 v0.5.21.patch。
所以 CUDA12 上正常成功的 PD+R3 /generate 也会在这里被拒绝:非流式返回 502 invalid_routing_replay,流式则在最终合并时产生响应体错误。旧 router 容忍缺少 P routes,本次新增的是确定的可用性回归。请给保留的 0.5.17 同步补齐 P 端 producer,并加入版本组合覆盖;不要以 D 端 prompt 占位行作为回退结果。以上结论来自固定版本的生产/消费路径,尚未做 GPU PD 实测。
There was a problem hiding this comment.
复查 6cd6c9c:共享 router、CUDA12 Dockerfile 和 v0.5.17.patch 与上一轮提交均未变化;当前 router 仍强制读取 P 端 routes,保留的 0.5.17 成功交接路径仍未补齐该字段。因此原来的 CUDA12 PD+R3 拒绝路径仍可到达,此次 transport/BF16 修正没有覆盖它。请为 0.5.17 配套补齐 P 端收集,并验证该版本组合;此项保持未解决。
There was a problem hiding this comment.
复查 8ef631b:0.5.17 现在在成功 P 交接时、完成标记和 KV 释放前采集路由。已核对捕获 finalize 的先后关系、N-start 行数及正常/skip-tokenizer 序列化,P 元数据满足共享 router 的严格要求;D 首 token 结束也在释放前采集。原来的缺字段拒绝路径已修复,本项代码问题已解决。
验证基于固定版本源码和相关补丁重建;未执行真实 CUDA12 PD 请求,作者本轮 Decode warmup 验收也尚未完成。
yuanlehome
left a comment
There was a problem hiding this comment.
按文件汇总本次改动:16 个非测试文件各保留一条说明;原来的零散行内说明已统一整理。
There was a problem hiding this comment.
文件改动总结
- CUDA 13 基础运行时和安装校验升级到 SGLang 0.5.21,并固定对应源码 commit、应用新版 Relax patch;CUDA 12 配方不在本文件中升级。
- 新增 Rust tree core 构建阶段,用匹配的 Torch ABI 编译 HiCache 扩展,再在最终镜像核对并安装,禁止运行时 JIT 另选产物。
- 纳入 Kimi packed-sequence API 与 Blackwell attention 补丁,保留既有 Megatron patch 栈及依赖组合。
- 拒绝复用旧版本 train 镜像,防止只升级 Python 包却混入旧 CUDA 扩展。默认基础镜像仍是 tag,需要可重复构建时由
BASE_IMAGE指定 digest。
There was a problem hiding this comment.
文件改动总结
同步 CUDA 13 支持矩阵中的 SGLang 版本为 0.5.21,并修正文档对基础镜像 digest 的描述:当前默认使用 tag,可重复构建需显式指定不可变 digest。保留 Hopper、优化 TP4 配方等尚未完成硬件验收的边界,避免将本次单机验证推广到其他运行环境。
最新验证(6cd6c9c):SGLang 0.5.21 / PyTorch 2.13.0+cu130 / CUDA 13.0 / Blackwell SM103;合并后 CPU 343 passed / 7 skipped,这 7 项已在 GPU 上通过且相关代码未变,沿用结果,合计覆盖 350 项。完整 pre-commit 通过;未重建完整 Docker 镜像,本次审查修复后未重跑端到端训练。
There was a problem hiding this comment.
文件改动总结
适配当前 Megatron Bridge 的 preprocess_packed_seqs:移除失效参数,从新返回值中取 embeddings,并转为 Kimi 后续模块需要的 sequence-first contiguous 布局。目的是同时解决 API 签名变化和 TP/CP packed 输入布局兼容,而不只是让函数调用不报错。
There was a problem hiding this comment.
文件改动总结
- 在原有 DP-aware 路由基础上修正 bootstrap host,握手使用物理地址,保留 DP 虚拟 worker 身份。
- 新增统一的 PD+R3 合并模块:P 返回完整 prompt 路由,替换 D 的 prompt 占位区,再追加 D 的生成后缀;校验 token 计数、增量起点、batch 对应和 base64/int32 形状,并处理首 token 结束等边界。
- JSON 与 SSE 共用合并规则。SSE 按事件缓冲,支持 UTF-8/CRLF 跨 chunk、保留其他事件字段,并检测缺失终态路由或截断。
- 优先保留 P 原始错误,等待两侧本次请求收尾后再允许重试;补充 RID/room 日志,PD 空闲连接提前到 4 秒淘汰,避免复用服务端已关闭的连接。
本次端到端验证覆盖 0.5.21 组合;共享 Router 与保留的 0.5.17 P 端路由返回之间的兼容问题,仍见现有待处理审查意见。
There was a problem hiding this comment.
文件改动总结
这是从上游 0.5.20 基线迁移到官方 0.5.21 的完整 Relax 补丁,主要包括:
- 原生 API 迁移:适配 runtime context、调度配置、state capture 和权重更新入口,保留 legacy 接口、OPD、LoRA 及既有模型能力。
- CPU HiCache:迁移 chunked/deferred backup、受保护 checkpoint、暂停期间异步收尾及 Python/Rust tree core 接口,保持备份、命中与释放顺序。
- PD+R3:P 在 KV 释放前采集路由,D 支持首 token 结束;路由随 host cache、换槽位和 retraction 保存/恢复,释放时失效,无路由的存储层前缀重算;超时走原生多 rank 共识。
- 权重热更新:适配 native begin/end 与旧 quantization 协议,支持 BF16、INT4、MXFP4 及 Qwen/Kimi 派生参数刷新,尽量保持 Parameter、存储地址和 loader 属性,避免 CUDA Graph 读取旧数据。
- 计算与多模态兼容:迁移融合 MoE 路由捕获、DP/graph 布局、图像 sampled IDs 与 OPD 逐位置查询。6cd6c9c 已补齐确定性
reduce_scatterv的 BF16 → FP32 累加,输出保留原 dtype 和调用方 buffer/alias 身份。
回归:四进程 CPU/Gloo 相消用例,以及 CUDA 13 / Blackwell SM103 上四 GPU NCCL/CUDA Graph 确定性分支均通过;对应审查意见已 resolve。完整 patch 干净应用到官方 0.5.21,89 个受影响 Python 文件编译通过。
There was a problem hiding this comment.
文件改动总结
- 将合法的空路由编码与缺失字段区分开,零行结果也进入统一解码/形状处理。
- 生成结果按累计 token 数合并 R3:保留已接受 token 的历史路由,只追加本次新增后缀;开启 R3 且接受了新 token 却缺路由时明确报错。
这样部分 abort/resume 不会覆盖旧路由,也不会把不完整的 replay 数据静默交给训练。
There was a problem hiding this comment.
文件改动总结
新增统一的 merge_routed_experts,检查 [token, layer, topk] 形状与累计行数,保留旧前缀并复制数据,避免共享数组被后续修改。SessionForest 写入响应时沿选中的 parent lineage 继承路由,再接本轮后缀,使多轮对话、工具观察和 fork 不会混入兄弟分支的专家选择。
There was a problem hiding this comment.
文件改动总结
6cd6c9c 已撤销 parser 级别的 cuda_ipc 默认值。默认选择移到 sglang_engine.py 的 policy/GenRM 参数构造中,在最终拓扑和覆盖配置生效后处理:仅单节点默认 CUDA IPC,跨节点保留 SGLang 原生自动选择;显式 CLI/YAML 值及 per-engine None 保持优先。
回归:真实 CLI + SGLang 0.5.21 原生 transport 校验 11 个场景全部通过,覆盖 regular/P/D、GenRM、单/多节点及显式覆盖;对应审查意见已 resolve。
There was a problem hiding this comment.
文件改动总结
按能力检测选择 R3 capture 实现:存在 TopkCaptureOutput 时沿用 SGLang 原生 tensor 快照、异步拷贝和 host-cache finalize 生命周期,避免旧 monkey patch 覆盖新版实现;缺少该 API 的旧版本继续使用原有兼容路径。
There was a problem hiding this comment.
文件改动总结
将固定 NLAYERS=61 改为可由环境变量覆盖,默认仍保持完整模型的 61 层。缩层 checkpoint 可直接传入实际层数,避免为验证反复修改公共模型脚本;单独的两层 INT4 实验启动脚本未进入 PR。
| def test_transport_respects_engine_topology_and_native_validation( | ||
| request, monkeypatch, engine, worker, gpus, engine_gpus, cli, overrides, expected | ||
| ): | ||
| from sglang.srt.arg_groups import serving_hook |
There was a problem hiding this comment.
这里无条件导入 arg_groups.serving_hook,而 CUDA12 保留的 0.5.17 源码 没有该模块,私有补丁也未补入;因此 11 个 transport 参数项会在检查构参前失败。同轮新增的 test_deterministic_bf16_reduce_scatterv_uses_fp32_accumulation 也无条件提取 0.5.17 不存在的 _deterministic_reduce_scatterv。当前 Unit Tests 工作流 默认构建 CUDA12 Dockerfile,确实会选择这个版本;0.5.21 专项通过不能覆盖此组合。
请让 transport 回归分别调用 0.5.17 的 ServerArgs._handle_multimodal_feature_transport 和 0.5.21 的 hook,保留两版的构参校验;仅对新确定性 helper 专属用例加 API 限定。这里报告的是源码确定的测试兼容缺陷,当前运行中的 CI 尚无失败结论。
There was a problem hiding this comment.
复查 8ef631b:transport 回归已分别调用 0.5.17 的原生 ServerArgs 校验和 0.5.21 hook,保留真实 CLI/构参与显式错误校验;确定性归约仅在缺少该 helper 时跳过专属用例,普通归约矩阵仍保留,GPU 路径先做普通 NCCL/graph 检查,再判断是否测试确定性分支。本轮未运行这些用例。原来的旧版接口缺失问题已修复,本项按源码核对为已解决;当前 CI 的新失败另在面板分析,不能把旧 6cd 结果当作本次验证。
Upgrade the CUDA 13 runtime and migrate Relax's SGLang patches while preserving CPU HiCache, disaggregated serving, and weight reload support. Include the Kimi, Blackwell, and packed-sequence compatibility fixes. Capture and merge prefill/decode routing replay across CPU cache reuse and multi-turn sessions. Handle PD error propagation and align router idle connections with the SGLang keepalive timeout. Add migration regressions and update the PD launch configuration. Validation: - pre-commit run --all-files --show-diff-on-failure passed. - Regression suite: 835 passed, 33 skipped, including 23 compiled Rust HTTP cases. - Five-round end-to-end runs completed for regular R3, PD+R3, and Mini SWE PD+R3 with CPU HiCache; compare train/inference diff, mean output length, and raw_reward.
Resolve multimodal transport after per-engine topology and overrides, using CUDA IPC only by default for single-node engines. Accumulate deterministic BF16 reduce-scatter in FP32 while preserving output buffers. Trim redundant upgrade regressions and consolidate related weight reload, routing capture, engine argument, and patch compatibility tests into five fewer files without dropping the retained test cases. Validation: full pre-commit passed; 343 CPU cases passed after consolidation. The seven unchanged GPU cases previously passed on Blackwell with CUDA 13 and SGLang 0.5.21. The patch applies cleanly to official v0.5.21.
Build FlashAttention and Transformer Engine extensions against the image's Torch ABI, remove an overlapping TE patch, and align NIXL and OpenTelemetry dependencies in the CUDA 13 image. Collect PD routes before releasing request slots on SGLang 0.5.17 and adapt the existing regression suite to both supported SGLang versions. Validation: both images built on H800; CUDA 13 native regressions passed 349 tests (3 skipped), and CUDA 12 passed 304 tests (48 skipped). TE, FA2, and Apex GPU forward/backward or optimizer checks passed in both images. H800 multi-GPU checks used NCCL_NVLS_ENABLE=0 at launch only. Five CUDA 13 ordinary-generation checks passed; PD image validation remains incomplete at Decode warmup and is not counted as a passing result.
Explicitly detach background-loop test components before monkeypatch restores the process-global TransferQueue lifecycle function. Also release the additional instances created by the constructor test in a finally block. This prevents delayed garbage collection from counting unrelated detach calls in the ImageSFT teardown test; its strict once-only assertion stays. Validation: controlled delayed GC reproduces the old failure (13 detach calls), while the fixed focused suite passes all 46 tests. All 124 component tests pass under both normal and delayed GC. No production code changes. Full pre-commit checks pass.
5eb8d13 to
41e67c5
Compare
Single-node engines now default mm_feature_transport to cuda_ipc (redai-studio#495), but SGLang rejects that transport on ROCm ("--mm-feature-transport=cuda_ipc requires NVIDIA CUDA"), so every SGLang engine failed to start on AMD GPUs. ## 🐛 Bug Fix - Skip the cuda_ipc default for policy and GenRM engines when running on ROCm, leaving SGLang's automatic transport selection; CUDA behavior is unchanged ## ✅ Tests - Pin is_rocm=False for the existing CUDA transport cases so they do not depend on the host GPU - Add a ROCm case for policy and GenRM engines expecting the auto policy
## What The ROCm image (gfx950/gfx942), the en/zh ROCm guide plus the docker/README.md section, and the cuda_ipc fix for a ROCm regression on main since #495. ## How - Image: how it matches Dockerfile.cu13 (SGLang patch, Rust tree core, router, Megatron patches including #488's), plus the prebuilt wheels, the requirements handling and the runtime environment variables. - SGLang patch: the one remaining fix, linked to sgl-project/sglang#44266, with a note that it can be dropped once Relax upgrades past that. - Transport fix: how the cuda_ipc default is skipped on ROCm. ## Testing - End-to-end colocated GRPO on 8× MI350X (`gfx950` image): | Task | Rollouts | Result | `mismatch_kl` | | --- | --- | --- | --- | | Qwen3-4B DAPO-Math (`run-qwen3-4B-8xgpu.sh`) | 3 | Succeeded; weight update 3.9 s, step ≈ 159 s | 6.2e-4 – 1.0e-3 | | Qwen3-VL-4B Open-R1 (`run-qwen3-vl-4B-8xgpu.sh`) | 3 | Succeeded; reward 0.36 → 0.52, weight update 4.3 s | 6.7e-4 – 7.2e-4 | | Qwen3-Omni-30B-A3B AVQA (16-GPU recipe on one node, EP 4) | 450 | Held-out AVQA accuracy 0.750 → 0.884; reward 0.81 → 0.95 (first/last 50 rollouts) | 3.0e-3 – 6.2e-3 | - [x] `pre-commit run --all-files` passes - [ ] Tests pass (`pytest tests/`) - [x] New tests added (if applicable) - [x] Documentation updated (if applicable) ## Type of Change - [ ] Bug fix (non-breaking change that fixes an issue) - [x] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [x] Documentation update - [ ] Refactoring (no functional changes) - [ ] Performance improvement - [ ] CI/CD or build changes ## Screenshots / Logs <!-- If applicable, add screenshots or log output to help explain the changes. --> --------- Co-authored-by: Nyakku Shigure <[email protected]> Co-authored-by: Codex <[email protected]>
#841) ## What 将 Relax 自编 SGLang Router 的上游 HTTP 连接池空闲超时统一为 4 秒,覆盖普通模式和 PD 模式。 Mini-SWE session supervisor 兼容未启用 `CONFIG_PROC_CHILDREN` 的 Linux 节点。 ## Why SGLang 的 HTTP worker 默认在连接空闲 5 秒后开始关闭。普通模式的 Router 此前允许连接在池里保留 50 秒。新请求如果恰好复用了正在关闭的连接,`/generate` 会收到连接重置,Router 将这次请求报为 `500 call_upstream_request_error`。 #495 已针对 PD 模式把空闲超时缩短到 4 秒。这次把相同的设置用于普通模式。 - [SGLang #20851](sgl-project/sglang#20851) 在 SGLang 0.5.9 上报告了同样的 5 秒 worker keep-alive 与 50 秒 SMG 连接池超时冲突。报告者随后建议由 Router 处理 reset,并关闭了 issue。 - 旧版 SGLang Model Gateway 后续通过 [#24329](sgl-project/sglang#24329) 增加了 `SMG_POOL_IDLE_TIMEOUT_SECS` 和对应的 `--pool-idle-timeout-secs` 参数,默认值为 50 秒。 - 官方新版 `sgl-router` 通过 [#44075](sgl-project/sglang#44075) 直接把连接池空闲超时设为 3 秒,让 Router 先于 worker 的 5 秒超时淘汰连接。 8 卡 H20 回归还遇到了独立的 Agent 启动故障。会话管理代码从 #628 起直接读取 `/proc/self/task/<pid>/children`。这个可选接口在调试节点的内核中未启用,supervisor 收到 `FileNotFoundError` 后在 `finally` 中向自己的 worker 发送 `SIGKILL`。worker 来不及写出 `release.worker.json`,外层因此反复报 `exit -9` 并丢弃样本。 ## How 在现有 Router Rust 补丁中移除按路由模式区分超时的分支,直接给 `reqwest` 的 `pool_idle_timeout` 传入 4 秒。下次构建 Relax 镜像时,现有构建脚本会用这份补丁重编 `sglang-router` wheel。 Mini-SWE supervisor 用 `os.waitid(..., WNOWAIT)` 查看已退出的子进程,再用 `os.waitpid` 回收已收养的后代,并把主 worker 的退出状态留给 `Popen`。Supervisor 和 Agent Server 共用子进程枚举逻辑。默认使用 `psutil.Process().children()`。遇到读取权限错误时,逐个用 psutil 核对子进程关系,跳过已退出或不可读的 PID。Supervisor 清理仍存活的后代后,继续以 `waitpid` 的 `ECHILD` 确认资源释放。Mini-SWE 独立虚拟环境的安装清单加入 `psutil`,已有环境也需补装。 ## Testing - [x] `pre-commit run --all-files` passes - [ ] Tests pass (`pytest tests/`) - [x] New tests added (if applicable) - [x] Documentation updated (if applicable) - 在锁定的 Router 源码 `9daabcd` 上通过 `git apply --check`,并核对应用后生成的 Rust 源码。 - `cu12`(Linux x86_64)镜像构建并推送成功,现有构建流程重新编译了 Router wheel,并通过镜像内的原生模块导入检查。 - 在该 `cu12` 镜像中验证普通模式 Router 的真实连接复用行为。空闲 0.5 秒后复用原连接,空闲 4.5 秒后建立新连接。 - 原 supervisor 在关闭 `CONFIG_PROC_CHILDREN` 的节点复现 `FileNotFoundError → SIGKILL → exit -9`。 - 权限回归用例只对一个无关 PID 注入读取错误。旧版 `ea756081` 复现 `psutil.AccessDenied`,`a6371406` 在 Linux H20 环境通过 14 个资源清理测试及 28 个 Agent Server 测试。 - `ea756081` 用真实 Apptainer SIF 启动实例并执行命令。测试确认实例已停止、脱离 worker 进程组的子进程已回收,且 supervisor 返回 `resources_released=true`。 - 使用 `ea756081`、原 PR 的 cu12 镜像和 `psutil==7.2.2` 提交 8 卡 H20 的 CE 回归。加载 Qwen3.5-35B-A3B 真权重后,完成了 `rollout 0/20` 至 `rollout 3/20`。使用同一 Mini-SWE 脚本、模型、数据和 8 卡规模的两次旧跑次分别在第 2 和第 4 轮报 `call_upstream_request_error`。本次前四轮日志中 `Agent session failed`、`exit -9` 和 `call_upstream_request_error` 均为 0。验证范围为已完成的前四轮。 ## Type of Change - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Refactoring (no functional changes) - [ ] Performance improvement - [ ] CI/CD or build changes ## Screenshots / Logs 故障抓包显示 worker 空闲约 5 秒后发出 `FIN`,Router 随后在同一个 TCP 连接上发送新请求,收到 `RST`。 Mini-SWE 原版 supervisor 的调试日志记录了读取可选 procfs 文件失败,并从 `finally` 向该会话的 worker 发送 `SIGKILL`。 <div align="right"> <sup>This PR is co-authored with @codex (gpt-6.2-sol xhigh)</sup> </div> --------- Co-authored-by: Codex <[email protected]>


What
Why
基于上游 0.5.20 重新迁移,保留 OPD、Qwen/Kimi、权重热更新能力,并参考 Miles 补齐 PD+R3。替代 #459。
How
Testing
pre-commit run --all-filespassespytest tests/) — 未跑全仓库,专项结果见下。最新验证对应
6cd6c9c:SGLang 0.5.21 / PyTorch 2.13.0+cu130 / CUDA 13.0 / Blackwell SM103(compute capability 10.3)。Type of Change
Screenshots / Logs
升级阶段单机 8 GPU、各 5 轮端到端结果;本次审查修复后未重跑:
Qwen 对照使用 router 后续修正前的成功请求路径;Mini-SWE 最后一轮验证最新 router。验收看上述指标,不要求 logprob 严格一致。使用隔离运行时,未重建完整 Docker 镜像,未覆盖多节点及其他 GPU 架构。