Skip to content

bug(dsh): Context tab freezes on the stale bare row after a session forks to a |sub: lane #4686

Open

Description

@IThinkItsaName

Summary

On a DSH (desktop) session, the conversation ended up recorded under <sessionId>|sub:<fp16> while the bare id kept a stale record. The Context tab then froze: it keeps showing the bare id's numbers (43 requests / 218,029 ctx) while the proxy keeps folding the live lane (503 requests / 111,451 ctx, cache 99%).

Nothing is broken in the proxy — this is the same |sub: fork family as #3149 / #3150, but the read side cannot follow the forked lane, so the tab silently shows a dead record instead of the conversation.

Environment

  • billion-context 0.1.207 (7e69b49f), dsh desktop @deepseek-ai/dsh 0.2.1-rc.3, Windows 11, Node 24
  • Installed files are byte-identical to the npm package (sha256 verified: package.json 4473627652b08209…, dist/agent/dsh-native-client.js eb486fa60816932b…, dist/agent/dsh-native.js 5614c3b6f50f0744…) → not a local patch, this is shipped behaviour.
  • No BILI_* environment overrides; ~/.config/billion-context/billion-context.json is stock (providers:{}, compress{nudgeGrowthTokens:150000, modelContextLimit:850000}, dsh.contextTabLabel).

What happens

GET /__bili/stats lists two rows for one conversation:

id requests contextTokens lastSeen
session-2a12c87d-…-d20d94d063e8 43 218,029 10:51:03Z (frozen)
session-2a12c87d-…-d20d94d063e8|sub:4c73101d32b4dd4c 503 111,451 11:05:42Z (live)

The tab's data source resolves only the bare id:

GET /__bili/plugin/status?conversationId=<bare>&fallback=latest
→ sessionId=<bare>, requests=43, contextTokens=218029      # frozen
GET /__bili/plugin/status?conversationId=<bare>|sub:4c73101d32b4dd4c
→ sessionId=<bare>|sub:…, requests=503, contextTokens=111451  # live

and the client builds the embedded frame from exactly that value:

// dist/agent/dsh-native-client.js:403
src: `${origin}/__bili/?embed=1&lang=${lang}…#/session/${encodeURIComponent(sessionId)}`

so the embedded session page is pinned to the dead bare row and never moves again.

Why fallback=latest does not save it

  • dist/agent/dsh-native-client.js:61 always passes the bare conversation id:

    var ctxStatusPathFor = (hostSessionId) => hostSessionId === void 0 ? CTX_STATUS_PATH
      : `/__bili/plugin/status?conversationId=${encodeURIComponent(hostSessionId)}&fallback=latest`;
  • fallback=latest only applies when the requested id has no record; here the bare id does have one (the stale fork shell), so it wins forever.

  • There is no aggregate route either: GET /__bili/plugin/status with no query returns
    HTTP 400 {"ok":false,"error":"conversationId query parameter is required"}.

Expected

The Context tab should follow the conversation that is actually receiving traffic. Options:

  1. resolve conversationId to the freshest base or base|sub:* (by lastSeen, or aggregate requests/tokens across the family), and return that sessionId so the embedded frame lands on the live lane;
  2. or make the embed URL use the lane the traffic is on (e.g. return liveSessionId next to sessionId);
  3. or, at minimum, surface the fork in the tab ("this conversation forked to …") instead of showing a silently frozen card.

Reproduction sketch

  1. DSH desktop + bili-native, a long session that gets folded by bili at least once (this one forked right after the first fold following a host restart).
  2. curl localhost:18787/__bili/stats → observe the |sub: row carrying the traffic.
  3. Open the Context tab (or just curl '/__bili/plugin/status?conversationId=<bare>') → numbers stop at the pre-fork values while /__bili/stats keeps increasing.

Workaround attempted (does not work)

"subagentSplit": false in ~/.config/billion-context/billion-context.json, then restart the helper (a host restart alone does not restart it — see below) via POST /__bili/shutdown; the plugin respawns it (pid changed, startedAt new) and /__bili/config confirms the flag is read ("subagentSplit": false in raw). The fork still reappears: the id comes back from the persisted ledger (hasLedger: true), not from a fresh per-request derivation, so the switch cannot undo an existing lane.

Side finding

Host/dsh_restart restarts do not restart the bili helper: same pid/startedAt after relaunch (it re-attaches via "attaching to running proxy"). Config changes therefore need POST /__bili/shutdown + respawn. Worth documenting, since a "restart the host to apply config" instruction silently does nothing.

Related

Activity

  1. ranxianglei commented on Oct 25, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

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

    查重: 不重复——同家族、不同机制。#3149/#3153(已修,你的 0.1.207 已含)是「fork 怎么来的」那半边(标题 sidecar 抢占裸键);#3442(open)是工具调用侧(compress 被 #2601 启发式误拽到 ref-less ghost)。本 issue 是读侧:/__bili/plugin/status 这条路由从不跟随 |sub: 谱系,三者机制互不覆盖。

    版本锚定已核实(v0.1.207,非 master 推断):handlePluginStatus 在 :1564 只做精确 id 解析(resolveForkConversation(conversationId)),:1568 的 fallback=latest 分支只在「请求 id 完全没有记录」时才触发;dsh 客户端(dsh-native-client.ts:141-145)永远带裸 hostSessionId + fallback=latest。你贴的两行数据与代码路径完全吻合——陈旧裸行有记录,所以 fallback 永远不会接管。机制在你的构建里成立。

    层次判断:fork 本身的产生(host 重启后历史接续断裂 → persona-anchor fork)是 #3149 家族已知残支,与你说的「代理没坏」一致,不在本修复范围。真正缺的是:管理调用早就跟随活车道了,唯独状态读取没跟。你自己的数据就是铁证——活车道 503 请求、还在折叠,说明 dsh 的 compress/acp_status 转发已经按 #2601 路由落到了 |sub: 车道;而 Context tab 轮询的 status 路由把卡片钉死在冻结父行上。这个不对称就是缺陷本体。

    修法(你给的选项 1,服务端实现,判据与工具调用侧完全一致):handlePluginStatus 在精确命中后,若该会话存在「活的后代」则改服务后代——判据直接复用 #2601/#2948/#3397 既有的 livePersonaDescendant(新鲜 ≤10min、持有 refs、流量严格新于父、多个取最新):

    响应新增加性字段 personaFork: true 标记发生了跟随;conversationId 保持请求值(客户端所有权门槛对精确命中无条件信任,无需改动),panel/统计/webUrl 全部来自活车道。客户端零改动:tab 每 10s 重拉一次,下一跳就把嵌入帧移到返回的 sessionId 上。

    行为变更披露(旧→新):/__bili/plugin/status?conversationId=<裸id> 过去只要裸 id 有记录就永远服务裸会话;现在当裸行相对一个新鲜的持-ref fork 变陈旧时,服务该 fork。其余消费方已逐一核对:zcode/kimi/opencode-acp/MCP shell 里用字面量探测 id("zcode"/"kimi"/"dsh")的路径不可能存在 |sub: 子代,不受影响;真实 id 的消费方得到的是同意的对齐(它们的管理调用本来就走同一谱系路由)。

    旁注(不同机制,稍后单独立项,带来源标记):host/dsh_restart 不重启 bili helper(重新 attach 到驻留进程),配置生效需 POST /__bti/shutdown+重生——那是车道 attach 生命周期问题,与本缺陷无共享机制。workaround 无效的说明:subagentSplit:false 只挡未来派生,不改写已持久化的账本 id,属预期行为;本修复落地后 tab 会直接显示活车道,与该配置无关。

    标签: bug / dsh / scope/wiring / p2(代理 API 边界的读路径缺陷;功能可用且有绕行——直开 Web UI 或走 /acp——故 p2 而非 p1)。

    开工中:回归测试先写(未修代码上红、修后绿),定向套件 + typecheck 过后开 PR(Closes #4686),随后回八问。

  2. ranxianglei commented on Oct 25, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

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

    **完成 — PR: https://github.com/ranxianglei/billion-context/pull/4703**(Closes #4686)

    版本核实:已逐行核对你构建(v0.1.207)的代码路径——handlePluginStatus 只做精确 id 解析,fallback=latest 仅在该 id 完全无记录时触发。机制在你的构建里存在,不是版本滞后。

    层次判断:fork 本身(host 重启后漂移 → persona 锚点分裂到 |sub:)是 #3149 家族的已知残留,你已明确定位「proxy 没坏」;真正坏的是读写不对称——管理类工具调用(compress/acp_status)早就按 #2601 路由跟随 live lane(所以你那条 503 请求的 lane 一直在折叠),而 Context tab 的数据源 /__bili/plugin/status 从没拿到这个 follow,tab 就永远钉在冻结的裸行上。

    修法(对应你的选项 1,服务端,客户端零改动):

    八问:

    1. 是什么问题:Context tab 用原始 session id 轮询状态,会话 fork 后裸行还在但冻结,精确命中永远压过 fallback,tab 被钉死在死行上。
    2. 什么原因:status 读路径只做精确 id 解析、不跟随 persona lineage——写侧(工具调用)早已按 [Bug] dsh 会话反复 model/provider 切换时主对话迁移到 |sub:<fp> persona fork,宿主盖章的 compress/decompress/acp_status 仍解析在陈旧父 id —— ref 跨空间不可解析直至熔断 #2601 跟随,读侧从未获得该 follow。
    3. 影响范围/严重程度:会话 fork 到 |sub: lane 的 dsh desktop 用户看到过期/冻结的 Context tab;压缩本体与全部实际功能不受影响(都走 live lane)——可观测性冻结,非数据丢失;绕行 = 直接开 Web UI。p2。
    4. 怎么修复:把既有 [Bug] dsh 会话反复 model/provider 切换时主对话迁移到 |sub:<fp> persona fork,宿主盖章的 compress/decompress/acp_status 仍解析在陈旧父 id —— ref 跨空间不可解析直至熔断 #2601 lineage-follow 语义扩展到读路径,复用同一套判据,无新机制。
    5. 回归问题:逐项审过 handlePluginStatus 既有行为——活父精确命中不变 / fallback=latest 路径不变 / zcode·kimi 字面 id 探针(不可能有 |sub: 子代)不变 / 直接命中 fork id 不链式跟随——6 个回归测试双向钉住(Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617 gate 纪律),修复前验证红、修复后绿;工具调用路径零改动无语义漂移。
    6. 缓存破坏:无——只读解析变更,不动缓存/重试/游标/去重键与压缩状态。
    7. 设计方向变化:无——既有 lineage-follow 机制向读侧的自然延伸。
    8. 新配置:无。仅一个加性 JSON 字段 personaFork(PR 内有说明)。

    说明:分支已 rebase 到最新 master(ac844facd,含 v0.1.207 release 与 #3442 出生序精化)——fix 自动继承精化后的判据。本地 typecheck + 定向套件(13 文件 132 用例)绿,全量回归以 CI 为准。

    顺带发现已单独立项:host restart 不会重启 bili helper(re-attach 同 pid),配置修改需手动 shutdown+respawn 才生效——不同机制,https://github.com/ranxianglei/billion-context/issues/4705(带来源标记)。

    标签判定:bug / dsh / scope/wiring / p2(协议接线边界读侧缺陷;可用且有绕行)。镜像 API 无法持久化标签写入(首帖已说明),判定留在此线程。

    待 CI 绿 + 你合并。

  3. ranxianglei commented on Oct 25, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

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

    CI 状态补充(接上条「待 CI 绿」):PR #4703 的 6 个红分片已逐片日志核对——全部落在 master 自身在册的 born-red 集群(storage golden/engine-proofs、plugin-fork、orphan-recovery、web-blogfeed)+ 1 条 Windows 平台 flake(attach-mode 用例,本分支本地定向跑绿);六片日志对本 PR 文件零命中,本 PR 定向域在绿分片。属继承性红,已按协调流程记入 #4599;等 master 侧 born-red 集群收敛后重触发即绿,分支侧无需改动。合并判定不受影响。

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions