Repository navigation
feat: disable dsh native auto-compaction in web profiles at load time (#3354) - #3451
Conversation
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复 —— 按「dsh compaction disable / deshark42 / web profile preset compaction / load-time overlay」等关键词检索了 open+closed issue 与近期 PR,无同症状+同机制的在途条目。本 PR(#3451,Closes #3354)是该机制的唯一实现;近邻项 #3294(把 #2474 手工配方收紧为 审核初步结论:
现在把分支 rebase 到当前 master 解掉冲突,本地跑定向验证(typecheck + 相关测试文件),push 回 PR 分支,再给完整八问结论。 |
a788b47 to
4253b41
Compare
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4068-pr.3451.2684a02This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3451.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 冲突已解决,PR 恢复可合并(mergeable: true,当前 blocked 状态是新 head 的 CI 检查还在跑)。 做了什么:把分支 冲突原因:本分支切出后,master 合入了 dsh 增量轮次标记系列(#3248 phase 2、#3369/#3370/#3378 修复),与本 PR 在三个文件的同一处 import 区各自加了新行——纯并行添加,无语义交叉:
验证:rebase 后 diff stat 与 rebase 前完全一致(12 文件,+415/-74,内容零改动);本地 typecheck 通过;定向跑 八问:
收工判定:冲突已清,等 CI 转绿后即可人工合并。 |
… gate The four package-name/preset-id constants in dsh-compaction-disable.ts are consumed only within that module; dropping their leading export satisfies the unused-exports CI gate without changing any behavior or public surface. Refs #3451
(ai: vllm-qwen/qwen3.8-27b) 审核结论:方向正确,可合。 我把分支 rebase 到了当前 master,并修掉了 CI 唯一红门( 查重:不重复(首条已述——#3294 与已关闭的 #2476/#1786 都是「手动 fallback 配方」打磨,与本 PR「load-time 摘除生产者」机制不同,互补不重复)。 ① 是什么问题:dsh web profile 里内置的 compaction-basic 实例嵌在 agent preset 里,dsh 的 patch 引擎按 id 够不到嵌套行(#1772/#2360),旧的 #2474 全量快照配方还会冻住 roster——需要在 load-time 把它摘掉,而不是在 wire 层拒绝。 ② 什么原因导致的(根因):web profile 的 compaction-basic 实例嵌套在 agent preset 的 ③ 影响范围与严重程度:bili ON + dsh web profile(preset-standard/ptc/minimal/cordis)→ dsh 原生 auto-compaction 从 ON 变 OFF(load-time),该 profile 内 ④ 怎么修的(方案):vendor 一个纯函数模块 ⑤ 是否有回归问题:审了触碰路径的既有行为—— ⑥ 是否破坏缓存:不涉及(无缓存/重试/增量游标/去重键改动)。 ⑦ 是否改了设计方向:不转向,是在既有「load-time 疏 vs wire 层堵」框架内落地,符合你「直接 include 关键代码并注明出处」的决策。 ⑧ 是否引入新配置:不涉及(无新 env/config/CLI flag;那个 service 名是内部常量,不是配置面)。 我这轮实际做的事:
收工判定:方向正确、可合。 唯一阻塞项 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.511-master.baffc28 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #3354
What
Vendors the key mechanism of deshark42/dsh-compaction-basic-disable (v0.1.1, MIT © 2026 deshark42) into bili's own bundle layer — ported into
src/agent/dsh-compaction-disable.tsat the author's suggestion (their repo issue #1) and per owner decision on #3354 ("直接 include 进来关键代码,并在备注中写明出处").In profiles bundling
@deepseek-ai/dsh-web-appthe runningcompaction-basicinstance lives inside an agent preset (preset-standard.config.plugins) where no patch layer can address the nested row by id (#1772/#2360). The bundled- id: compaction-basic / auto: falselands on web-app's already-disabled host-plane row and changes nothing — so dsh native auto-compaction stayed ON while bili owns the lane, protected only by the wire-level refusal guard (#1729): any checkpoint that lands outside bili's knowledge durably shadows the raw history and destroys the compression substrate. The #2474 full-snapshot recipe closed the gap but freezes the preset roster until re-copied after every dsh preset update.This change removes the producer at load time instead:
src/agent/dsh-compaction-disable.ts(new, ~90 lines, zero deps): pure recursive row marking (compaction-basic+command-compact→disabled: true, detached copies), a cordisinternal/configmiddleware registered{global: true}that applies it to every@deepseek-ai/dsh-agent-presetresolved config, and a gate service (biliBasicCompactionPolicy) provided AFTER the middleware registers.src/agent/dsh-native.ts:apply()callsregisterCompactionDisable(ctx)right after the kill-switch early return (a kill-switched bili hands the lane back to stock dsh); boot note rewritten (still one durable[dsh-client]line, now naming both paths).dsh.bundle.patch.yml+ launcher overlay (writeDshAcpPatch, single source of truthcompactionDisablePatchRows()pinned by test): four preset gate rows (preset-standard/-ptc/-minimal/-cordisinject: [biliBasicCompactionPolicy]). Entry inject lists are REPLACED by patches, not concatenated — if a future dsh ships its own inject list on these entries, merge manually in both layers (commented in both).Behavior changes (old → new)
/compactavailabledisabled: true);/compactunavailable there; ACP compression unaffectedauto: false; manual/compactavailableplan.mode === "off"Fail-safe degradation per layer: no
internal/confighook (older/newer dsh builds where the internal hook moved) → pre-#3354 behavior, wire guard stays the backstop, documented #2474 recipe remains the manual path; no service registry → presets boot as before. If bili's own bundle entry fails to load, the inject gate leaves the four presets pending rather than starting unprotected (same validated design as the upstream plugin).Coexistence with the upstream plugin is safe: different gate service name, both overlays idempotent (
disabled: truetwice =disabled: true).Config surface
No change — no new env var, config key, or CLI flag.
Tests
tests/issue3354-dsh-compaction-disable.test.ts: row-marking depth/purity/degenerate inputs, per-layer degradation, entry-predicate transform, and byte-exact agreement between the root bundle yml and the launcher overlay.tests/dsh-native.test.ts: mockCtx gains registry/event-bus capture; kill-switch test asserts NO overlay registration and NO gate publish; web-profile boot-note assertions updated; new attach-mode test asserts middleware registered + gate published (provide after register).tests/issue3354-*,tests/dsh-native.test.ts,tests/launcher.test.ts,tests/issue2605-dsh-retry-patch.test.ts(357 tests, 0 failures). Full-suite verdict = CI.No changes under
kernel/orpi-subagents/; no version bump.