Skip to content

[PR] fix(dsh): read the status wire field fallback, not the internal viaFallback - #6971

Open
ranxianglei wants to merge 1 commit into
masterfrom
2026-11-17_dsh-status-fallback-key
Open

ranxianglei wants to merge 1 commit into
masterfrom
2026-11-17_dsh-status-fallback-key

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Summary

Fixes the DSH Context tab rendering another, unrelated session's handoff when the host session has no bili lane entry (seeded forks, sessions predating the bili lane, freshly created sessions).

Root cause: the client's ownership gate (sessionOurs) read o.viaFallback from the /__bili/plugin/status response, but the server has always sent fallback (src/plugin.ts handlePluginStatus). The field never matched, so sessionOurs was a constant true and the gate never fired — the iframe navigated to whatever session was most-recently-active in the proxy process.

Fix: the client now reads the real wire field (o.fallback). Works against every server version (all send fallback); no server change, no redundant field added to the wire.

Test: the existing regression test simulated the server sending viaFallback: true — a response the server never emits — so it passed without ever exercising the gate (a false test). It now simulates the real wire field (fallback: true), and a new negative-direction case pins that a fallback resolving to OUR OWN session is still framed (#3617 both directions).

Behavior change

None to the wire. The server already sent fallback; only the client's read of that field is corrected, so the existing (previously dead) ownership gate now functions as designed. The model-request layer is untouched (session keys are the client-provided conversation id, no fallback selection).

Verification

Closes #6968

…aFallback`

The DSH client's ownership gate (sessionOurs) read o.viaFallback from the
/__bili/plugin/status response, but the server has always sent fallback
(src/plugin.ts handlePluginStatus). The field never matched, so sessionOurs
was a constant true and the gate never fired: a host session with no bili
lane entry (seeded forks, pre-lane sessions, fresh sessions) rendered another,
unrelated session's handoff in its Context tab.

Fix the client to read the real wire field (o.fallback). Works against every
server version (all send fallback); no server change, no redundant field.

The existing regression test simulated the server sending viaFallback: true
— a response the server never emits — so it passed without ever exercising
the gate. It now simulates the real wire field (fallback: true), and a new
negative-direction case pins that a fallback resolving to OUR OWN session is
still framed (#3617 both directions).

Closes #6968
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-17_dsh-status-fallback-key (94cf4f2)

Latest build — install this exact version

npm install -g billion-context@0.0.10481-pr.6971.d3133b1

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
94cf4f2 billion-context@0.0.10481-pr.6971.d3133b1 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr6971.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix(dsh): read the status wire field fallback, not the internal viaFallback [PR] fix(dsh): read the status wire field fallback, not the internal viaFallback Nov 16, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Verdict: mergeable (可合). The fix is correct, minimal, and the test now genuinely exercises the gate. Verified against the live PR head 94cf4f2e8b.

Independent verification (re-derived, not taken from the issue/PR text):

Note (not a blocker): #6968 documents three facets; this PR fixes facet #2 (the client guard key mismatch) — the direct cause of the user-visible symptom. The other two are separate follow-up candidates, not regressions and not part of the symptom this PR fixes:

  • Facet fix: keep system prompt byte-stable for prefix cache #1 (server returns 200 with the most-recently-active session's data on fallback=latest): intentional — the fallback exists to serve the pre-first-request panel (dsh-native-client.ts:136-137); the client guard is the correct ownership boundary and now refuses foreign rows client-side. Residual is a same-origin trust-model concern only (CORS-limited, model layer unaffected).
  • Facet Use kernel renderTags:"text-only" + forbid tag echoing in prompt #3 (panel.fallbackLatest defaults ON, !==false, documented nowhere): a docs/config-surface gap, separate from this fix.
    Per the no-new-issues-for-follow-ups policy I'm not opening tickets for these — flagging here for your call on whether to track them.

结构化八问:

  1. 是什么问题:DSH 宿主会话没有 bili 车道条目时(种子 fork / 早于 bili 车道的会话 / 新建会话),「会话上下文」页会渲染另一个无关会话的完整 handoff 文档,且无任何提示。
  2. 什么原因导致的:客户端所有权门 sessionOurs 读的是 /__bili/plugin/status 响应里的 o.viaFallback,而服务端一直发的是 wire 字段 fallback(src/plugin.ts:2199)。字段永远对不上 → viaFallback 恒 false → sessionOurs 恒 true → 门从未触发,iframe 直接跳到代理进程里最近活跃的会话。
  3. 影响范围与严重程度:影响 DSH 宿主中「无 bili 条目」的会话(报告机 18 个里 5 个,28%)。p2 信任/正确性问题:CORS 把泄露限制在同源/回环(非远程可利用),模型请求层不受影响,属「显示了错误数据」而非数据丢失/不可用。
  4. 怎么修复的:客户端改读真实 wire 字段 o.fallback === true(不再读内部变量名 o.viaFallback),让原本死掉的所有权门按设计生效——fallback 解析出的行若 conversationId ≠ 宿主自身会话 id 则拒绝渲染(显示「暂无上下文数据」)。无服务端改动、不往 wire 加冗余字段;对所有服务端版本都成立。
  5. 是否有回归问题:无意外回归。逐分支核对 sessionOurs:精确命中 / legacy 宿主 / 自身 fallback(预首请求,仍渲染,由新增负向用例钉死)均不变;仅外部 fallback(本 bug)现在正确拒绝。模型请求层 / 会话键 / wire 格式未触碰。
  6. 是否破坏缓存:不涉及。纯客户端字段读取,不触碰缓存 / 重试 / 增量游标 / 去重键;wire 未变。
  7. 是否改了设计方向:不涉及。服务端 fallback 行为(预首请求面板,有意设计)不变;客户端所有权门(正确的归属边界)现在真正生效。无架构转向。
  8. 是否引入了新的配置:不涉及。无新 env/config/CLI。panel.fallbackLatest 默认 ON 且未文档化是独立后续项,本 PR 未触碰。

结论:可合。 修复正确、最小、测试双向且已实测能抓到 bug,无回归。facet #1 / #3 未在本 PR 处理,属独立后续候选,是否立项由你定。

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

Labels

Projects

None yet

1 participant