Repository navigation
[PR] Restore dsh native auto-compaction when bili-native is disabled or absent (#5248) - #5994
ranxianglei wants to merge 9 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10775-pr.5994.5178cf7This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5994.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…led (#5248) The bundle patch's static 'compaction-basic -> auto:false' line kept applying whenever the billion-context bundle was mounted — including while bili-native was disabled or dead (no process verdict). Non-web profiles therefore lost their native auto-compaction permanently after a market disable; disabling no longer reversed to stock as documented in #3662. The gate transform now undoes exactly that line when no active verdict exists: only the host-plane compaction-basic entry, only when the patch armed it (auto === false). The declarative line stays in the patch as a fail-safe (gate entry fails to load while bili-native loads => host plane stays stood down). A user's own manual auto:false on that row is indistinguishable at this layer and is restored too (documented edge); if a dsh build never fires the internal/config hook for that entry, this degrades to the old behavior. Closes #5248
edee78d to
f644495
Compare
…sable-restores-stock-compaction
(ai: vllm-qwen/qwen3.8-27b) Verdict: approvable — correct root-cause fix, fail-safe, no unintended regression. I reviewed the diff independently, traced both compression-mode paths, and verified locally (typecheck clean + all 5 touched suites green on the PR head). No changes were needed; the PR stands as-is. What I checked:
One caveat (not a blocker): the two real-dsh assumptions — that the global CI right now (live): 0 failed · 12 success · 3 skipped (gated e2e) · 15 test shards still running. Mergeable but blocked awaiting those + approval. 结构化八问
收工判定:可合(approvable)。方向对、fail-safe、单测双向钉死、diff 干净、本地全绿;唯一待办是真机 dsh 上的生效性确认(e2e 门或人工),因降级安全不构成合并阻塞。 |
…tion Resolve the #5994 merge conflict in docs/clients.zh-CN.md by taking the union of both intents: keep this branch's #5248 host-plane restore clause in the launcher bullet, and take master's #5838 Codex-Responses-WebSocket updates (Profile-install bullet + two new bullets) verbatim. No code was touched — the only hand-resolved file is markdown; all four PR code/test files are byte-identical to the pre-merge head.
(ai: vllm-qwen/qwen3.8-27b) Verified live first (status-freshness), then acted. GitHub reports Action taken: performed the instructed merge of On the earlier red check (the m00122 wake, Also avoided last run's stall: all git/network ops used 八问(中文结论)
收工判定:冲突已消除(实为 behind,已用干净的 master 合并清零),PR 现 |
(ai: vllm-qwen/qwen3.8-27b) Re-verified live — everything is green on the current head; nothing to fix. This wake references the failing check 八问(中文结论)
收工判定:全绿确认。PR 现 |
(ai: vllm-qwen/qwen3.8-27b) Status after the forced restart: my previous work had already completed before the restart — I had verified the fresh head Live re-check just now (mirror cache, I am deliberately not re-merging to chase "behind": every check is already green, this repo's master moves fast enough that the branch would go behind again within hours regardless, and re-merging would only trigger a full CI re-run for zero correctness gain. If you'd like a final freshness merge right before approving/merging, say the word and I'll do it as one last step. 中文结论(重启后状态确认):①问题=无新增(上轮已确认全绿);②原因=master 又前进 5 提交致 PR「behind」,非冲突、非红灯;③影响=仅信息性落后,不阻塞合并;④处置=刻意未再合并——全部检查已绿、master 移动快会很快再次落后、重合只会白跑一整轮 CI;如 owner 想在批准前做最后一次刷新合并,告知即可;⑤回归=无(PR #5248 自身贡献逐字节未变);⑥缓存=不涉及;⑦设计方向=不涉及;⑧新配置=不涉及。判定:CI 侧无需再动,PR 现可合并、待人工审批。 |
这个 PR 的 #5248 修复在真机上永远不会触发(
|
| 步骤 | 代码 | 结论 |
|---|---|---|
| 1 | vendor/cordis/src/fiber.ts:678 fiber.context.waterfall('internal/config', fiber, () => config) |
第一个实参是事件名(字符串) |
| 2 | vendor/cordis/src/events.ts:163 const thisArg = typeof args[0] === 'object' || 'function' ? args.shift() : null |
字符串 → thisArg = null |
| 3 | vendor/cordis/src/events.ts:248-258 waterfall 弹末位作 next,其余作为监听器实参 |
监听器签名是 (fiber, next),this = null |
宿主自己的写法就是取第一个形参(vendor/loader/src/index.ts:104 用 fiber.entry),不用 this。
修法(1 行 + 形参减一)
- ctx.on("internal/config", function (this: MiddlewareSelf, _raw: unknown, next: () => unknown): unknown {
+ ctx.on("internal/config", function (fiber: MiddlewareSelf, next: () => unknown): unknown {
const resolved = next();
- const rawName = this?.entry?.options?.name;
+ const rawName = fiber?.entry?.options?.name;注意形参要少一个:现签名里的 _raw 实际收到的就是 fiber,next 才是链尾函数;保留三个形参会让 next 错位。
为什么现在的测试抓不到
本次新增的两个用例直接调用 transform 函数(不经 cordis 事件派发),所以 this 根本不会参与,测什么都是绿的。要覆盖这条,需要一个真实的 @deepseek-ai/cordis Context 派发一次 internal/config(devDeps 里已有该包),断言"this 为 null 但名字仍取得到"。
顺带:同一种写法在 master 的 src/agent/dsh-compaction-disable.ts:200 已经存在(覆盖遥测的 entry 名恒为 unnamed-entry),我另开了一个 issue 统一修,PR 见那里。
由于我这边没有该分支的写权限,无法按「additive commit」推到本分支;如果 owner 希望合并成一处,我可以把这个改动并到本 PR;否则我会单独提一个最小 PR,并在合并顺序上注明与 #5994 的关系。
…missed (ranxianglei#7112) 8461f55 moved the entry-like object to the first parameter in most mock calls but left two issue3662 sites still passing it as `this` (mw.call(PRESET_SELF, null, next)) — they only stay green because their assertions are name-independent, so the broken binding survives exactly where a future name-keyed branch (e.g. ranxianglei#5994's ranxianglei#5248 restore) would be exercised. Move those two calls to the real binding and rename the identifiers that now lie (PRESET_SELF/self/raw → the fiber they carry), so the mocks cannot silently drift back to the pre-ranxianglei#7112 convention.
cordis dispatches `internal/config` with `this` bound to null and the Fiber as the first listener argument (a string event name never becomes a thisArg). The #5248 restore-auto check read `this?.entry?.options?.name`, which is therefore always undefined, so the host-plane compaction-basic `auto:false` line was never undone after a bili-native disable — #5248 was a no-op. The #4147 telemetry entry name suffered the same (always "unnamed-entry"). Read the entry name from the first param (matching bili's own CompactionDisableHost.on listener type `(raw, next)` and the dsh-native.ts handler convention). The tests now dispatch the middleware the way cordis does — `mw.call(null, fiber, next)` — so the #5248 case reproduces the original no-op and pins the fix.
(ai: vllm-qwen/qwen3.8-27b) @resec 的定位我独立复核后确认成立,已按 additive commit 修进本 PR(不需要你再另开 PR)。 独立验证(不依赖你的描述):
结论:#5248 合入后确实是 no-op( 已做的修复(head
验证边界:单测层(mock ctx 按 cordis 约定派发)已覆盖并跑通;真 dsh e2e 仍 gated(与原 PR 相同),未做真机 e2e。 关于你另开的遥测 issue:与本修复同根因(同一函数、同一 this-is-null),本 PR 合入后即一并解决,可不必单独再修。 八问
判定:修复已作为 additive commit 推入 PR 分支(head |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) (本条为状态确认;完整八问见上一条回复。) #5248 no-op 已修复并推入本 PR,head
|
修法正确,但测试只改了一处派发约定 —— 还有 12 处,CI 的 4 个 shard 红就是它们基线:本 PR head 两行改动本身没有问题(读第一个形参、去掉错误的 复现在 与线上一致: 漏在哪commit 里把 修法一行一个:把 entry-like 对象挪到第一个形参,断言本身不用改。例如 - mw.call({ entry: { options: { name: "preset-general" } } }, null, () => cfg)
+ mw.call(null, { entry: { options: { name: "preset-general" } } }, () => cfg)我在 #7115 的 顺带一条合并顺序耦合
|
…andler 675ebb7 made the internal/config handler read the entry name from the first param (fiber) instead of this. These two suites still passed the entry object as this, so fiber was null and telemetry fell back to unnamed-entry, red-ing 3 assertions across 4 CI shards. Move the entry object into the fiber (1st) param — the cordis convention the handler now follows.
(ai: vllm-qwen/qwen3.8-27b) @resec 定位准确——我上一轮只改了 独立复核 + 修复(head
关于 #7115:未 cherry-pick,而是按同一机械变换在本分支独立提交(有写权限,且与上一轮 合并顺序耦合(仅提示,不阻塞本 PR): 八问
判定:修复已推入 PR 分支(head |
(ai: vllm-qwen/qwen3.8-27b) Inherited failure — resolved by updating the PR's base to current master. (auto-fix lane, attempt 1/6) What happened this run:
七问:
判定:继承性失败已处理,新 CI run 进行中(07:32Z 时 0 failed / 14 pending)。若 windows 22 shard 5 转绿,PR 即就绪;若再次红,由下一次唤醒(attempt 2/6)深挖。已在 #4599(CI 总控)留一行协调评论。 |
(ai: vllm-qwen/qwen3.8-27b) Confirmed green — the reported blocker is stale; no new work needed this run. (auto-fix lane, attempt 1/6) This event reported the red
七问:
判定:全绿,PR 就绪,本轮无进一步动作。 |
…ore path Four unqualified "off everywhere" claims (README en/zh, docs/clients en/zh) contradicted this PR's own behavior: a disabled bili-native restores stock dsh auto-compaction (static auto:false flipped back to auto:true by the gate). Each note now scopes the claim to "while bili-native owns the lane" and points at the restore (#5248).
The PR was authored against the e-work mirror, where the user issue is #5248; on GitHub the user issue is #5245 (GitHub #5248 is an unrelated open PR). All 18 in-PR references (docs en/zh, code comments, patch yml comment, test names) now use the GitHub number so they resolve to the right thread. The PR body's 'Closes #5248' line is the author's to fix.
|
(ai: vllm-qwen/qwen3.8-27b)
Verdict: REQUEST_CHANGES — one cross-reference blocker; the code and tests are soundBlocker (fix before merge)The PR body's Fix: change The fiber fix is correct — and it explains why the original CI was greenThe original fix (f644495) was a production no-op: the
Why the original CI stayed green: the original tests dispatched Regression audit (existing behavior on the touched paths)
Merge-order notes (non-blocking)
House checksNo kernel/, no version bump, no new config surface, no wire/message-shape changes, en/zh doc parity, CI green at ccd113a (30/30 checks, 0 failed, 0 pending). The two docs-only review commits (798ad83, 3ddc191) follow on the same branch. 已顺手修:4 处文档 "off everywhere" 表述按禁用还原路径限定范围(README en/zh、docs/clients en/zh)+ 18 处 issue 引用从镜像号 #5248 改为 GitHub 号 #5245(docs en/zh、代码注释、patch yml 注释、测试名)+ commit 798ad83、3ddc191 结构化八问
判定:REQUEST_CHANGES——唯一阻塞项是 PR 正文 |
(ai: vllm-qwen/qwen3.8-27b) Verdict: APPROVE (posted as a comment — GitHub blocks approving my own PR; the owner can merge directly) This PR restores dsh's native auto-compaction when bili-native is disabled or absent, fixing #5245 (presets stay modified after disabling the plugin). What it does:
Why it's correct:
Tests (real teeth):
House conventions:
CI: green on live head 3ddc191 (38 success, 14 skipped, 0 failed). 八问
判定:可合入(APPROVE)。CI 绿,测试有牙,house conventions 干净,行为变更已披露。 |
What & why
Closes #5245 (same mechanism family as #3889/#3662: the dsh bundle patch outlives the plugin's enabled state).
After disabling
bili-nativein the dsh plugin-market page (or the entry dying), non-web profiles permanently lost dsh's native auto-compaction: the profile bundle patch (dsh.bundle.patch.yml) carries a static line- id: compaction-basic/config: { auto: false }that applies whenever the bundle is mounted — regardless of whetherbili-nativeis alive. That contradicts the contract documented in #3662 ("an absent verdict leaves every row stock"): disabling was supposed to reverse fully to stock dsh behavior, but the host-plane row stayed armed-off forever — "卸载了或者关闭了原本的压缩命令就用不了" (#5245 thread).Fix
registerCompactionDisable(src/agent/dsh-compaction-disable.ts): when NO active process verdict exists (bili-native absent/disabled/dead) and the resolved entry is the host-plane@deepseek-ai/dsh-compaction-basicwithauto === false, the transform returns{...cfg, auto: true}— undoing exactly the line the bundle patch wrote.auto: falseon that same row is indistinguishable at this layer and gets restored too.internal/confighook for the host-plane entry itself, this degrades silently to the pre-fix behavior — zero regression either way.Behavior change (old → new)
auto:false(bili owns compression, #1729)auto:false— native auto-compaction off foreverauto:true— dsh fully backNo new config surface (no env var / config key added). No kernel/ changes. No wire/message-shape changes.
Tests
tests/issue3662-dsh-gate-fallback.test.ts: two new cases — restore direction (patched
{auto:false}→{auto:true}, input not mutated, other keys survive; negatives: already-stock passthrough, other entries untouched, array configs untouched) and non-restore direction (active verdict ⇒ identity passthrough). Both gate directions pinned per #3617. All 5 suites touching the module pass locally (448 tests); typecheck clean. Full-suite verdict = remote CI.Docs: docs/clients.md + .zh-CN.md, docs/configuration.md + .zh-CN.md (dsh sections) updated with en/zh parity.