Skip to content

DSH: uninstalling billion-context permanently bricks existing long sessions — no downgrade path from bili-only history #6972

Open

Description

@Buugugu

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 from app.asar/dsh/package.json)
  • Profile: desktop (custom profile under a relocated DSH_HOME)
  • billion-context: 0.1.213 (latest release at report time is 0.1.215)
  • Provider/model: deepseek-account / deepseek-flash, declared contextWindow: 1048576, maxTokens: 256000
  • OS: Windows 11
  • Storage: session.v4.jsonl.zstd (zstd multi-frame JSONL, format v4)

Steps to reproduce

  1. Install bili and register it as a bundle layer:
    • add billion-context to dsh.profile.bundles in the profile package.json
    • restart DSH
  2. 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
  3. Remove billion-context from dsh.profile.bundles (do not remove it from dependencies, so node_modules stays) 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".
  4. 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-cordis

Two 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 request

With 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,056 vs contextWindow 1,048,576 (+340,480 over)
    • contextBreakdown: messageTokens 1,386,410, toolsTokens 18,511, systemTokens 3,154
    • sessionStats: 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 1048576
    

    i.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)

  1. Uninstall-time guard (cheapest, highest value). When bili is removed from dsh.profile.bundles, scan the profile's sessions for surfaceTokens > contextWindow and 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.

  2. 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/message with surfaceOp: {op:'replace', startSeq, endSeq} and sourceEventSeqs: [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.)

  3. 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.

  4. 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-basic should 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

Latest-version check

  • Latest published release: v0.1.215 (2026-11-15). The reporter's environment is 0.1.213.
  • dsh.bundle.patch.yml on master (fetched 2026-11-17) is unchanged: it still sets compaction-basic.auto: false and still injects biliBasicCompactionPolicy into 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

  1. ranxianglei commented on Nov 16, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (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:1669 dshRemove()(= bili plugin remove dsh,与手动从 bundles 移除同一通道)是卸载路径,无任何会话扫描/警告。
    • 全仓无「compact host history」工具(无 bili dsh compact-now 之类命令)。

    层次定位:

    方案评估 + 推荐:

    方案 性质 评估
    ① 卸载时守卫(dshRemove() 扫超窗会话并响亮警告) 新功能面 便宜、直接堵住「静默砖化」,推荐先做
    ② bili dsh compact-now(bili 仍激活时写真 compaction checkpoint 进宿主日志) 新功能面 最有价值但最重;用户已手工验证配方可行(20,865 事件 → 2 节点 / ~54K tokens)
    ③ 文档「卸载前必读」 文档 安全、无决策依赖,我现在就做
    ④ DSH 侧 overflow 改「先截断再摘要」 跨仓库 需 owner 批准,本仓库不动

    推荐路径:③ 现在做(止血)→ ① 请 owner 拍板后做(堵静默砖化)→ ② 后续排期(用户已验证、实现更重)→ ④ 跨仓库单列。

    八问(针对 ③ + ①):

    1. 是什么问题:卸载 bili 后,超窗的 bili 时代会话被 stock DSH 永久砖化(每轮 400、兜底压缩也 400),且卸载时无任何警告。
    2. 什么原因:bili 按设计关宿主压缩且不改写宿主文件(宿主 jsonl 无上限增长)+ stock DSH 溢出恢复需 sub-window 请求却重放整段超窗历史 + 卸载路径无守卫,三者叠加。
    3. 影响范围与严重程度:仅「bili 时代长会话 + 卸载 bili」的用户;严重——会话永久不可用(只能重装 bili 或弃会话);用户实测 597 会话仅 2 个超窗(同一谱系),非普遍失控。
    4. 怎么修复:文档加「卸载前必读」;卸载守卫在 dshRemove() 扫描超窗会话并响亮警告(重装先压实 / 换新会话两条出路)。
    5. 回归风险:文档无回归;卸载守卫是新增警告,不改既有卸载行为(仍会卸载),只多一条提示——无回归。
    6. 是否破坏缓存:不涉及。
    7. 是否改了设计方向:不改架构;卸载守卫是新增 CLI 行为面,需 owner 确认。
    8. 是否引入新配置:无(卸载守卫读既有 session 元数据 + contextWindow,不加 config/env)。

    下一步:我现在开 ③ 文档 PR;① 卸载守卫等 owner 拍板(可并入同一 PR);② 压实工具、④ DSH 侧单列。请 owner 就 ① 是否做、② 是否排期拍板。

  2. ranxianglei commented on Nov 16, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (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:从「压缩会缩小客户端自己的对话文件吗?」一节加一行交叉引用指向新条目。
    • 纯文档,无代码/配置/线上改动。标签:documentation / p2 / scope/docs / dsh。
    • 内容:bili 时代长会话的宿主侧历史可能长过模型窗口(bili 激活时宿主自动压缩关闭 + bili 从不改写宿主文件);卸载后 stock dsh 的溢出恢复会把整段超窗历史重放进单个超窗摘要调用 → 每轮 400。给出两条现有逃生路径——卸载前把重会话轮换到新会话,或重装 bili 原地恢复已超窗会话。

    待 owner 拍板(①② 定了我就加进 #6975 同一分支)

    八问(针对①② 决策):

    1. 是什么问题:卸载后已超窗的会话被 stock dsh 永久卡死(每轮 400),现有文档无警告、无原地恢复工具。
    2. 什么原因:bili 激活时宿主自动压缩关 + bili 从不改写宿主文件 → 宿主侧历史可长过窗口;stock dsh 溢出恢复把整段超窗历史重放进单个超窗摘要调用,永远失败。
    3. 影响范围与严重程度(按选项):
      • ① 卸载守卫:所有 dsh 卸载用户;触发 = 卸载时存在超窗会话;体验瑕疵(警告不阻断卸载)。
      • ② compact-now:所有 dsh 长会话用户;触发 = 会话已超窗且 bili 仍在;完全无法使用(不修则卸载后永久卡死)。
    4. 怎么修复(推荐):先①(轻量止血:dshRemove() 扫描会话 surfaceTokens,超窗大声警告)→ 再②(根治:卸载前把真实压缩 checkpoint 写进宿主日志,用户已手工验证四事件配方)。
    5. 回归风险(按选项):① 无(只读扫描 + 警告,不改卸载行为);② 低(写宿主日志是已有能力,新增「卸载前主动触发」时机,需确保 checkpoint 格式与 stock dsh 兼容)。
    6. 是否破坏缓存:不涉及(两者都不动缓存/重试/增量游标)。
    7. 是否改设计方向:不涉及(①② 都在现有设计内,不转向)。
    8. 是否引入新配置:① 无;② 新增一个 CLI 命令 bili dsh compact-now(非配置项)。

    选项对比:

    选项 价值 代价 建议
    ① 卸载守卫 中(止血警告) 低(只读扫描) 先做
    ② compact-now 高(原地恢复) 高(写宿主日志,需验证格式) 后做

    ④(DSH 侧 trim-then-summarize)跨仓,另走。owner 定了①② 我就加进 #6975。

  3. ranxianglei commented on Nov 16, 2026

    @ranxianglei
    Owner

    (已收)本单已归入根因聚合 issue(token 见聚合单 body),机器人已停止在本单上的工作,修复走聚合 issue 统一出 PR;本单保留不关,修复验证后统一关闭。(聚合单:[Root Cause] dsh-drift (4 items),GitHub #6980)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions