From e7837551566e2a2594263fad615efb6489f5b9aa Mon Sep 17 00:00:00 2001 From: OMSociety Date: Sat, 14 Nov 2026 02:13:54 +0800 Subject: [PATCH 1/2] feat(dsh): note the DSH Go host once per process MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DSH Go Android app ships its own dsh runtime inside a proot rootfs and its client is native, so this bundle's web client face (dsh.client.platform: web — the Context tab and the settings page) has no surface to render into there, while the host-side lane is unaffected. Nothing in bili.log — the only readable record on that host — identified it, so a support read could not tell an Android host from a desktop one. Adds isDshGoHost() next to the lane's existing soft-note helpers in client-build-note.ts (unit-tested decision table) and one once-per-process [dsh-client] line in the dsh lane, keyed on DSH_GO_RUNTIME_ROOT. No behavior change, no new config surface, no new src module. Refs #6588 --- src/agent/client-build-note.ts | 13 ++++++++++++- src/agent/dsh-native.ts | 20 +++++++++++++++++++- tests/client-build-note.test.ts | 10 +++++++++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/agent/client-build-note.ts b/src/agent/client-build-note.ts index 6c08149309..3abcd0dd63 100644 --- a/src/agent/client-build-note.ts +++ b/src/agent/client-build-note.ts @@ -8,7 +8,9 @@ // lanes (pi / oh-my-pi / opencode) are ordinary stable-versioned clients that // do not auto-drift like that, so per decision on #4545 only dsh is wired — // but this module is deliberately lane-generic so a second check can be -// added later with one constant and one call site. +// added later with one constant and one call site. #6588 adds the dsh lane's +// host-posture probe here (isDshGoHost): same species of soft, once-per- +// process note. // // The guard is SOFT and one-directional: when the resolved client version is // STRICTLY NEWER than the newest build we test against for that lane, emit @@ -122,3 +124,12 @@ export function emitNewerClientBuildNote( console.warn(msg); return true; } + +/** Host posture (#6588): the DSH Go Android host stamps its runtime root on + * every process it launches inside the proot rootfs — the only signal that + * reaches this lane there. Blank values mean "not stamped" (fail open to + * silence); the caller owns the once-per-process flag. */ +export function isDshGoHost(env: Record = process.env): boolean { + const root = env.DSH_GO_RUNTIME_ROOT; + return typeof root === "string" && root.trim().length > 0; +} diff --git a/src/agent/dsh-native.ts b/src/agent/dsh-native.ts index 8654a7b2b7..83e1717b12 100644 --- a/src/agent/dsh-native.ts +++ b/src/agent/dsh-native.ts @@ -53,7 +53,7 @@ import path from "node:path"; import { fileURLToPath } from "node:url"; import { logHostEvent } from "./host-log.js"; import * as pfChannel from "./pf-channel.js"; -import { DSH_BUILD_CHECK, emitNewerClientBuildNote, walkUpNodeModuleVersion } from "./client-build-note.js"; +import { DSH_BUILD_CHECK, emitNewerClientBuildNote, isDshGoHost, walkUpNodeModuleVersion } from "./client-build-note.js"; import { ensureProxyRunning, LAUNCHER_DEFAULT_HOST, requestInstanceShutdown } from "../launcher.js"; import { isVersionNewer } from "../update.js"; import { VERSION } from "../version.js"; @@ -276,6 +276,7 @@ let nonWebTraceLogged = false; // Unverified dsh client build note (#warn): once-per-process, same channel // discipline. let dshNewerBuildNoted = false; // #4545, once per process +let dshGoHostNoted = false; // #6588, once per process let regAdoptLogged = false; // #4545 newer-than-tested dsh client-build note (soft, never gates). Shared @@ -2877,6 +2878,23 @@ export async function apply(ctx: PluginContext): Promise { } } + // DSH Go host posture (#6588): that host ships its own dsh runtime inside a + // proot rootfs and its client is native, so this bundle's web client face + // (dsh.client.platform: web — the Context tab and the settings page) has no + // surface to render into while the host-side lane is unaffected. One probe, + // never a gate; the durable record is the readable one there (the host + // exposes at most its last engine log lines elsewhere). + if (!dshGoHostNoted) { + try { + if (isDshGoHost()) { + logHostEvent("info", "[dsh-client]", "bili-native-dsh: DSH Go host (third-party Android app) — the plugin's web client face (Context tab, settings page) has no surface in its native client; the host-side lane is unaffected (#6588)"); + dshGoHostNoted = true; + } + } catch { + // posture probe is fail-open: an odd env stays silent + } + } + // #1772/#3354: in profiles bundling @deepseek-ai/dsh-web-app the RUNNING // compaction-basic instance sits inside an agent preset (preset-standard's // config.plugins) where no patch layer can address the NESTED row by id diff --git a/tests/client-build-note.test.ts b/tests/client-build-note.test.ts index 2186a39f13..48a283730c 100644 --- a/tests/client-build-note.test.ts +++ b/tests/client-build-note.test.ts @@ -10,7 +10,7 @@ import assert from "node:assert/strict"; import fs from "node:fs"; import os from "node:os"; import path from "node:path"; -import { DSH_BUILD_CHECK, emitNewerClientBuildNote, maxTestedVersion, newerClientBuildMessage, walkUpNodeModuleVersion } from "../src/agent/client-build-note.ts"; +import { DSH_BUILD_CHECK, emitNewerClientBuildNote, isDshGoHost, maxTestedVersion, newerClientBuildMessage, walkUpNodeModuleVersion } from "../src/agent/client-build-note.ts"; const DSH_PKG = "node_modules/@deepseek-ai/dsh/package.json"; @@ -163,3 +163,11 @@ test("emitNewerClientBuildNote: channels and tri-state outcomes", () => { fs.rmSync(logDir, { recursive: true, force: true }); } }); + +test("isDshGoHost: the runtime-root stamp decides, blank counts as absent (#6588)", () => { + assert.equal(isDshGoHost({}), false, "unset: every other host shape"); + assert.equal(isDshGoHost({ DSH_GO_RUNTIME_ROOT: "" }), false, "empty string is not a stamp"); + assert.equal(isDshGoHost({ DSH_GO_RUNTIME_ROOT: " " }), false, "whitespace-only is not a stamp"); + assert.equal(isDshGoHost({ DSH_GO_RUNTIME_ROOT: "/data/user/0/io.github.ccch1mneyyy.dsh_app/files/runtime/rootfs" }), true); + assert.equal(isDshGoHost({ DSH_GO_RUNTIME_ROOT: " /opt/rootfs " }), true, "surrounding whitespace still stamps the host"); +}); From 161dd4fb11d00ac64d882cd98869aa10a2aecee1 Mon Sep 17 00:00:00 2001 From: ci-check Date: Sat, 14 Nov 2026 21:01:13 +0800 Subject: [PATCH 2/2] fix: pin the isDshGoHost default process.env binding in the decision table (#6591) --- tests/client-build-note.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/client-build-note.test.ts b/tests/client-build-note.test.ts index 48a283730c..ff2b349342 100644 --- a/tests/client-build-note.test.ts +++ b/tests/client-build-note.test.ts @@ -171,3 +171,15 @@ test("isDshGoHost: the runtime-root stamp decides, blank counts as absent (#6588 assert.equal(isDshGoHost({ DSH_GO_RUNTIME_ROOT: "/data/user/0/io.github.ccch1mneyyy.dsh_app/files/runtime/rootfs" }), true); assert.equal(isDshGoHost({ DSH_GO_RUNTIME_ROOT: " /opt/rootfs " }), true, "surrounding whitespace still stamps the host"); }); + +test("isDshGoHost: the argument-less default reads the live process.env (#6588)", () => { + const prev = process.env.DSH_GO_RUNTIME_ROOT; + try { + delete process.env.DSH_GO_RUNTIME_ROOT; + assert.equal(isDshGoHost(), false, "unset in the live env: not the dsh-go host"); + process.env.DSH_GO_RUNTIME_ROOT = "/data/user/0/io.github.ccch1mneyyy.dsh_app/files/runtime/rootfs"; + assert.equal(isDshGoHost(), true, "the production call site passes no argument"); + } finally { + if (prev === undefined) delete process.env.DSH_GO_RUNTIME_ROOT; else process.env.DSH_GO_RUNTIME_ROOT = prev; + } +});