Repository navigation
[PR] fix(dsh): make dsh.contextTab work on DSH Desktop — always emit the __BILI__ boot-snapshot row - #4848
Conversation
….contextTab works on Desktop The webserver/index-inject handler dropped the whole __BILI__ row when the proxy origin was not yet bound (spawn mode binds register.base only after bootstrap). DSH Desktop captures that table ONCE per app launch (a one-shot boot snapshot) and never re-collects, so a dropped row is gone for the whole session — unlike browser/web which re-renders the index per request. The client readCtxTabFace() then fails open (missing snapshot => tab shown), making dsh.contextTab=false / BILI_DSH_CONTEXT_TAB=0 a no-op on Desktop. Emit the row unconditionally with a null origin placeholder, mirroring the /bili/origin route expression so snapshot == route at any instant. readOrigin() already treats a non-string origin as unresolved and keeps polling; readCtxTabFace() only needs contextTab/contextTabLabel, so page semantics are unchanged and fail-open shifts from "row absent" to "origin pending". Flips the #1590 "stays silent when no origin" test to assert the row now lands, and adds a desktop-boot regression test (config hide + origin unbound => row carries contextTab:false). Fixes #4846
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.6256-pr.4848.4abd46eThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4848.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 本 PR 是 #4846(DSH Desktop 标签:bug / dsh / scope/wiring / p2(配置开关在桌面端稳定失效,功能缺陷但有绕行;浏览器端正常) 开始独立审核:核对分支代码、既有行为回归面、测试有效性,并查 CI 状态。结论稍后按结构化八问回复。 |
(ai: vllm-qwen/qwen3.8-27b) 独立审核完成(分支 结构化八问1. 是什么问题:DSH Desktop 上 2. 什么原因导致的:因果链分三层,已逐层验证——
3. 影响范围与严重程度:仅显式设置 4. 怎么修复的:行无条件发出,origin 用 5. 是否有回归问题:触碰路径的既有行为逐项清点——
高危模式逐项过:无 fail-fast 变吞错、无阈值/时序漂移、无输出格式变化(除披露的行存在性变化)。未发现回归。 6. 是否破坏缓存:不涉及(无缓存/重试/游标/去重路径触碰;wire 零改动,前缀缓存不受影响)。 7. 是否改了设计方向:无架构转向。一处有意的契约细化: 8. 是否引入了新的配置:无。 行为变更披露(旧→新)
测试有效性与 CI
Diff 整洁度与自动合并门槛2 文件 43+/7-,每一行都与本 PR 目的相关;注释解释的是「为什么」(#4846 机制),非复述代码。无无关改动、无版本 bump、无 kernel 触碰。§7.4 自动合并门槛逐条满足(单模块 fix、有回归钉、rebased head 绿、纯 fix:、引用 #4846、不碰承重基建)。 结论:可合并。 建议 owner 直接 merge:#4848 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.862-master.42529ea # this exact build
npm install -g billion-context@master # always the newest merged build
|
What
On DSH Desktop (Electron shell),
dsh.contextTab: false(andBILI_DSH_CONTEXT_TAB=0) has no effect — the "Context" top-bar tab still registers on every cold start. Browser / Web GUI are unaffected.Root cause
DSH Desktop collects the web index-injection table once at Host
readyand serves that same snapshot to every page boot (DESKTOP_IPC.boot) — it never re-collects. bili'swebserver/index-injecthandler dropped the entire__BILI__row whenever the proxy origin was not yet bound:In spawn mode the Host
readyprecedes the origin binding, so the row never lands in the one-shot snapshot. The client'sreadCtxTabFace()then fails open (snap !== undefined && snap.contextTab === false⇒ missing snapshot ⇒ tab shown). Because desktop never re-collects, this is a permanent failure, not the transient "refresh fixes it" boundary the browser path has.Fix
Emit the
__BILI__row unconditionally, using anullorigin placeholder, mirroring the existing/bili/originroute expression exactly (so snapshot ≡ route at any instant):This decouples the Context-tab face flags (
contextTab/contextTabLabel, read live from config) from origin readiness. The client'sreadOrigin()already treats a non-string origin as unresolved and keeps polling/bili/origin;readCtxTabFace()only needscontextTab/contextTabLabel. Page functionality is unchanged.Behavior change (disclosed)
__BILI__snapshot row was absent ⇒ the client failed open and showed the Context tab regardless ofdsh.contextTab.origin: null+ the live face flags ⇒dsh.contextTab: falsenow hides the tab even before the origin binds.Only observable effect: on hosts that snapshot before the origin binds (DSH Desktop; the first paint of a browser page),
dsh.contextTab: falsenow takes effect immediately instead of being ignored until a refresh/restart. Default (contextTab: true) behavior is byte-identical (tab shown either way). No LLM-wire, config-schema, persistence, or kernel change.I deliberately did not also flip the client gate to fail-closed (reporter's option 2): that would change the fail-open contract globally (browser + legacy hosts without the field) and is a product decision left to you. The host-side change alone closes this bug.
Tests
#1590: index-inject stays silent when no origin is known yet→ now asserts the row lands as{ origin: null, contextTab: true }.#4846: configcontextTab: false+ origin unbound ⇒ snapshot row carriescontextTab: false, and the/bili/originroute agrees (snapshot ≡ route).Local: targeted suite green (26/26) + typecheck clean. Full-suite verdict from CI.
Closes #4846