Repository navigation
Description
Summary
In DSH, billion-context disables the host's native compaction while active, and it never rewrites the host's session file (documented behavior, #5796). As a result a session can legitimately grow far beyond the model window. That is fine while bili is active — bili compresses on the request side.
But when bili is removed from dsh.profile.bundles, the host's native compaction comes back with an overflow-recovery strategy that replays the entire history into a single summarization call. For a bili-era history that is already larger than the window, that summarization call is itself over the limit, so it can never succeed. The session is then permanently unusable — every turn returns a provider 400 and every fallback compaction also 400s.
There is no uninstall-time check, no warning, and no "compact this session down to the window" tool. The only escape is to reinstall bili, or to abandon the session.
This is closely related to #6121 (long bili history overflows a native summarization call) and #5033 (both compressors disabled = deadlock), but the uninstall path is not covered by either: #6121 is about selecting native compaction while bili is still installed, and #5033 is about bili failing to intercept traffic. Searching uninstall in:title returns 0 results.
Environment
- DSH desktop host:
0.2.2-rc.1(@deepseek-ai/dsh-desktop-runtime, read fromapp.asar/dsh/package.json) - Profile:
desktop(custom profile under a relocatedDSH_HOME) - billion-context:
0.1.213(latest release at report time is0.1.215) - Provider/model:
deepseek-account / deepseek-flash, declaredcontextWindow: 1048576,maxTokens: 256000 - OS: Windows 11
- Storage:
session.v4.jsonl.zstd(zstd multi-frame JSONL, format v4)
Steps to reproduce
- Install bili and register it as a bundle layer:
- add
billion-contexttodsh.profile.bundlesin the profilepackage.json - restart DSH
- add
- Use a session normally until its host-side history exceeds the model window. In the reported case:
- 20,865 events,
session.v4.jsonl.zstd= 16,025,622 bytes - last successful turn: turn 81
- 20,865 events,
- Remove
billion-contextfromdsh.profile.bundles(do not remove it fromdependencies, sonode_modulesstays) and restart DSH.- Note: this is the documented uninstall path — the bundle patch itself says "to uninstall, remove billion-context from dsh.profile.bundles instead".
- Open that session and send any message (e.g.
继续).
Actual behavior
Every turn fails with a provider context-length error, and the host's own fallback compaction fails the same way:
assistant/attempt (seq 20860)
error: This model's maximum context length is 1048576 tokens.
However, you requested 2587168 tokens
(2331168 in the messages, 256000 in the completion).
compaction/start (seq 20861) <- native overflow recovery begins
compaction/end (seq 20862)
error: This model's maximum context length is 1048576 tokens.
However, you requested 2397083 tokens
(2331547 in the messages, 65536 in the completion).
turn/end (seq 20864)
reason: error
The session is permanently stuck: the recovery path (summarize) needs a request smaller than the window, but the summarization request replays the whole oversized region, so it is always oversized.
For reference, the last pressure-triggered compaction attempt (seq 20853) also failed: requested 2204602 tokens.
Root cause
Layer 1 — bili's design (by design, documented).
dsh.bundle.patch.yml (still identical on master today) does:
- insert:
- id: bili-native
name: billion-context
- id: bili-compaction-gate
name: billion-context/dsh-compaction-gate
- id: compaction-basic
config:
auto: false # <- host auto-compaction OFF while bili is active
- id: preset-standard
inject: [biliBasicCompactionPolicy]
# ... same inject for preset-ptc / preset-minimal / preset-cordisTwo compressors must not fight over one history (#1772 / #2474 / #3354), so host compaction is switched off. And per README #5796, bili "never rewrites the client's own conversation file — compression shrinks what is sent to the model". So the host JSONL grows without bound during the bili era.
Layer 2 — stock DSH cannot recover once it is back.
@deepseek-ai/dsh-compaction-basic's overflow path is:
// context-overflow recovery
const range = selectCompactableRange(agent.session, measurement, /* retainTokens */ 0);
// -> range covers essentially the entire surface
const summarized = await summarizeCompaction(...); // replays the whole region as one requestWith retainTokens = 0 the summarization input is the whole oversize surface, so the summarizing call itself exceeds the window (2,397,083 > 1,048,576). The pressure branch has the same problem (it reuses the same whole-region summarization), and /compact does too (compactNow uses retainTokens = 0 as well). There is no truncate-then-summarize, no chunked/segmented summarization, and no hard local trim — so no automatic path can ever recover.
Result: bili gone → bili can't compress; host can't compress because its only strategy needs a sub-window request. Dead end.
Evidence
-
Session metadata (
session_projcache):contextPressure:surfaceTokens 1,389,056vscontextWindow 1,048,576(+340,480 over)contextBreakdown:messageTokens 1,386,410,toolsTokens 18,511,systemTokens 3,154sessionStats:turns 84,steps 2,897
-
Last successful compaction while bili was active: seq 4519 (2026-11-12). After that, 11,000+ events were append-only, never compacted by the host.
-
bili's own log at the moment of failure: bili had to refuse locally too:
[dsh-client] bili-native-dsh: takeover gate refused … LOCALLY (422) — attribution threw and body est ~2171329 tok (the optimistic floor alone already exceeds the window) vs window 1048576i.e. bili also could not recover this history (a separate issue — bili's own gate gives up on very large bodies), which is how the user ended up uninstalling bili.
-
Health statistics on this machine: only 2 of 597 sessions were over-window, and both are the same lineage (a session plus its seeded fork). So this is not a widespread runaway, it is specifically "bili-era long sessions".
There are two different "turn bili off" paths, and each has a distinct failure
This matters because the failure mode depends on how the user turns bili off:
| Path | What happens |
|---|---|
A. Remove billion-context from dsh.profile.bundles (the documented uninstall) |
Patch layer disappears, host compaction returns with auto: true → this report: bili-era sessions are over-window and stock compaction cannot summarize them. |
B. Disable the bili-native loader entry only (UI toggle / disabled: true) |
Per the patch's own comment (#3662) this is supposed to be safe: it is allowed to leave bili-compaction-gate alive so presets fall back to stock compaction. |
C. Disable the bili-compaction-gate entry as well |
The patch explicitly warns this bricks session creation — presets wait forever on a service that no longer exists: "Do NOT disable the bili-compaction-gate entry itself … to uninstall, remove billion-context from dsh.profile.bundles instead." |
So the design deliberately keeps a "gate" service alive to protect path B, but path A — the only officially recommended uninstall — has no protection at all for pre-existing long sessions. That asymmetry is the actual gap.
Why "just open a new session" is not a complete answer
README #5796 does recommend rotating to a new session for very long histories, and that is reasonable while bili is installed. The problem here is narrower and more surprising: the recommendation is not visible at uninstall time, and the user discovers it only after their existing session is already unrecoverable. A user who uninstalls bili because it is malfunctioning (see the takeover gate refused above) ends up worse off than before — the session, not just the plugin, is lost.
Suggested fixes (any one of these closes the hole)
-
Uninstall-time guard (cheapest, highest value). When bili is removed from
dsh.profile.bundles, scan the profile's sessions forsurfaceTokens > contextWindowand print a loud, actionable warning: which sessions will break, and what to do (reinstall and compact first / rotate to a new session). Fail loud, not silent. -
Provide a real "compact the host history" tool. e.g.
bili dsh compact-now --session <id>(or a one-shot mode of the launcher) that, while bili is still active, writes a genuine DSH compaction checkpoint into the host log, so the host's own surface becomes small. After that, uninstalling bili is safe.This is not hypothetical — I performed exactly this recovery by hand on the reported session, and it works. The minimal, verifiable recipe on a v4
session.v4.jsonl.zstd:- append
compaction/start({compactionId, turn: null}) - append
compaction/summary({compactionId, summary: [{type:'text', text}], shadowedRange: {start, end}, shadowedSeqs, shadowedTokenCount}) - append a checkpoint
user/messagewithsurfaceOp: {op:'replace', startSeq, endSeq}andsourceEventSeqs: [startSeq, summarySeq, ...every shadowed surface node],data.source = {kind:'compact-checkpoint', compactionId}, and content framed as<compacted-summary>…</compacted-summary> - append
compaction/end({compactionId, turn: null})
i.e. the exact event quadruple that
compactSurfaceRegion()writes on success (@deepseek-ai/dsh-session/lib/types/surface.js+dsh-compaction-basic/lib/index.js) — only the summary text is produced out-of-band instead of by an LLM call that cannot fit in the window.Measured result: 20,865 events → surface 4,740 nodes / 2,331,168 tokens became 2 nodes / ~54,000 tokens, every original event preserved (shadowed, never deleted), and the session continues in stock DSH with bili uninstalled and no bili process running. So a one-shot "compact to window" capability is feasible purely at the host-log level and does not need the model to see the oversized history.
(If the maintainers prefer not to grow a CLI, even a documented manual recipe would help — the format is public and the four events are enough.)
- append
-
Doc: an explicit "before you uninstall" section in
CLIENTS.md/README stating that bili-era sessions can exceed the window and cannot be continued by stock DSH, plus the two escape routes. -
Cross-repo (DSH) ask, already noted as decision item B in [PR] fix: pause compression nudges when folds stop shrinking the session #5092:
dsh-compaction-basicshould trim-then-summarize (or segment the summarization) on overflow instead of replaying the entire region. Without this, any host whose history exceeds the window is unrecoverable, bili or not.
Note: draft PR #6123 (dsh.nativeCompactionModels) does not cover this report — it routes selected models to native compaction while bili remains installed; it explicitly says an oversized native request keeps stock failure behavior. It does not help after uninstall.
Related
- DSH: select models for native compaction with safe same-session handoff #6121 — "a long raw bili history can overflow a native summarization call" (same failure shape, switching models while bili stays installed)
- [PR] feat(dsh): route models between stock native and bili compaction #6123 — draft routing feature (does not cover uninstall)
- [Feature] Support third-party Antigravity provider (dsh-tool-antigravity) in DeepSeek Harness | Model traffic intercepti | [Feature] Support third-party Antigravity provider (dsh-tool-antigravity) in DeepSeek Harness | Model traffic intercepti | [Feature… #5033 — "bili 抓不到无法压,DSH 自带的原生压缩又被关闭" deadlock (same two-compressor dead end, different trigger)
- [PR] fix: pause compression nudges when folds stop shrinking the session #5092 — reports a session "permanently bricked" by the host's pre-send overflow guard, and lists "local-trim-on-overflow instead of hard refusal" as an out-of-scope upstream ask
- [feat][dsh] Long sessions have no convergence path: compaction gated off on both sides, incremental lane full-resends on OpenAI wire | 长会话没有收敛通道:compaction 双向封锁 + 增量车道全量重发 #5796 (README) — the "bili never rewrites the host file" guarantee and the rotate-to-new-session advice
dsh.bundle.patch.yml禁用自动压缩在 web profile 下静默失效 #1772 / fix(dsh): profile 层 patch 其实可以关掉 web profile 的原生自动压缩(#1772 结论修正)+ 一个会静默清空整个 preset 的写法坑 #2474 / See how to integrate the plugin that automatically disables dsh compression. | 自动关闭 dsh 压缩的插件看如何集成 #3354 — why host compaction is disabled while bili is active
Latest-version check
- Latest published release: v0.1.215 (2026-11-15). The reporter's environment is 0.1.213.
dsh.bundle.patch.ymlonmaster(fetched 2026-11-17) is unchanged: it still setscompaction-basic.auto: falseand still injectsbiliBasicCompactionPolicyinto all four presets. So the "host compaction off while bili is on" design, and therefore this uninstall hole, is still present in the latest code.- No existing issue covers the uninstall path (
uninstall in:title→ 0 results).
中文摘要
问题:bili 激活时会关掉 DSH 自带的自动压缩(两个压缩器不能抢同一份历史),且它从不改写宿主会话文件,所以宿主 jsonl 会无上限增长。卸载 bili(把 billion-context 从 dsh.profile.bundles 移除,这是文档写的唯一正确卸载方式)之后,宿主压缩恢复,但它的溢出恢复策略是「把整段历史重放给模型做摘要」——对已经超过窗口的历史,这个摘要请求本身也超窗(实测 2,397,083 > 1,048,576),于是每轮都 400、兜底压缩也 400,会话永久卡死。没有任何卸载期检查或警告,也没有「把宿主历史压实到窗口内」的工具。
复现:装上 bili 用 deepseek-flash(1M 窗口)把会话跑到宿主侧 > 233 万 tokens(20,865 事件 / 16MB jsonl)→ 从 bundles 移除 bili → 重启 → 在原会话发任意消息 → 400;compaction/start 自动触发但 compaction/end 也报 400。
已验证:最新版 0.1.215 的 dsh.bundle.patch.yml 与 master 一致,仍 auto: false,所以最新版同样存在;仓库内 uninstall 标题检索 0 条,属未覆盖路径。
建议:①卸载时扫描并警告超窗会话;②提供「bili 还装着时就把宿主历史压实」的一次性工具(写一条真正的 compaction/checkpoint 事件即可,原始事件只被 shadow、不删除);③文档增加「卸载前必读」;④DSH 侧把 overflow 恢复改成先截断再摘要(#5092 已列为 upstream ask)。
AI 生成说明
本 issue 的正文与复现证据由 dsh(DeepSeek Harness) 在
deepseek-account / deepseek-flash(reasoning effort: max)配置下辅助撰写与整理:排查、日志解读、会话事件流分析与修复验证均在本地实际执行,非纯人工手打。请以仓库实际复现结果为准。
Activity
ranxianglei commentedon Nov 16, 2026
(ai: qwen/qwen3.8-27b)
查重:不重复。 最接近的是 #5994(PR「Restore dsh native auto-compaction when bili-native is disabled or absent」),但它覆盖的是路径 B(禁用
bili-native、bundle 仍挂载),其行为表明确写uninstall (bundle removed) | stock | unchanged—— 即卸载路径它明确不碰。本 issue 是路径 A(从dsh.profile.bundles移除 = 卸载),#5994 不覆盖。uninstall in:title全仓检索仅此一条,无重复。(注:正文「Related」里的 #5033 / #5092 实际指向别的 issue——#5033 是 Antigravity provider 功能、#5092 是「暂停 nudge」的 PR,疑似 AI 生成时的编号错误;我以独立检索为准,不沿用这两个编号。)
验证(master
de895aa88c核对,问题属实):dsh.bundle.patch.yml:26-28仍compaction-basic auto: false+ 四个 preset 注入biliBasicCompactionPolicy—— 「bili 激活时关宿主压缩」的设计在最新版仍存在。README.md:405-416写明「bili never rewrites」宿主文件 + 「practical convergence path is to start a new session」—— 但这条建议不在卸载时可见,用户卸载后才发现会话已不可恢复。src/plugin-install.ts:1669dshRemove()(=bili plugin remove dsh,与手动从 bundles 移除同一通道)是卸载路径,无任何会话扫描/警告。bili dsh compact-now之类命令)。层次定位:
dsh.bundle.patch.yml禁用自动压缩在 web profile 下静默失效 #1772/fix(dsh): profile 层 patch 其实可以关掉 web profile 的原生自动压缩(#1772 结论修正)+ 一个会静默清空整个 preset 的写法坑 #2474/See how to integrate the plugin that automatically disables dsh compression. | 自动关闭 dsh 压缩的插件看如何集成 #3354/[feat][dsh] Long sessions have no convergence path: compaction gated off on both sides, incremental lane full-resends on OpenAI wire | 长会话没有收敛通道:compaction 双向封锁 + 增量车道全量重发 #5796),本身不是 bug。方案评估 + 推荐:
dshRemove()扫超窗会话并响亮警告)bili dsh compact-now(bili 仍激活时写真 compaction checkpoint 进宿主日志)推荐路径:③ 现在做(止血)→ ① 请 owner 拍板后做(堵静默砖化)→ ② 后续排期(用户已验证、实现更重)→ ④ 跨仓库单列。
八问(针对 ③ + ①):
dshRemove()扫描超窗会话并响亮警告(重装先压实 / 换新会话两条出路)。下一步:我现在开 ③ 文档 PR;① 卸载守卫等 owner 拍板(可并入同一 PR);② 压实工具、④ DSH 侧单列。请 owner 就 ① 是否做、② 是否排期拍板。
ranxianglei commentedon Nov 16, 2026
(ai: qwen/qwen3.8-27b)
文档止血已落地,PR 已开:#6975
PR 内容(修复③,无需决策的部分)
docs/clients.md+docs/clients.zh-CN.md:dsh 章节新增「Before you uninstall (DSH: uninstalling billion-context permanently bricks existing long sessions — no downgrade path from bili-only history #6972) / 卸载前必读」条目,紧挨现有的「禁用 vs 移除」说明。README.md+README.zh-CN.md:从「压缩会缩小客户端自己的对话文件吗?」一节加一行交叉引用指向新条目。待 owner 拍板(①② 定了我就加进 #6975 同一分支)
八问(针对①② 决策):
dshRemove()扫描会话 surfaceTokens,超窗大声警告)→ 再②(根治:卸载前把真实压缩 checkpoint 写进宿主日志,用户已手工验证四事件配方)。bili dsh compact-now(非配置项)。选项对比:
④(DSH 侧 trim-then-summarize)跨仓,另走。owner 定了①② 我就加进 #6975。
docs: add dsh "before you uninstall" warning (#6972)
ranxianglei commentedon Nov 16, 2026
(已收)本单已归入根因聚合 issue(token 见聚合单 body),机器人已停止在本单上的工作,修复走聚合 issue 统一出 PR;本单保留不关,修复验证后统一关闭。(聚合单:[Root Cause] dsh-drift (4 items),GitHub #6980)