Repository navigation
Conversation
…ile (ranxianglei#7111) cordis entry-level inject has no optional form, no timeout and no fallback, so gating the four Web presets on biliBasicCompactionPolicy meant any missing gate service left them pending forever: session creation failed with agent-presets/not-found while the host kept booting and serving its UI. Measured on dsh 0.2.2-rc.4: with the gate row disabled, resolve('standard') throws and four entries report pending. The presets are no longer gated. The always-on gate entry reconciles the presets mounted before it activated (entry.update re-runs internal/config, so the overlay rewrites them exactly as on a cold resolve) and the loader is awaited in a child fiber, never injected hard. Losing the gate service now costs the overlay (stock compaction, wire guard ranxianglei#1729 as backstop), not the session. Verified on a real host: gate disabled => resolve ok + zero pending; gate enabled => all four presets still carry disabled compaction-basic/command-compact rows.
… gate) Both types are referenced only inside their own module; the repo's unused-exports gate rejects exports with no external consumer.
|
CI 修复( 本地:typecheck ✅ / 18 用例 ✅ / build ✅ / unused-exports ✅ / architecture-docs ✅。 |
…#7111) ranxianglei#7111 made the four Web presets fail-open, so disabling the bili-compaction-gate entry no longer re-creates the pending-latch brick. The real consequence is that native compaction stays ARMED while bili owns the lane (no overlay to stand it down), which risks destroying the compression substrate — the ranxianglei#1729 wire-level refusal is only the backstop. Update the 'Disabling vs removing' section in both docs to say that instead of the now-stale 're-creates the brick' claim.
…glei#7111) reconcileLoadedPresets disabled the web presets' compaction rows unconditionally, while the overlay it complements honors the process verdict (isDshCompactionActive). With bili-native disabled (verdict absent) the ranxianglei#3662 contract requires the presets to fall back to STOCK dsh compaction; as written the reconcile would stand down native compaction anyway, leaving the user with no compaction at all. Skip the reconcile when the verdict is absent, exactly like the overlay. Adds the negative test (verdict absent -> 0 touched, update never called) and declares the verdict in the entry-filtering test so it keeps testing what it claims to.
(ai: vllm-qwen/qwen3.8-27b) 🔶 需要决策
查重不重复。相关行:#7112(internal/config 监听器读 this)、#7113(后续 patch 行重新 arm compaction-basic.auto:false)、#6470(owner PR,实测运行时 no-op)、#7115/#7116 触碰 dsh-compaction-gate.ts(不同关注点,作者会 rebase)。本 PR 是 #7114 方案 A(fail-open)的实现,与上述均不同机制。 审核结论(八问)
我在 PR 分支上补的 commit(对齐重构,非替换;作者 commit 与署名保留)
本地验证
CI镜像缓存:30 checks,0 failed,18 success,11 skipped,1 pending(新 commit 标签镜像 label API 在本环境未实现(ework shim 返回 endpoint not implemented),tools/add-label.sh 不存在,无法按规则打标;意图标签:bug / dsh / scope/wiring / p1。 合并判定核心 fail-open 修复方向正确、代码与测试质量达标;我补的两处(文档 + verdict 回归)已修并推送。待:① owner 对「告警现在折进 vs 立项跟进」拍板(推荐 B);② CI 全绿;③ undraft。满足即可合(合并仅人工)。 |
(ai: vllm-qwen/qwen3.8-27b) 更正上一条的一处置错号:查重段「本 PR 是 #7114 方案 A 的实现」应为 #7111(GitHub 主 issue「preset gate latch is fail-closed」)。#7114 在 GitHub 上是另一个无关的 dsh_session_log drive-by issue,我误把它当成了主 issue 的镜像号。其余引用(#7112 / #7113 / #6470 / #7115 / #7116 / #7111 / #7117)已逐一对照 GitHub 标题核实无误。 |
|
| 构建 | 四个 preset 的 8 个压缩行 | reconcile 内部 |
|---|---|---|
23d42c38(父提交) |
8/8 disabled: true |
touched: 4 |
69d43091(本 head) |
0/8,34 秒内一直保持 stock | touched: 0 |
69d43091 上的采样(每 3/8/15/22/28/34 秒一次,verdict 全程 active):
t= 3000 verdict=active disabled=0/8
t= 8000 verdict=active disabled=0/8
t= 15000 verdict=active disabled=0/8
t= 22000 verdict=active disabled=0/8
t= 34000 verdict=active disabled=0/8
原因
在真进程里读 reconcileLoadedPresets 的内部计数(临时诊断,未进任何分支):
reconcile = {"calls": [{"verdict": false, "total": 206, "withRows": 4, "withUpdate": 4, "touched": 0}]}
三件事同时成立:
calls长度为 1 —— 整个进程只调用一次(ctx.inject(["loader"], cb)的回调只触发一次,没有第二次机会);- 那一次调用时
isDshCompactionActive()是 false; withRows: 4、withUpdate: 4—— 4 个带压缩行的 entry 全部满足前置条件,唯一拦路的是新增的if (!isDshCompactionActive()) return 0;。
verdict 大约 1 秒后就变成 active(bili-native 的 apply() 里 declareDshCompactionActive() 在首个 await 之前,是同步声明的),但 reconcile 已经不会再跑了。
负向对照
只回退那一行、其余不动,同一份源码重新构建:
| 构建 | reconcile |
行状态 |
|---|---|---|
| 带闸门(本 head) | verdict:false, touched:0 |
0/8 |
| 去掉闸门 | verdict:false, touched:4 |
8/8 |
闸门本身是对的,时机不对
场景 V(- id: bili-native / disabled: true)实测:resolve("standard") 仍 ok、0 pending、8 行保持 stock —— 这正是 #3662 要求的回落,闸门就是为此加的。
所以不需要回退这个 commit,需要的是把"判 verdict"和"做对齐"分开:
- (推荐)声明后回调:共享模块里加一个跨 bundle 的回调注册(与 verdict 同一条
globalThis通道),declareDshCompactionActive()落地后立即触发;gate 在apply时注册,而不是当场做一次。verdict 缺席依旧什么都不做,语义不变。 - 有界重试:verdict 缺席时退避重试(例如 100ms × 5),拿到声明后再对齐。改动更小,但要处理"永远等不到"的终止。
为什么 CI 抓不到
现有单测先 declareDshCompactionActive() 再调 reconcileLoadedPresets(),等于假设了宿主里的调用顺序;真机上这个顺序是反的(preset 在 ~140ms 挂载、bili-native 在 ~960ms 声明,gate 的回调在声明之前跑过一次)。建议补一条时序用例:先 apply、后声明,断言声明落地后仍会触发对齐——现在的实现会永远漏掉这一支。
影响
- 所有装了 billion-context 的 web profile 正常启动都受影响:preset 里的
compaction-basic/command-compact留在 stock,宿主原生自动压缩在 bili 负责的车道里仍然 armed。 - 兜底还在(nudge 死锁无检测:同一 session 交替收到两种结构互斥的请求流(巨型单消息 ↔ 多轮)时不告警 #1729 的 wire 级拒绝),所以不是静默损坏,而是"压不了并报错"。
- CI 全绿,因此这条只能靠真机发现。修好之前建议保持 draft。
ranxianglei#7111) The verdict gate from 69d4309 was correct in semantics but wrong in timing: on a real host (dsh 0.2.2-rc.4) the gate entry's one-shot loader callback fires ~140ms in, before bili-native's apply() declares the verdict (~960ms), so the reconcile saw an absent verdict, returned 0, and never ran again — leaving all preset compaction rows stock and making the fail-open fix a no-op (reported with A/B real-host evidence). Register the reconcile for the declaration instead of running it on the spot: onDshCompactionDeclared() rides the same globalThis channel as the verdict, fires the moment declareDshCompactionActive() lands (or immediately if it already has), and never fires without a declaration (stock stays stock — the ranxianglei#3662 contract is intact). Entries are re-read at fire time, so presets mounted after the one-shot callback are covered too. Adds the timing regression test the report asked for: apply first, declare later, assert the reconcile fires after the declaration — verified to fail on the pre-fix implementation.
(ai: vllm-qwen/qwen3.8-27b) 诊断确认,已按你推荐的选项 1(声明后回调)修好: 代码级核实
修法(选项 1:声明后回调)
验证
审核结论(八问)
状态
|
真机复验:
|
| 场景 | verdict | 压缩行 | 建会话 |
|---|---|---|---|
| N 正常(gate + bili-native 都在) | active |
8/8 disabled:true(3s / 8s / 15s 三次采样一致) |
— |
B bili-compaction-gate / disabled: true |
active |
0/8 | resolve("standard") ok、0 pending、宿主照常起服务 |
V bili-native / disabled: true |
无声明 | 0/8(回 stock) | resolve("standard") ok、0 pending |
对照修复前(69d43091):场景 N 是 0/8,且 reconcile.calls 只有一次、verdict:false、touched:0。
三点值得记下来:
- 修复没有回退 verdict 语义——V 场景仍然一行不动,说明"判 verdict"与"做对齐"确实被拆开了,不是用"无条件对齐"换来的绿。
onDshCompactionDeclared()的"已声明则立即触发"分支覆盖了反序加载(gate 晚于 bili-native 时),这点在真机上没触发,但逻辑在。- CI 抓不到这条:现有单测先声明再调 reconcile,等于假设了宿主顺序;新加的"先 apply 后声明"用例才是真正的防线。
本地门禁:typecheck / check-unused-exports / 20 个定向用例(issue7111 + issue3354 + issue3662)/ build 全绿。复现方式:把 billion-context 以 link 方式挂进一个 web profile,分别叠加 - id: bili-compaction-gate / disabled: true 与 - id: bili-native / disabled: true 两个 overlay,启动后读四个 preset 的 compaction-basic / command-compact 行。
结论:本评论开头描述的时序缺陷已不存在,可以关闭这一条。 剩下的是合并(需人工),以及 #7111 的 needs-decision:方案 A(拆掉入口级硬依赖)已在本 PR 实现,方案 B(gate 缺席时大声告警)是否并入本 PR 仍待定。
(ai: vllm-qwen/qwen3.8-27b) 真机复验收到,与预期一致——时序缺陷已解决:
你记的三点都成立,尤其第 3 点:「先 apply 后声明」的时序用例才是真正的防线,现有单测(先声明后 reconcile)确实假设了宿主顺序、抓不到这条。 当前状态(实时核对)
剩余两道闸(均人工)
审核结论(八问)
收工判定时序缺陷已解决并经真机三场景复验;代码与测试质量达标。待:① CI 全绿(11 分片在跑);② undraft;③ owner 对方案 B 告警拍板(推荐单独立项)。满足即就绪(合并仅人工)。 |
更正:我上一轮在这个线程给的“修复前 0/8”读数用错了层上一条复验评论里我写: 我读错了什么我读的是 所以“0/8”只说明那次 reconcile 没写回 options,不能说明压缩没被关。 正确的读法对每个 preset entry 主动派发一次 const resolved = fiber.ctx.waterfall('internal/config', fiber, () => entry.options.config)重测结果(同一套探针,换构建)
也就是说: 结构上也支持这一点: 对
|
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 上一轮 CI 跑完是 2 红( 两红都是继承性失败,不是本 PR 的代码问题
根因:分支 base 过旧
处置
八问
仍开放
CI 全绿后这条即可进入合并流程。 |
(ai: vllm-qwen/qwen3.8-27b) 收到更正,逐点回应: 1. 层错误确认 同意。 2. 结构论证的适用边界 你的结构论证(required-dep 排序:中间件先注册、 但对新代码(PR,preset 的 3. reconcile 的定位 reconcile 不是严格冗余——它是防御网,覆盖"preset 在中间件落地前解析"的边界情况。这个边界情况在今天的 dsh 0.2.2-rc.4 上不会触发(你的探针证明了),但在其他 dsh 版本或不同宿主上可能触发。reconcile 代价极低(一次 4. 同意你的调整——不撤回,但不是阻断级。它修的是"假设时序下兜底不工作"的路径,在今天的宿主上不触发。"先 apply、后声明"的时序用例本身有价值(现有单测确实假设了宿主顺序),保留。 5. PR 方向 同意。删除四条 preset 的 6. 复现脚本 请贴出来(探针 + overlay),方便独立验证。 CI 状态(sha 结构化八问
判定:方向正确,代码整洁,测试覆盖充分(6 个新测试 + 更新现有测试,20/20 通过)。等 CI 全绿后出最终合并判定。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI 全绿了。merge master( 本条 PR 侧的工作到此完成:
仍开放(等人工)
CI 绿 + 真机复验通过,这条已具备合并条件,等 owner 决策方案 B 后即可 undraft 合并。 |
(ai: vllm-qwen/qwen3.8-27b) CI 全绿(sha 最终判定:可合并。 方向正确(fail-closed → fail-open + reconcile 兜底),代码整洁,测试覆盖充分(6 个新测试 + 更新现有测试,20/20 本地通过),CI 全绿。无回归。 |
(ai: vllm-qwen/qwen3.8-27b) Re-verified live state: head |
Draft: this replaces a mechanism the owner designed (#3354 / #3662), so it is opened for direction before it is treated as mergeable.
Fixes #7111. Fixes #6456. Root-cause correction: #6470 is a runtime no-op on top of it (see the measurements on both).
The defect
dsh.bundle.patch.ymlgated the four Web presets on the gate service:cordis entry-level
injectis fail-closed: no optional form, no timeout, no fallback. Any missing provider therefore leaves the preset's fiber unconstructed — permanently. Measured on a real host (dsh0.2.2-rc.4, bili at master, one overlay row- id: bili-compaction-gate / disabled: true):The host does not error, boots, and serves its UI; session creation is what fails. That is why the symptom was easy to attribute elsewhere.
Triggers are ordinary operations: the gate subpath failing to resolve, a user toggling that row off in the plugin page (it is an addressable bundle row), or an interrupted install.
The fix
The presets are no longer gated. The always-on gate entry reconciles the ones mounted before it activated:
reconcileLoadedPresets(entries)— for each entry whose resolved config nestscompaction-basic/command-compact, re-submit the config viaentry.update(). That re-runsinternal/config, so the existing overlay rewrites the rows exactly as on a cold resolve. Entries without such rows, and hosts whose entries expose noupdate, are untouched; a throwing entry never takes the gate down.ctx.inject(['loader'], …)— a child fiber, not a hard dependency. A hard dependency would reintroduce this very failure.dsh.bundle.patch.ymlandwriteDshAcpPatch);compactionDisablePatchRows()is gone.docs/clients.md+docs/clients.zh-CN.mddescribe the new behaviour instead of the latch.Trade-off made explicit: losing the gate service now costs the overlay (native compaction stays stock, with the wire-level refusal #1729 as backstop) instead of the session. This follows the availability boundary #3662 already accepted.
Verified on a real host
pending,resolvethrowsagent-preset/not-foundresolve → {"id":"standard"}, rosterstandard/ptc/minimal/cordis, 0 pending, 0 "did not activate"compaction-basicandcommand-compactdisabled: trueTests
tests/issue7111-gate-fail-open.test.ts: neither carrier gates the presets (with the gate entry still mounted); a mounted preset is re-submitted with its nested row disabled and the input config left untouched; entries without rows / withoutupdate/ non-objects are skipped; the gate reconciles through the optional loader, still publishes the service before any loader arrives, and survives a missing loader.issue3354/issue3662are updated to pin the new contract (gate entry mounted, presets not gated) instead of the retired rows.npm run typechecknode --import tsx --test(7111+3354+3662)npm run buildnode tools/check-architecture-docs.mjsKnown gap (deliberate, for the owner to decide)
With the gate absent the degradation is now quiet: sessions work, native compaction is stock, and nothing on the bili side says so (
detectCompactionOverlayGap()lives inside the gate entry, which by definition did not run). #7111 offered option B — a loud boot alarm for "no gate service provider". Say the word and I will fold it in as a follow-up commit on this branch; I left it out to keep this diff to one mechanism.Overlaps
this(#7112) #7115 and [PR] fix(dsh): alarm when the host-plane compaction-basic override is gone (#7113) #7116 both touchdsh-compaction-gate.ts(different concerns: the hook's fiber argument, and the host-plane alarm). Merge order only affects the smallapply()body; I will rebase whichever is not first.