Skip to content

[PR] fix(dsh): decide the launcher overlay from the profile being booted (#7155) - #7161

Merged
ranxianglei merged 1 commit into
ranxianglei:masterfrom
resec:2026-11-18_dsh-native-installed-profile-scope
Nov 24, 2026
Merged

ranxianglei merged 1 commit into
ranxianglei:masterfrom
resec:2026-11-18_dsh-native-installed-profile-scope

Conversation

@resec

@resec resec commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #7155.

问题

bili dsh --profile <x> 是否挂 bili 自己的 overlay,由 dshNativeInstalled() 决定——而它是全机器的:

// src/plugin-install.ts(修复前)
return dirs.some((dir) => dshBundleInstalled(dir) || dshHasLegacyManagedBlock(dir));

dirs = $DSH_HOME/profiles/* 全部。于是只要任一 profile 装了 bili,本次要启动的那个 profile 就被当成"已装":overlay 被跳过,并打印一句"dsh native install detected"——描述的是另一个 profile 的状态。

验证(真机)

两个 profile:installed 的 bundles 含 billion-context,scratch 只有 @deepseek-ai/dsh-base。

修复前:

$ bili dsh --profile scratch --dump-config
bili: dsh native install detected — the launcher's … overlay patch is skipped …
# 合成树:bili-native 0 次、bili-compaction-gate 0 次;compaction-basic 没有 auto:false

后果不是"少个提示":

怎么修的

  1. dshNativeInstalled(env, profile?):给出 profile 时只看这个 profile 的目录;不传时保持原来的全机器语义(status/测试仍用它);
  2. 新增 dshProfileFromArgs()(src/dsh-channel.ts):按 dsh 自己的解析规则取本次要启动的 profile——裸的第一个参数等价于 --profile <name>(plugin 子命令除外),否则认 --profile <name> / --profile=<name>,-- 之后的不算;
  3. launcher.ts 用这个 profile 做判定;当本 profile 没装而机器上别的 profile 装了,明确说一句:
bili: profile "scratch" does not install billion-context (another profile on this machine does) — this run mounts the launcher overlay, so compression works for this session only. Install it permanently with: dsh plugin --profile scratch add billion-context

验证(修复后)

同一条命令:

$ bili dsh --profile scratch --dump-config
bili: profile "scratch" does not install billion-context (another profile on this machine does) — this run mounts the launcher overlay, …
# 合成树:bili-native 1 次、bili-compaction-gate 1 次

新增测试(tests/issue7155-dsh-native-installed-profile-scope.test.ts,3 条):

  • 有/无 bundle、不存在的 profile、空 profile id(回落到全机器语义)各自的结果;
  • legacy managed block 只算在它所在的 profile 上;没有 profiles root 时恒为 false;
  • dshProfileFromArgs 的解析表:裸参数缩写、--profile x、--profile=x、plugin --profile x add …、[]、--profile 缺值、-- 终止。

负向对照:回退三个源码文件 → 该测试文件整体变红;恢复后 3/3 绿。

本地:typecheck 干净;unused-exports / test-import-graph 绿;dsh-native.test.ts 76 条全过(它同时钉着全机器语义的旧行为),新文件 3 条全过。

风险 / 边界

  • 不依赖"重复 loader id 会炸 boot"这个前提:本修法只会在目标 profile 没有 bundle 时挂 overlay,目标 profile 装了的情况仍然跳过,不产生重复条目。
  • 挂 overlay 后 dsh 会打印 patch: entry "preset-standard" not found 一类的行——这是 overlay 里那四行 preset 门控在非 web profile 上的既有行为(任何 bili dsh 在非 web profile 上都会打),不是本 PR 引入的;本 PR 只是让这条路径在该场景下也会走到。
  • 未传 --profile 且集群里只有一个 profile 的情形:dshProfileFromArgs 返回 undefined → 回落到全机器语义(与修复前一致)。dsh 自己没有默认 profile,未指定时它自己会报错。
  • 解析规则与 dsh 的 argv 展开保持同步,但 dsh 若改动该规则,这里需要跟着改——测试里用一张解析表钉住了当前规则。

…anxianglei#7155)

dshNativeInstalled() answered for the whole machine ('any profile has the
bundle'), and the launcher used that answer for THIS launch. On a machine where
a sibling profile has the bundle but the booted one does not — a scratch
profile created after 'bili plugin install dsh', a profile whose dep was
removed by hand — the overlay was skipped and the session ran with zero bili
entries: no ACP tools, no takeover, native compaction armed (which the wire
guard then refuses turn after turn), while the launch note described the other
profile.

Take an optional profile argument (omitting it keeps the machine-wide answer
for status/tests), parse the booted profile from the dsh argv the way dsh does
(bare first argument abbreviates --profile), and say plainly when the booted
profile lacks the bundle.
@ranxianglei ranxianglei changed the title fix(dsh): decide the launcher overlay from the profile being booted (#7155) [PR] fix(dsh): decide the launcher overlay from the profile being booted (#7155) Nov 18, 2026
@ranxianglei
ranxianglei merged commit a59a638 into ranxianglei:master Nov 24, 2026
50 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1312-master.a59a638 (rolling master tag).

npm install -g billion-context@0.0.1312-master.a59a638  # 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 to mariopasquali/billion-context that referenced this pull request Nov 25, 2026
…ranxianglei#7678 wal-reclaim-passive (walJournalSizeLimitBytes default 0, ranxianglei#7674) + ranxianglei#7617 identity-tables-consolidate + ranxianglei#7581 egress block-flow checkpoint retire + ranxianglei#7659 eg-GA docs wrapup + ranxianglei#7671 degenerate-retry + ranxianglei#7676 megaturn-bridge + ranxianglei#7677 doom-prompt-mass + ranxianglei#7632 pure-echo latch + dsh batch (ranxianglei#7161/ranxianglei#7159/ranxianglei#7158/ranxianglei#7129/ranxianglei#7127)

Only manual conflict: docs/configuration{,.zh-CN}.md env table — union of intent,
original line order: master's walJournalSizeLimitBytes row (default 0, ranxianglei#7674)
+ PR's archiveAfterDays row (with the bili storage migrate ranxianglei#5599 clause).
All code (src/persist.ts, src/storage/shadow.ts, src/storage/store.ts,
tests/storage-unified.test.ts) auto-merged; local typecheck clean and the
targeted storage suites (storage-unified/-ccr/-state-fields/
-batched-verification) pass 38/38 on the merged tree.

(ranxianglei#6773)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][dsh] 'bili dsh --profile X' decides whether to mount the overlay from ALL profiles — a profile without the bundle gets zero bili entries

2 participants