执行摘要
重写 runtime-context 技能文档,适配 namespace-bag 配置模型
PR body 明确指出:".claude/skills/sglang-runtime-context skill still described the retired resolve-at-end contract (a single resolved ServerArgs as the source of truth, ServerArgs.override as the mutation entry) — actively misleading for anyone touching config now." 即旧的技能文档描述的是已被迁移淘汰的配置契约,会对任何接触配置代码的开发者(包括 Claude Code agent)产生误导。本 PR 作为 RFC #30696 follow-up stack 的最后一块拼图,需要把文档对齐到已落地的 namespace-bag 模型。
值得精读。这份 PR 是理解 SGLang 新配置架构(RuntimeContext + namespace bags)最直接的入口,尤其适合配置系统维护者和经常被 agent 改动波及的模块 owner。重点看三处:tier 表中 raw config seed 与 resolved config 的职责切分、"Reads that legitimately stay on a ServerArgs instance" 章节(per-runner / per-instance 边界)、以及护栏清单(writer ratchet、namespace-coverage lint、migration-deferral ratchet)。整个 review 交锋过程本身就是一份"配置模型迁移边界情况清单",比正文更有学习价值。
Review 由 Codex 机器审阅与作者自审构成,围绕"文档表述不能比实现更乐观"展开,核心交锋如下:
- raw config 生命周期:Codex 指出
RuntimeContext.set_server_args()明确允许覆盖,多 Engine / tokenizer 构建会再发布,文档写 publish-once 会误导。作者答复:"Fixed — the tier table now states the actual lifecycle: published at process entry, re-publish is last-publish-wins (in-process tokenizer build, multi-Engine) and re-projects the bags." - draft 配置隔离范围:Codex 指出只有
build_draft_tp_worker()会安装私有 draft bags,EAGLE/Frozen-KV/MultiLayer/Standalone 直接构造TpModelWorker(is_draft_worker=True)时跳过 publish、共享目标进程 bags,draft 侧声明会污染目标配置。作者两次修正(declare 小节与 pitfall 小节)后才闭合。 - strict mutation 守卫的真实行为:Codex 指出
SGLANG_STRICT_CONFIG_MUTATION已不再是控制开关,ServerArgs.__setattr__在物化后无条件拒绝写入,环境变量只是遗留 harness 标志。作者确认并改为无条件描述。 - mid-resolution 小节被删后恢复:作者自审发现重写后丢掉了
resolved_view/self._resolved()的中段读取契约;随后恢复 "Mid-resolution reads (inside the pipeline only)" 小节,并接受 Codex 意见补回adaptive_spec_params例外(pipeline 调用的 helper 可用resolved_view)。 - live-shadowed sizes 的 fail-loud 过宽:作者自审指出 attn-CP / moe-DP 在 dist init 后总是安装(size=1 别名),只有 DCP 可选;Codex 又补充
attn_dcp_size/attn_dcp_rank在未初始化时通过get_dcp_group_no_assert()返回合成值 1/0。最终收窄为:config-intent 读server_args.X,fail-loud 只针对 DCP 与 pre-dist-init。 - detokenizer / launcher 例外:Codex 指出 detokenizer 进程从不 publish,launcher 在 Rust-server / 非零 rank / multi-tokenizer 模式下也不一定 publish。作者修复了 detokenizer 例外并限定描述范围;launcher 未见明确闭合回复,但 r3 disposition 判定 clean。
- mm processor 残留漏洞:Codex 指出
BaseMultimodalProcessor.process_mm_data()仍通过get_server_args()读base_gpu_id/rl_on_policy_target,多 Engine 共进程时存在 last-publish-wins 问题。作者选择在文档中将其标注为已知漏洞而非推广模式。
参与讨论