Skip to content

[PR] fix(dsh): alarm when the host-plane compaction-basic override is gone (#7113) - #7116

Open
resec wants to merge 4 commits into
ranxianglei:masterfrom
resec:2026-11-18_dsh-auto-false-boot-check
Open

resec wants to merge 4 commits into
ranxianglei:masterfrom
resec:2026-11-18_dsh-auto-false-boot-check

Conversation

@resec

@resec resec commented Nov 18, 2026

Copy link
Copy Markdown

Closes #7113.

What & why

dsh.bundle.patch.yml keeps native auto-compaction down with:

- id: compaction-basic
  config:
    auto: false

A dsh patch replaces a row's whole config, and @deepseek-ai/dsh-compaction-basic defaults auto to true. So any layer applied after bili that restates - id: compaction-basic — a hand-written profile patch, a later bundle (installs append), a partial #2474 snapshot, or an innocent-looking thresholdRatio tweak — silently re-arms native compaction. The first symptom is usually a landed checkpoint that destroys the fold base; nothing warns in between.

Measured on a headless profile (--dump-config, bili at master, dsh 0.2.2-rc.4):

baseline                     config: { auto: false }
+ one overlay row            config: { thresholdRatio: 0.9 }      # auto gone

Web profiles are unaffected (that row is disabled: true by dsh-web-app itself), so the exposure is headless / acp / sdk.

Fix

The gate entry scans the composed loader tree once a loader is available and logs one line when the override is gone:

  • hostPlaneRowsMissingAutoFalse(entries) — pure: reports enabled compaction-basic rows whose config.auto !== false, keyed by entry id; stock-disabled rows, unrelated rows and non-object configs are ignored.
  • hostPlaneOverrideLostWarning(ids) — the one-line alarm: names the row, says a later patch layer replaced the config, and gives the fix (restate auto: false in the last row that touches that id).
  • dsh-compaction-gate.ts calls it from ctx.inject(['loader'], …) — deliberately optional: a hard loader dependency would restore the [dsh] Disabling the plugin permanently bricks dsh session creation - the bundle patch inject gate has no fallback (0.1.199 / dsh 0.2.1-rc.2) #3662 failure mode (this entry pends, the four presets wait forever on the service it never publishes).

No self-heal on purpose: rewriting a user's patch row at boot would fight the "patches replace config" design, and this issue is about the silence, not about overriding the operator.

Tests

tests/issue7113-auto-false-boot-check.test.ts (8 cases, both directions per the gate discipline):

  • healthy auto:false → not reported; dropped auto → reported by id; config replaced entirely → reported;
  • stock-disabled web row → not reported; unrelated rows / nulls / array configs handled;
  • alarm text names the row and the auto: false fix;
  • wiring: apply injects ['loader'] softly (not as a hard dependency), hostPlaneWarningFor is silent without a loader and on a healthy tree, and non-null on a dropped override;
  • the service is still published when no loader ever arrives.

Pre-flight

check result
npm run typecheck clean
targeted node --import tsx --test (issue7113 + issue3354 + issue3662) 22/22 pass
npm run build success (dist-import-annotations: OK, dist-external: OK)

Scope

No config-surface change, no version bump. Docs untouched: the mechanism (auto: false in the bundle patch) is unchanged; this only reports when it was lost.

…ranxianglei#7113)

dsh replaces a patch row's whole config and compaction-basic defaults auto to true, so any layer applied after bili that restates id compaction-basic silently re-arms native auto-compaction; the first symptom is a landed checkpoint destroying the fold base. The gate entry now scans the composed loader tree once the loader is available (optional, never a hard dependency) and logs one loud line naming the offending row and the fix.

Detection is pure and covered both ways: healthy declaration silent, dropped auto reported, stock-disabled web row silent, unrelated rows ignored.
@ranxianglei ranxianglei changed the title fix(dsh): alarm when the host-plane compaction-basic override is gone (#7113) [PR] fix(dsh): alarm when the host-plane compaction-basic override is gone (#7113) Nov 18, 2026
The type is only referenced inside the module; the repo's unused-exports gate rejects exported types with no external consumer.
@resec

resec commented Nov 18, 2026 •

Copy link
Copy Markdown
Author

CI 修复(81780db7):HostPlaneEntry 只在本文件内使用,unused-exports 门禁不接受没有外部消费者的导出 → 去掉 export。

本地:typecheck ✅ / 22 用例 ✅ / build ✅ / unused-exports ✅。

@resec resec closed this Nov 18, 2026
@resec resec reopened this Nov 18, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

查重:不重复 — 在途 [PR] 中只有本 PR 针对 #7113 / host-plane auto-false 告警;最接近的是 #5994(PR #5996,反方向:bili-native 被禁用时恢复 native compaction),方向与机制均不同。

标签: 已给 source issue #7113 补 bug、dsh、p2、scope/wiring(GitHub + 镜像,仅新增未动已有)——缺陷类;dsh 客户端车道;host-plane patch 组合 / loader 边界属协议接线;p2:能用但有明显问题,触发条件式(需后续 patch 行重述该行),且有明确绕行(重述 auto: false)。

审核结论:无阻断发现,可合(待 6 个 test 分片转绿)。

① 方向关:issue 要求「启动时读最终 composed 的 compaction-basic,enabled 且 auto !== false 则告警;默认 warn-only 不自愈;不新增配置键」,PR 精确实现——gate entry 软注入 loader 后扫一次 composed 树,输出一行 warn。在决策点(最终组合结果)报告,不做 payload 过滤,是对「沉默」的根因级响应。

② 回归关(触碰路径的既有行为逐项清点):

③ 宿主侧验证(CI 判不了的部分,对真实 dsh 宿主 v0.1.1-rc.2 逐项核对,issue 实测于 0.2.2-rc.4):loader 服务真实存在(cordis-plugin-loader lib/index.js:684 ctx.reflect.provide("loader", …),dsh 自身 profile-boot 就用 ctx.get("loader"));entries() 形状与 PR 假设一致(options.id/name/disabled/config,id 缺失时自动生成);时序成立——所有 patch 层先由 composeProfile 合成单行索引,Entry 的最终 options 在任一 plugin import 完成前同步落位,dsh-app-boot 在 app 启动前 await loader,故 gate entry 的 apply 运行时 entries() 即完整 composed 树。PR 的核心假设全部成立。

④ 测试有效性:8 用例、双向(healthy→不报 / 丢 auto→按 id 报 / config 整体被换→报 / disabled 行→不报 / 噪声输入 / 告警文本 / 软注入 wiring / 无 loader 时 service 仍发布),断言均为真(deepEqual/match),非恒真。缺口:无真实 dsh 宿主 e2e pin(PR 用 --dump-config 手工实测)——建议,不阻断。

⑤ diff 整洁度:3 文件 +158/−3,每行都与本 PR 目的相关;第二 commit 是 unused-exports 门禁的正当修复,标注清楚。代码质量(命名/死代码/重复/错误处理/魔法值/注释/风格)逐项过,达标。

非阻断发现(记录在案,留给作者裁量,未动分支):

  1. 两个假阳性边缘(warn-only,无害):disabled 可以是 !!js 表达式,PR 只跳过 === true,JS 禁用的行会被报;effective disabled 还看父 entry,PR 只看自身 options,disabled 父组下的行会被报。两者都是罕见场景,修它们需把纯函数契约从 options-based 改成 host-getter-based,属设计取舍;
  2. 无 verdict gating:bili-native 不活跃时(用户禁用了 bili)扫描仍会跑,有意为之的 re-arm 会得到一条事实准确但偏吵的告警——issue 规格未要求 gating,可接受;
  3. 建议后续补一个真实 dsh 宿主的 e2e pin(--dump-config 实测不可在 CI 复现)。

CI(13:11 实时读镜像缓存):30 checks,0 failed,6 pending——全部 6 个是 test 车道分片(ubuntu/windows × node 22/24);typecheck/build/unused-exports/kernel-guard 等已全绿。本地 workdir 无 node_modules,未本地复跑测试(环境问题,非测试失败),终局判定以 CI 为准。

八问

  1. 是什么问题:dsh patch 整行替换 config,任何后续层重述 compaction-basic 而漏掉 auto: false,native 自动压缩就被静默重新武装,第一个 checkpoint 落地即摧毁 fold base——中间无任何告警。
  2. 什么原因导致的:dsh patch 组合语义是「后行整行替换 config」(非 deep merge),compaction-basic 默认 auto: true;bili 的覆盖只存在于 bundle patch 那一行,行被替换后覆盖即消失,且无人检查最终组合结果。
  3. 影响范围与严重程度:headless/acp/sdk profile(web profile 的该行被 dsh-web-app 自身 disabled: true,不受影响);触发条件 = 后续 patch 层重述该行(手写 profile patch、后装 bundle、部分 fix(dsh): profile 层 patch 其实可以关掉 web profile 的原生自动压缩(#1772 结论修正)+ 一个会静默清空整个 preset 的写法坑 #2474 快照、甚至无辜的 thresholdRatio 微调);严重度 = 能用但有明显问题,触发后 checkpoint 毁 fold base,有明确绕行。
  4. 怎么修复的:启动时读一次最终 composed 的 loader 树,凡 enabled 的 compaction-basic 行 auto !== false 即输出一行 warn(点名行 + 说明机制 + 给修法);刻意不自愈(改写用户 patch 行会与「patches replace config」设计对抗);刻意软注入(硬依赖会恢复 [dsh] Disabling the plugin permanently bricks dsh session creation - the bundle patch inject gate has no fallback (0.1.199 / dsh 0.2.1-rc.2) #3662 的 pending 失败模式)。
  5. 是否有回归问题:无——触碰路径的既有行为(gate 拆分 / structural walk / telemetry / preset 检测器 / inject: [] pin)逐项清点全部保持;降级完全静默;唯一新行为是启动 warn 行本身,PR 正文已披露。
  6. 是否破坏缓存:不涉及——缓存/重试/增量游标/去重键均未触碰。
  7. 是否改了设计方向:不涉及——压缩所有权设计(bili 活跃时由 bili 负责压缩)不变,只在协议边界加了一个观测点。
  8. 是否引入了新的配置:不涉及——无新 env/config/CLI,PR 正文已声明 no config-surface change。

判定:可合——等 6 个 test 分片转绿即可;上述三条非阻断发现记录在案,由作者裁量。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

CI 终态更正(上一条 13:11 的读取已过时):30 checks,29 绿,1 红——test (windows-latest, 22, 5)。

该红为继承性失败,与本 PR diff 无关(已逐层核实):

审核结论不变:无阻断发现,该红不属于本 PR。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

收工摘要(本会话全部交付已落地,详见 floor 4 八问 review 与 floor 6 CI 更正):

  1. 审核完成:无阻断发现,可合——方向、回归、宿主机制(对真实 dsh 宿主逐项核对)、测试双向性、diff 整洁度全过;3 条非阻断发现记录在案留给作者裁量。
  2. 标签:source issue [Bug][dsh] a later patch row silently re-arms native compaction: compaction-basic.auto:false is dropped by whole-config replacement, with no boot check #7113 已补 bug / dsh / p2 / scope/wiring(GitHub + 镜像,仅新增)。
  3. CI 终态:29 绿 1 红;唯一红 test (windows-latest, 22, 5) 为继承性 master 红(server-process-listeners.test.ts Windows 确定性失败,[PR] batch-2: 4 held Afloat16 fixes (2 as-is, 2 with review-patch commits) #7101 引入,与本 PR diff 零重叠),已按政策在 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 报告(comment 89118),不在本分支重复修。
  4. 剩余一项:ci-fixes(7247410976)目前仍不含该修复(刚复查确认)——等哨兵把 win32 门控修复收敛进 ci-fixes 后,本 PR 分支 merge ci-fixes + push 即转绿,后续唤醒会跟进。

本 PR 代码侧无待办,等 CI 转绿 + 人工合并。

@resec

resec commented Nov 18, 2026

Copy link
Copy Markdown
Author

唯一红是 master 侧已修的测试可移植性缺陷,本分支 base 没带上

9d75e7cb 的 run 44249183921 只红一个 job:test (windows-latest, 22, 5)。它不是本 PR 的逻辑问题,也不是 flake:

  • 日志:[ci-tests] swallowed file-level failure(s) — zero subtests, payload only 'test failed': tests/server-process-listeners.test.ts (#3029);
  • 隔离重跑:REPRODUCED in isolation (deterministic break);
  • 整轮重试后:full retry also FAILED … -> genuine failure, not a flaky。

根因在 master 侧,且 master 已经修了:3186e54a fix(tests): make the shutdown-signal test portable to Windows (it killed its own child on win32)(只改 tests/server-process-listeners.test.ts,+34/−4)。

本分支的 base 停在 4b77eab4(12:27Z,早于该修复),所以仍然红。对照:#7115 已合并到 548e3960(含 3186e54a),同一个 windows-22/5 shard 全绿(run 44249210808 success)——同一台 runner、同一 master 内容,差别只在 base。

已处理

  • git merge upstream/master(548e3960,无冲突)→ head d5f9fbb1,未 force。
  • 本地门禁全绿:npm run typecheck ✅ / check-unused-exports ✅(12 waived)/ check-test-import-graph ✅ / tests/issue7113-auto-false-boot-check.test.ts 8/8 ✅ / npm run build ✅。
  • 代码未改一行,diff 只多一个 merge commit。
  • 注:master 上 mergeable_state: behind 的问题同时消解。

等新 head 的 CI。若 windows-22/5 在 d5f9fbb1 上转绿,本 PR 就只剩「owner 人工合入」这一步。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI re-verified live: the PR is fully green — nothing left to fix this run.

No code changes were made this run — no pushes. Closure note posted in #4599.


八问

  1. 是什么问题:PR 唯一红项 test (windows-latest, 22, 5)——tests/server-process-listeners.test.ts 在 Windows 上确定性失败([PR] batch-2: 4 held Afloat16 fixes (2 as-is, 2 with review-patch commits) #7101 批次新测试),与本 PR 的 dsh 改动无关。
  2. 什么原因导致的:根因在 master 侧——该测试用 process.kill(process.pid, "SIGINT") 模拟 Ctrl+C,Windows 上走 TerminateProcess(signal 参数被忽略),测试进程当场被杀;本分支 base 停在 master 修复 3186e54ad2 之前,故继承此红。
  3. 影响范围与严重程度:继承性 CI 红——凡 base 早于 3186e54ad2 的 PR 都会在 windows 22/24 的 shard 5 命中同一红;不影响本 PR 代码正确性,无用户侧影响(仅 CI 阻塞合并)。
  4. 怎么修复的:本分支无需修复——master 已修(3186e54ad2,win32 可移植化),作者已把 master 合入分支(head d5f9fbb1),CI 自然转绿;本 run 只做核实,零代码改动。
  5. 是否有回归问题:无——本 run 零改动;作者的 merge 经核实仅带入 master 内容(测试文件与 master 逐字节一致),无本 PR 语义漂移。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

结论:CI 全绿(run 44254859703 success),本 PR 无 CI 阻塞,等人工合并。

This branch has not been deployed

No deployments
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.

[Bug][dsh] a later patch row silently re-arms native compaction: compaction-basic.auto:false is dropped by whole-config replacement, with no boot check

2 participants