Skip to content

[PR] fix: dsh lane: rename + hide switch for the top-bar Context tab (#4237) - #4238

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-22_dsh-ctxtab-rename-hide
Oct 23, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-22_dsh-ctxtab-rename-hide

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #4237

What & why

The DSH top-bar tab bili registers (「上下文」/"Context", order 30) shares its name with dsh-context's own "Context" tab (order 20) — two identical labels side by side — and there was no user-side switch: the registration is unconditional and disabling bili-native would stop compression entirely. Owner ruling in the #4237 thread: provide BOTH a rename option and a hide setting on the web settings page; default keeps the current name (no forced rename).

Config surface (additive)

key type default env tier
dsh.contextTab boolean true BILI_DSH_CONTEXT_TAB (0/false hides; any other value forces on; unset = file tier)
dsh.contextTabLabel string unset → built-in 「上下文」/「Context」 none (file-only display preference, #2030)
  • Why the existing surface cannot express this: the tab registration in src/agent/dsh-native-client.ts was unconditional (ctx.slots.inject("conversation.view", …) with a hardcoded i18n label); nothing under dsh.*, no ui.* section and no env var touched it.
  • Mechanisms considered: new top-level ui.* section (rejected — display knobs ride their lane section, cf. pi.subagents; new sections are owner-gated anyway); pure env var (rejected — 彻底整治环境变了滥用,除非必要都走配置文件 #2030: knob = file key resolved through knobs.ts, env-only reserved for six categories); DSH profile config (rejected — host-side, cannot ship from bili). Chosen: two keys in the existing dsh section + one env tier, exposed on the web quick-config page.
  • Compat/migration: strictly additive. Absent keys = today's behavior byte-identically (the client gate fails open when the snapshot fields are missing, so legacy hosts/pages are unaffected).

Behavior change disclosure

Default = zero change: the tab stays visible with its current name unless the user opts in. Opt-in effects:

  • dsh.contextTab: false removes ONLY the top-bar tab — compression, the settings section, plugin bundle config face, Web UI and /acp all keep working (the ledger remains reachable there);
  • dsh.contextTabLabel: "X" renames the tab to X.
    Both take effect on next page load / dsh restart (slot registration happens at page load). Values flow through the existing __BILI__ snapshot + /bili/origin route, read live per call, so editing the web settings page needs no proxy restart.

How it works

  • Host half (src/agent/dsh-native.ts): both carriers now carry contextTab (+ contextTabLabel when set), resolved through new src/knobs.ts resolvers (env > file > default).
  • Client half (src/agent/dsh-native-client.ts): readCtxTabFace() reads the snapshot once at apply(); the conversation.view registration is skipped when hidden; label resolves custom → built-in localized fallback.
  • Web quick-config (src/web/client.ts + src/web/i18n.ts): checkbox + text row for the two keys.
  • Docs: CONFIGURATION.md en+zh (key table, env table, mapping table, long-form), yaml seeds + regenerated tables, LIFECYCLE.md §2.9.
  • Tests: carrier cascade (host, file + env precedence), gate hidden/shown + label resolution (client bundle built in-test), pre-existing snapshot assertions updated for the new fields.

Local targeted runs green: typecheck, tests/dsh-settings-ui.test.ts 20/20, config-surface-guard 5/5, issue2028 warning path 6/6, docs-sync/config-surface/lifecycle guards. Full suite on CI.

Note: merging our tab INTO dsh-mnemon's Memory System page (#4237 ask 3) stays out of scope — it needs an embedding point on the mnemon/host side (cross-repo); tracked in the issue thread.

The DSH top-bar tab registered by bili-native ("上下文"/"Context") shares its name with dsh-context's own "Context" tab, and there was no way to rename or hide it (disabling bili-native would kill compression). Per owner ruling on #4237: provide both a rename option and a hide setting on the web settings page; default keeps the current name (zero behavior change).

Config surface (additive, owner-approved in the #4237 thread):
- dsh.contextTab (boolean, default true): false removes only the conversation.view slot registration; compression, settings section, plugin bundle config, Web UI and /acp are all unaffected. Env tier BILI_DSH_CONTEXT_TAB (0/false hides, any other value forces on), env > file > default.
- dsh.contextTabLabel (string, file-only tier): custom tab label; empty/unset = built-in localized label.

Host -> browser carriers reuse the existing __BILI__ snapshot + /bili/origin route (both now carry contextTab/contextTabLabel, read live per call so a web-settings edit lands on next page load without a proxy restart). The client bundle gates the conversation.view registration at apply() time and fails open when the fields are absent (legacy hosts/pages behave byte-identically). Web quick-config page gains a checkbox + text row. Docs: CONFIGURATION.md en+zh, yaml seeds + regenerated tables, LIFECYCLE.md §2.9. Tests: carrier cascade (host), gate + label resolution (client bundle), existing snapshot assertions updated.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-22_dsh-ctxtab-rename-hide (9d7867b)

Option A — Install this exact build (recommended)

npm install -g [email protected]

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

Option B — Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: dsh lane: rename + hide switch for the top-bar Context tab (#4237) [PR] fix: dsh lane: rename + hide switch for the top-bar Context tab (#4237) Oct 22, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复 —— 按 contextTab、dsh 顶栏标签页等关键词检索了 open+closed 的 PR 与 issue,本主题仅 #4238 一条;其来源 issue #4237 已查重分诊并有 owner 拍板(提供改名+隐藏设置,web 设置页,默认不改名)。

标签: dsh、scope/ui、p3(DSH 车道顶栏 tab 的显隐/改名展示开关 + web 设置页控件,属体验级功能实现,不影响可用性)

接单,进入评审:拉取分支与最新 master 对账、通读 diff、盯 CI 结果,随后按八问体例给出评审结论。PR 当前状态:mergeable,但 base 落后于 master(behind),会先核对落后区间是否有交互影响。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Review 完成,结论:可合并(请人工合并)。我没有复用 #4237 线程里的既有分析,独立通读了全部 12 个文件的 diff,并做了本地定向验证 + CI 核对。查重见首条评论(不重复)。

结构化八问

  1. 是什么问题:DSH 顶栏并排出现两个同名「上下文」标签页(bili 的 order 30、dsh-context 的 order 20),且 bili 这个无法改名或隐藏——想让它消失只能禁用整个插件,压缩随之全停。
  2. 什么原因导致的:[Bug] Inconsistent host-side context statistics after compression in dsh plugin mode (ref: dsh-context#173) | [Bug] dsh 插件模式压缩后宿主侧上下文统计不一致(引用 dsh-context#173) #3862 在页面加载时无条件注册 conversation.view 槽位,标签写死 i18n 内置名,配置面完全没有对应开关(dsh.* 下、env、其他段都不触及它)。
  3. 影响范围与严重程度:仅影响同时装了 dsh-context(或其他占用同名的插件)与 bili 的用户;纯视觉混淆,无功能损失。p3。
  4. 怎么修复的:在既有 dsh 段加两个显示层键——contextTab(bool,默认 true,env 层 BILI_DSH_CONTEXT_TAB:0/false 隐藏、其他值强制开)和 contextTabLabel(string,仅文件层)。宿主侧经 knobs 三层解析在每次页面加载时实时读取,塞进 __BILI__ 快照与 /bili/origin 两个载体;客户端 bundle 隐藏时跳过注册,标签按 自定义 → 内置本地化名 回退;Web 快速配置页加复选框 + 文本行。隐藏只摘顶栏入口——压缩、设置页一节、插件详情页、Web UI、/acp 全部不受影响。
  5. 是否有回归问题:无。触碰路径的既有行为逐项审计:
  6. 是否破坏缓存:不涉及——纯显示层门控,不触碰压缩管线、前缀缓存、增量游标、重试策略。
  7. 是否改了设计方向:没有——沿用「车道段键 + knobs 三层解析」既有模式,未新建配置段(与 pi.subagents 先例一致)。
  8. 是否引入新配置:是——dsh.contextTab(默认 true)+ BILI_DSH_CONTEXT_TAB(0/false 隐藏,其他值强制开,缺省=文件层);dsh.contextTabLabel(默认 unset,仅文件层)。CONFIGURATION.md en+zh、LIFECYCLE.md §2.9、website config-reference 种子均已文档化;纯增量,键缺失 = 现状逐字不变,无迁移。

验证证据

PR 虽 behind master,但零文件重叠且 GitHub 判 mergeable,无需强推 rebase。#4237 第三项诉求(并入 dsh-mnemon Memory System 页)涉及跨仓嵌入点,正确声明在范围外。

结论:可合并,请手动合并:#4238

@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.773-master.50e2506 (rolling master tag).

npm install -g [email protected]  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

ranxianglei pushed a commit that referenced this pull request Oct 23, 2026
… built-in tab label

Rebased onto master after #4238 merged (contextTab/contextTabLabel knobs
shipped). Those changes reference the tab's built-in name as fact; the
#4319 rename makes those references stale:

- readCtxTabFace comment, web quick-config row labels (zh/en), CONFIGURATION.md/
  zh-CN, website config-reference yaml seeds, LIFECYCLE.md: built-in name is
  now 「压缩代理」/「Compression」, not 「上下文」/「Context」
- tests/dsh-settings-ui.test.ts: the two contextTabLabel fallback pins now
  expect the renamed built-in label
- README Host plugin integration: /bili/origin bodies also carry the #4237
  face flags (contextTab/contextTabLabel) — documented as internal, ignore
ranxianglei pushed a commit that referenced this pull request Oct 23, 2026
…n tab label

docs-sync drift: the #4238-alignment pass renamed the built-in tab
references to 「压缩代理」/「Compression」 in the EN seed, the committed
CONFIGURATION.zh-CN.md row and every other surface, but missed the ZH
seed desc (still 「顶栏上下文标签页」), so gen-config-docs regenerated a
line different from the committed doc. Align the seed with its EN twin
and the already-committed ZH doc text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant