Skip to content

[PR] fix(dsh): silence the doomed CLI-channel attempts for the Desktop-owned desktop profile (#1575) - #1581

Closed
ranxianglei wants to merge 1 commit into
masterfrom
2026-09-28_dsh-desktop-host-lane
Closed

ranxianglei wants to merge 1 commit into
masterfrom
2026-09-28_dsh-desktop-host-lane

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Completes #1575 together with #1872 (owner decision 2026-10-01: bili takes ownership of the desktop copy and updates it in place — 「否决 直接按照自己覆盖自己的方式更新」).

What this PR does

The deepseek-harness dsh CLI refuses --profile desktop outright ("managed exclusively by the Electron application"), so every channel-driven operation against that profile was a guaranteed failure: each global self-update, each #1196 profile-copy self-refresh cycle, and every bili plugin install/remove/update dsh spawned dsh plugin --profile desktop add … only to log a failure (or an ENOENT warn on pure-desktop machines without a CLI). This PR makes all channel-driven paths skip the profile with an info-level explanation instead:

  • refreshDshProfileBundles (src/dsh-channel.ts): filters the desktop profile out of the refresh targets; logs an info hint when that profile carries billion-context. Covers both triggers transitively — post-global-self-update AND the dsh plugin-market installs never auto-update: the refresh chain's only trigger is a global bili self-update #1196 self-refresh from the copy's own proxy.
  • bili plugin install dsh: skips the profile in both the legacy-block strip loop and the channel add-loop; reports it in the result notes.
  • bili plugin remove dsh: no remove, no legacy-block stripping in that dir; reports "left in place" when a copy is present; a desktop-only carrier yields "nothing removed from CLI profiles — …".
  • bili plugin update dsh (updateLane): excluded from targets; a desktop-only dependency yields a dedicated message instead of a doomed attempt.
  • Read-only surfaces unchanged: dshStatus, dshNativeInstalled, lane presence reporting, third-party scan still enumerate the desktop profile.
  • Docs: CLIENTS.md / CLIENTS.zh-CN.md (install bullet, Desktop-app bullet now documents the in-place ownership + accepted residuals, lockstep bullet), README en/zh option tables, AGENTS.md (single-writer KDD + Install-Lane contract exception clause).
  • Tests: 5 new regression cases (refresh mixed/desktop-only homes, install+remove roundtrip, desktop-only carrier, self-refresh running FROM the desktop copy).

Behavior changes (old → new)

Surface Old New
Global self-update / #1196 self-refresh drove dsh plugin --profile desktop add <ver> → logged failure every cycle (ENOENT warn when no CLI) skips the profile, info log explaining why
bili plugin install dsh attempted add into desktop → failed skipped, reported in output
bili plugin remove dsh attempted remove/strip in desktop dir → failed left in place, reported
bili plugin update dsh counted desktop as a target → doomed attempt excluded; dedicated message if it is the only carrier

The desktop copy's live update path is the in-place self-update shipped by #1872 (junction-safe swap; hostManagedInstall() exemption scoped to <dshHome>/profiles/desktop/node_modules/billion-context). Accepted residuals per owner: second-writer race with the app's own plugin manager; pnpm-lock.yaml divergence after a swap (a later host-side pnpm op could rebuild the layout and undo the overwrite — the next bili update heals it back).

Pre-flight

  • typecheck clean
  • targeted suites green: tests/dsh-refresh.test.ts, tests/dsh-native.test.ts, tests/update-dsh-self-refresh.test.ts, tests/update-dsh-converge.test.ts, tests/update-host-guard.test.ts (83/83)
  • build OK (dist-import-annotations OK)
  • full regression suite delegated to CI (local full-suite runs are reserved for CI per policy)

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-28_dsh-desktop-host-lane (0a750b2)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.1866-pr.1581.d1ba0b4

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-pr1581.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review complete — mergeable. I reviewed this PR (it's my own prior work per the ework-agent-pr marker, so I verified rather than redid it), found one real problem — stale base — and fixed it directly on the branch.

① Issue direction (#1575): correct. Root cause is a second writer on a host-owned lane — bili drove dsh plugin --profile desktop add|remove + legacy-block stripping against $DSH_HOME/profiles/desktop, whose sole legal writer is the Electron app. Fixing it as a host-managed lane is the root-cause fix per the #991 contract, not a symptom mask. All triage claims verified against source.

② Regression review (existing behaviors touched):

  • Read-only reporting surfaces (dshStatus(), dshNativeInstalled(), lane presence, third-party scan) — deliberately unchanged; status still reports installed as a dsh bundle in N/M profiles including desktop, so the duplicate-loader-id guard keeps working. ✅ kept
  • All refresh triggers — upstream added a third call site since this branch was cut (advisory force-update, src/update.ts:1085); verified all three funnel through refreshDshProfileBundles() and refreshDshProfileCopy() has no other write path (src/update.ts:617), so the single skip covers every trigger incl. the mid-app-run self-refresh race from the issue. ✅ covered
  • Behavior change — already disclosed in the PR body (old→new): bili never writes into the desktop profile; its copy converges through the app's in-app plugin manager only. That's the deliberate opt-out of lockstep the single-writer contract requires — intentional, not drift.
  • No config-surface, persistence-format, wire-protocol, or cross-repo (acp-kernel) changes; src/update.ts itself untouched.

③ Code: clean. dshRemove performs zero writes into the desktop dir (no remove, no strip) and reports a desktop-only carrier honestly instead of claiming "nothing to remove".

④ Tests: real teeth — exact assert.deepEqual(calls, [...]) spawn-list assertions, byte-exact desktop package.json re-read after remove, zero-spawn + no-warn assertions for desktop-only homes, and all three trigger paths pinned (incl. a proxy running FROM the desktop copy refreshing only its sibling profiles).

⑤ Diff / what I fixed directly: the branch was based on b371bd0, 188 commits behind master, and upstream had moved the doc sections this PR edits (single-writer table → TECHNICAL-NOTES.md, dsh deep-dive bullets → CLIENTS.md, both +zh). I rebased onto current master (e258bc8), resolved the README conflicts by relocating the doc edits to their new homes — CLIENTS.md / CLIENTS.zh-CN.md bullets, TECHNICAL-NOTES.md / .zh-CN.md table-row exception (zh translation added for sync) — and re-ran everything on the rebased head: typecheck clean, 3067 tests / 0 failures, build success. Branch force-pushed, PR head is now 397c8e8.

中文摘要:修复了 bili 对 Desktop 应用独占的 dsh desktop profile 的二次写入冲突(按 #991 单一写者契约改为主机管理 lane,只读上报保留),我直接修掉了分支落后 master 188 个提交导致的文档位置漂移(编辑迁到 CLIENTS.md/TECHNICAL-NOTES.md 及中文版),rebase 后全量预检通过,可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 分支更新:追加 2 个带标注 commit(来自 #1600 的生产证据核对),head 397c8e80 → 01832dd7,CI 会在新 head 重跑。

#1600(#1592 日志分析)确认了本 PR 修的同根因并给出首个生产实锤。核对 #1581 实现时发现两处残余缺口,已按「小问题直接修」补进本分支:

  1. cfe70423 fix(dsh): fire the desktop owner hint once per target version per process ([bug] dsh Electron-managed profile copy has no bili-driven live update path — contract rule 2 gap #1600) — 原实现的 owner 提示每次调用无条件打印;在运行中拷贝就是 stale 桌面 bundle 的机器上,dsh plugin-market installs never auto-update: the refresh chain's only trigger is a global bili self-update #1196 每 ~3 分钟周期会重复打印(~48 条/天,info 级)。现按 (profile, targetVersion) 每进程节流一次,新版本重新通知;新增回归测试(连续 3 周期 → 恰好 1 条;版本变化 → 再通知)。
  2. 01832dd7 fix(dsh): stop doubling the 'plugin' subcommand in dsh error messages ([bug] dsh Electron-managed profile copy has no bili-driven live update path — contract rule 2 gap #1600) — formatDshError 硬编码 dsh plugin 前缀而全部调用点 argv 已含 "plugin",生产日志字面出现 dsh plugin plugin --profile desktop add …;前缀改裸 dsh ,新增回归测试钉住完整字符串。

预检(rebase 到当前 master 68d1b92 = v0.1.169 后的 head):typecheck 干净;3130 tests / 0 fail(16 skipped 为默认 gate);build 成功。无配置面/持久化/wire/跨仓变更;未触碰 src/update.ts。

中文摘要:#1600 核对发现 owner 提示仍每周期重复、错误消息双写 plugin 子命令两处残余,已在分支上直接补两个带回归测试的 commit 并 rebase 到 v0.1.169 全量预检通过,可以合并。

@ranxianglei
ranxianglei force-pushed the 2026-09-28_dsh-desktop-host-lane branch from 4e291e0 to 082f275 Compare September 30, 2026 15:42
@ranxianglei

Copy link
Copy Markdown
Owner Author

Parking this PR for now — recording why, since the fix itself is real (#1575 second-writer conflict):

The direction conflicts with where the dsh desktop product is heading. The desktop host is moving toward a standalone app / service model rather than a pure native plugin inside dsh. The likely packaging split is two artifacts — a client and a server — where the server will be split out and will not be under dsh's jurisdiction at all (dsh plugin / profile bundles stop managing it), and only the client side remains dsh-manageable.

Under that split, "who owns the desktop profile" is answered by the app itself on both sides; having bili unilaterally declare the lane host-managed (or dsh drive it) bakes in the wrong boundary. The #1575 conflict should be resolved by the upcoming client/server packaging split, not by this ownership carve-out.

Keeping the branch green as reference; will revisit when the split lands.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Understood — parked as reference, not merged or closed. Branch state confirmed: rebased onto current master (e258bc80), full pre-flight green on the head (397c8e80): typecheck clean, 3067 tests / 0 failures, build OK.

One anchor for the revisit: this PR's carve-out keys on the profile name (desktop) and asserts its copy updates "through the app's in-app plugin manager only" — i.e. it still assumes the desktop lane stays dsh-shape on the app side. Under the client/server split you describe, the eventual fix likely needs a different boundary: bili would have to distinguish the dsh-managed client profile from the server artifact that lives outside dsh's jurisdiction entirely (its update path owned by the server itself, not dsh plugin). So on revisit, expect the shape to change from "skip one named profile" to "recognize two distinct lanes/artifacts" — the #1575 second-writer evidence and regression tests here still map cleanly onto that version of the fix.

@ranxianglei
ranxianglei force-pushed the 2026-09-28_dsh-desktop-host-lane branch from 082f275 to 0a750b2 Compare October 1, 2026 15:04
@ranxianglei ranxianglei changed the title fix: treat the dsh desktop profile as a host-managed lane (#1575) fix(dsh): silence the doomed CLI-channel attempts for the Desktop-owned desktop profile (#1575) Oct 1, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

孤儿票清理:标题指向的 issue 已关闭,修复已由其他路径落地。关单;误判请 reopen。

@ranxianglei ranxianglei changed the title fix(dsh): silence the doomed CLI-channel attempts for the Desktop-owned desktop profile (#1575) [PR] fix(dsh): silence the doomed CLI-channel attempts for the Desktop-owned desktop profile (#1575) Oct 24, 2026
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.

1 participant