Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-8342 fix(daemon): reject legacy DSH profiles (ZIC-374) (#9649)
ZIceec72a00ac355
diff --git a/apps/docs/content/docs/install-agent-runtime.fr.mdx b/apps/docs/content/docs/install-agent-runtime.fr.mdxindex 89d87fff68..b18fc6c2d0 100644--- a/apps/docs/content/docs/install-agent-runtime.fr.mdx+++ b/apps/docs/content/docs/install-agent-runtime.fr.mdx@@ -90,6 +90,8 @@ Installez Node.js 20+ et exécutez `npm install -g @deepseek-ai/dsh`, puis fourn**Installer le profil.** Définissez `MULTICA_DSH_PROFILE_BUNDLE` sur le bundle à installer et le daemon l'ajoute pour vous, ou ajoutez-le vous-même avec `dsh plugin --profile multica add <bundle>`. `<bundle>` peut être tout ce que `dsh plugin` accepte (un nom de paquet npm, un répertoire ou une archive tarball empaquetée), et le pont de Multica se trouve dans [multica-ai/dsh-multica-runtime](https://github.com/multica-ai/dsh-multica-runtime). Il n'est pas encore publié sur un registre npm public ([multica#6936](https://github.com/multica-ai/multica/issues/6936)) : aujourd'hui, une équipe auto-hébergée le compile donc depuis ce dépôt et fait pointer la variable vers le répertoire de build, ou vers la tarball produite par `npm pack` si la machine qui exécute le daemon n'est pas celle qui l'a compilé. Un nom de paquet deviendra l'option la plus simple une fois le pont publié.+**Migrer un profil existant.** Sauvegardez le profil et suivez le README du dépôt du pont pour compiler un bundle compatible avec votre version de DSH. Installez manuellement ce répertoire ou cette tarball, puis vérifiez que `dsh.profile.bundles` charge `@multica-ai/dsh-runtime` : remplacez `dsh-profile-multica` s'il est présent, ou supprimez-le si les deux ponts sont listés. Une entrée dans les dépendances ne suffit pas à charger le runtime. `MULTICA_DSH_PROFILE_BUNDLE` ne migre pas une configuration de pont existante. Vérifiez le résultat avec `dsh --profile multica --probe`.+<Callout type="warning">Privilégiez un bundle que votre propre équipe publie ou compile : cette valeur est installée dans le répertoire personnel DSH de chaque hôte du daemon sans autre confirmation, si bien qu'un paquet tiers non vérifié relève d'une décision de chaîne d'approvisionnement.</Callout>diff --git a/apps/docs/content/docs/install-agent-runtime.ja.mdx b/apps/docs/content/docs/install-agent-runtime.ja.mdxindex dba65ed254..c748da908b 100644--- a/apps/docs/content/docs/install-agent-runtime.ja.mdx+++ b/apps/docs/content/docs/install-agent-runtime.ja.mdx@@ -90,6 +90,8 @@ Node.js 20+ をインストールして `npm install -g @deepseek-ai/dsh` を実**プロファイルのインストール。** `MULTICA_DSH_PROFILE_BUNDLE` にインストールするバンドルを設定すればデーモンが追加します。手動で行う場合は `dsh plugin --profile multica add <bundle>` を実行します。`<bundle>` は `dsh plugin` が受け付けるもの、つまり npm のパッケージ名、ディレクトリ、パック済み tarball のいずれかで、Multica 自身のブリッジは [multica-ai/dsh-multica-runtime](https://github.com/multica-ai/dsh-multica-runtime) にあります。これはまだ公開 npm レジストリに公開されていないため([multica#6936](https://github.com/multica-ai/multica/issues/6936))、現時点でセルフホストのチームはそのリポジトリからビルドし、変数をビルド出力のディレクトリに向けます。デーモンを動かすマシンとビルドしたマシンが別なら、`npm pack` が生成する tarball を指定してください。ブリッジが公開されれば、パッケージ名を指定するのが最も簡単になります。+**既存プロファイルの移行。** プロファイルをバックアップし、ブリッジの README に従って DSH のバージョンに対応するバンドルをビルドしてください。そのディレクトリまたは tarball を手動でインストールし、`dsh.profile.bundles` が `@multica-ai/dsh-runtime` を読み込むようにします。`dsh-profile-multica` があれば置き換え、両方ある場合は `dsh-profile-multica` を削除してください。依存関係に記載するだけでは読み込まれません。`MULTICA_DSH_PROFILE_BUNDLE` は既存のブリッジ設定を移行しません。`dsh --profile multica --probe` で結果を確認してください。+<Callout type="warning">自チームが公開・ビルドしたものを優先してください。この値は追加の確認なしに各デーモンホストの DSH ホームへインストールされるため、素性の分からないサードパーティのパッケージを指定することは、サプライチェーンに関わる判断になります。</Callout>diff --git a/apps/docs/content/docs/install-agent-runtime.ko.mdx b/apps/docs/content/docs/install-agent-runtime.ko.mdxindex 4de41dddbf..3dd7e4ac3c 100644--- a/apps/docs/content/docs/install-agent-runtime.ko.mdx+++ b/apps/docs/content/docs/install-agent-runtime.ko.mdx@@ -90,6 +90,8 @@ Node.js 20+를 설치하고 `npm install -g @deepseek-ai/dsh`를 실행한 뒤 M**프로필 설치.** `MULTICA_DSH_PROFILE_BUNDLE`에 설치할 번들을 설정하면 데몬이 대신 추가합니다. 직접 하려면 `dsh plugin --profile multica add <bundle>`을 실행하세요. `<bundle>`은 `dsh plugin`이 받아들이는 형태(npm 패키지 이름, 디렉터리, 패키징된 tarball)이면 되고, Multica 자체 브리지는 [multica-ai/dsh-multica-runtime](https://github.com/multica-ai/dsh-multica-runtime)에 있습니다. 아직 공개 npm 레지스트리에 게시되지 않았으므로([multica#6936](https://github.com/multica-ai/multica/issues/6936)), 현재 셀프호스트 팀은 해당 저장소에서 직접 빌드한 뒤 변수를 빌드 산출물 디렉터리로 지정합니다. 데몬을 실행하는 기기와 빌드한 기기가 다르면 `npm pack`이 만든 tarball을 지정하세요. 브리지가 게시되면 패키지 이름을 쓰는 것이 가장 간단합니다.+**기존 프로필 마이그레이션.** 프로필을 백업하고 브리지 저장소의 README에 따라 DSH 버전과 호환되는 번들을 빌드하세요. 해당 디렉터리나 tarball을 수동으로 설치한 뒤 `dsh.profile.bundles`에서 `@multica-ai/dsh-runtime`을 로드하도록 설정하세요. `dsh-profile-multica`가 있으면 교체하고, 두 브리지가 모두 있으면 `dsh-profile-multica`를 제거하세요. 의존성 목록에 선언하는 것만으로는 런타임이 로드되지 않습니다. `MULTICA_DSH_PROFILE_BUNDLE`은 기존 브리지 설정을 마이그레이션하지 않습니다. `dsh --profile multica --probe`로 결과를 확인하세요.+<Callout type="warning">팀이 직접 게시하거나 빌드한 산출물을 우선하세요. 이 값은 추가 확인 없이 모든 데몬 호스트의 DSH 홈에 설치되므로, 검증되지 않은 서드파티 패키지를 지정하는 것은 공급망에 관한 결정입니다.</Callout>diff --git a/apps/docs/content/docs/install-agent-runtime.mdx b/apps/docs/content/docs/install-agent-runtime.mdxindex 1215f16bf3..7b79eb16a2 100644--- a/apps/docs/content/docs/install-agent-runtime.mdx+++ b/apps/docs/content/docs/install-agent-runtime.mdx@@ -91,6 +91,8 @@ Install Node.js 20+ and run `npm install -g @deepseek-ai/dsh`, then give it the**Installing the profile.** Set `MULTICA_DSH_PROFILE_BUNDLE` to the bundle to install and the daemon adds it for you, or add it yourself with `dsh plugin --profile multica add <bundle>`. `<bundle>` is anything `dsh plugin` accepts — an npm package name, a directory, or a packed tarball — and Multica's own bridge lives at [multica-ai/dsh-multica-runtime](https://github.com/multica-ai/dsh-multica-runtime). It is not on a public npm registry yet ([multica#6936](https://github.com/multica-ai/multica/issues/6936)), so today a self-hosted team builds it from that repository and points the variable at the build directory, or at the tarball `npm pack` produces — the latter if the machine running the daemon is not the machine that built it. A package name becomes the simplest option once the bridge is published.+**Migrating an existing profile.** Back up the profile and follow the bridge repository's README to build a bundle compatible with your DSH version. Install that directory or tarball manually, then ensure `dsh.profile.bundles` loads `@multica-ai/dsh-runtime`: replace `dsh-profile-multica` if present, or remove it if both bridges are listed. A dependency entry alone does not load the runtime. `MULTICA_DSH_PROFILE_BUNDLE` will not migrate an existing bridge configuration. Verify the result with `dsh --profile multica --probe`.+<Callout type="warning">Prefer a bundle your own team publishes or builds: this value is installed into every daemon host's DSH home without further confirmation, so an unvetted third-party package is a supply-chain decision, not a convenience.</Callout>diff --git a/apps/docs/content/docs/install-agent-runtime.zh.mdx b/apps/docs/content/docs/install-agent-runtime.zh.mdxindex 273d9a042a..93638b1ca3 100644--- a/apps/docs/content/docs/install-agent-runtime.zh.mdx+++ b/apps/docs/content/docs/install-agent-runtime.zh.mdx@@ -90,6 +90,8 @@ Multica 当前会检测以下命令:**安装 profile。** 把 `MULTICA_DSH_PROFILE_BUNDLE` 设为要安装的 bundle,守护进程会替你安装;也可以自己执行 `dsh plugin --profile multica add <bundle>`。`<bundle>` 可以是 `dsh plugin` 接受的任意形式:npm 包名、目录,或打包好的 tarball。Multica 自己的桥接实现在 [multica-ai/dsh-multica-runtime](https://github.com/multica-ai/dsh-multica-runtime),目前还没有发布到公共 npm registry([multica#6936](https://github.com/multica-ai/multica/issues/6936))。现阶段自托管团队从该仓库自行构建,把变量指向构建产物目录;运行守护进程的机器和构建机器不是同一台时,指向 `npm pack` 产出的 tarball。桥接发布之后,直接填包名最省事。+**迁移现有 profile。** 先备份 profile,按桥接仓库 README 构建与你的 DSH 版本兼容的 bundle。手动安装这个目录或 tarball,再确认 `dsh.profile.bundles` 加载了 `@multica-ai/dsh-runtime`:有 `dsh-profile-multica` 时替换它;两者都有时移除 `dsh-profile-multica`。只在依赖列表声明包名不会加载运行时。`MULTICA_DSH_PROFILE_BUNDLE` 不会迁移现有桥接配置。完成后用 `dsh --profile multica --probe` 验证。+<Callout type="warning">优先使用你们自己发布或构建的产物。这个值会在没有二次确认的情况下装进每一台守护进程宿主的 DSH 家目录,填一个未经审查的第三方包,就是做了一次供应链决策。</Callout>diff --git a/server/internal/daemon/agents_probe.go b/server/internal/daemon/agents_probe.goindex 061085f170..775c8de0e3 100644--- a/server/internal/daemon/agents_probe.go+++ b/server/internal/daemon/agents_probe.go@@ -392,9 +392,11 @@ type dshProbeVerdict intconst (// dshProbeOK: the profile answered with the protocol version this backend drives.dshProbeOK dshProbeVerdict = iota+ // A configured bridge must be migrated manually, never provisioned over.+ dshProbeNeedsMigration// dshProbeMissingProfile: the manifest does not name the Multica runtime.// A file that merely exists is not enough — a refused install leaves one.- // This is the only verdict that may install a bundle or condemn the runtime.+ // This is the only verdict that may install a bundle.dshProbeMissingProfile// dshProbeIncompatible: something answered, with a protocol this daemon does// not drive. The profile is installed, so installing over it would replace a@@ -448,6 +450,9 @@ func probeDshMulticaProfile(ctx context.Context, executablePath string) dshProbeif ctx.Err() != nil {return dshProbeUnavailable}+ if dshMulticaProfileNeedsMigration() {+ return dshProbeNeedsMigration+ }// A manifest that does not name the runtime is missing. Decide that before// starting dsh: on current DSH, --probe against the skeleton a refused// install leaves hangs until this timeout, and the file is already the answer.diff --git a/server/internal/daemon/agents_probe_dsh_test.go b/server/internal/daemon/agents_probe_dsh_test.goindex 298bf466a4..4c51f92241 100644--- a/server/internal/daemon/agents_probe_dsh_test.go+++ b/server/internal/daemon/agents_probe_dsh_test.go@@ -511,6 +511,8 @@ func TestNewRuntimeVerdict_DshProfileCarriesAStructuredCause(t *testing.T) {verdict builtinProbeVerdictinstalling bool}{+ {name: "migration, no install", verdict: builtinProbeProfileMigration},+ {name: "migration ignores install wait", verdict: builtinProbeProfileMigration, installing: true},{name: "missing, no install", verdict: builtinProbeMissingProfile},{name: "missing, install running", verdict: builtinProbeMissingProfile, installing: true},} {@@ -522,7 +524,7 @@ func TestNewRuntimeVerdict_DshProfileCarriesAStructuredCause(t *testing.T) {if got.offline.Code != RuntimeOfflineCodeDshProfile {t.Fatalf("code = %q, want %q", got.offline.Code, RuntimeOfflineCodeDshProfile)}- if got.offline.Installing != tc.installing {+ if got.offline.Installing != (tc.installing && tc.verdict != builtinProbeProfileMigration) {t.Fatalf("installing = %v, want %v", got.offline.Installing, tc.installing)}// A repair that NAMES what is missing, and deliberately carries no@@ -546,3 +548,43 @@ func TestNewRuntimeVerdict_DshProfileCarriesAStructuredCause(t *testing.T) {"the daemon may be the stale side of that protocol skew")}}++func TestProbeBuiltinRuntime_DshLegacyProfile(t *testing.T) {+ if runtime.GOOS == "windows" {+ t.Skip("shell fixture")+ }+ for _, manifest := range []string{+ `{"dsh":{"profile":{"bundles":["dsh-profile-multica"]}}}`,+ `{"dependencies":{"@multica-ai/dsh-runtime":"0.0.0-local"},"dsh":{"profile":{"bundles":["dsh-profile-multica"]}}}`,+ `{"dependencies":{"@multica-ai/dsh-runtime":"0.0.0-local"}}`,+ `{"dsh":{"profile":{"bundles":["@multica-ai/dsh-runtime","dsh-profile-multica"]}}}`,+ } {+ t.Run(manifest, func(t *testing.T) {+ path := dshProbeFixture(t, dshProbeOKFrame, true)+ home := os.Getenv("DSH_HOME")+ writeDshProfileManifest(t, home, manifest)+ t.Setenv(dshProfileBundleEnv, "@multica-ai/dsh-runtime")+ d := &Daemon{logger: slog.New(slog.NewTextHandler(io.Discard, nil)), agentVersions: map[string]string{}}+ _, reason, verdict := d.probeBuiltinRuntime(context.Background(), "dsh", AgentEntry{Path: path, Command: "dsh"})+ if verdict != builtinProbeProfileMigration || !demotableBuiltinProbeVerdict(verdict) {+ t.Fatalf("profile verdict = %v, want demotable migration", verdict)+ }+ if !strings.Contains(reason, "dsh.profile.bundles") {+ t.Fatalf("missing migration guidance: %s", reason)+ }+ if err := provisionDshMulticaProfile(context.Background(), path, d.logger); err == nil {+ t.Fatal("explicit provisioning did not refuse the existing bridge")+ }+ if d.dshInstallInFlight.Load() {+ t.Fatal("migration started automatic provisioning")+ }+ if dshMulticaProfilePresent() {+ t.Fatal("invalid profile will not force a discovery round")+ }+ data, err := os.ReadFile(filepath.Join(home, "profiles", dshMulticaProfileName, "package.json"))+ if err != nil || string(data) != manifest {+ t.Fatalf("profile changed: %s, %v", data, err)+ }+ })+ }+}diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex a98e2350a4..74652248a7 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -2368,6 +2368,8 @@ const (// Deterministic like the two above — the same binary keeps refusing until// someone installs the profile — and the reason carries that repair.builtinProbeMissingProfile+ // A bridge is configured but cannot safely serve work; manual migration only.+ builtinProbeProfileMigration// builtinProbeIncompatibleProfile: something answered `--probe`, with a// protocol version this daemon does not drive — a bundle older than the// check, or a newer one this build has yet to catch up with. Reported, and@@ -2398,7 +2400,7 @@ const (// learned this round.func demotableBuiltinProbeVerdict(verdict builtinProbeVerdict) bool {switch verdict {- case builtinProbeBelowMinimum, builtinProbeNotExecutable, builtinProbeMissingProfile:+ case builtinProbeBelowMinimum, builtinProbeNotExecutable, builtinProbeMissingProfile, builtinProbeProfileMigration:return true}return false@@ -2409,7 +2411,7 @@ func demotableBuiltinProbeVerdict(verdict builtinProbeVerdict) bool {//// Only builtinProbeBelowMinimum does not: it is a pure function of a version// string this round already parsed, so a second look reaches the same-// conclusion. The other two are deterministic about the state they describe but+// conclusion. The other demotable verdicts describe deterministic states but// rest on an observation that is not — an installer overwriting the bin entry in// place (the very repair we tell users to run) or a DSH upgrade moving the// profile under a probe. Requiring a second sighting a window later makes those@@ -2419,6 +2421,8 @@ func builtinProbeNeedsConfirmation(verdict builtinProbeVerdict) bool {return verdict != builtinProbeBelowMinimum}+const dshProfileMigrationReason = "the multica DSH profile needs manual migration; back up the profile, build a compatible " + dshMulticaRuntimePackage + " bundle from https://github.com/multica-ai/dsh-multica-runtime following its README, install the directory or tarball with dsh plugin, and update dsh.profile.bundles to load " + dshMulticaRuntimePackage + " instead of " + dshLegacyRuntimePackage + "; a dependencies entry alone does not load the runtime"+// dshMissingProfileReason is the user-facing explanation for a// builtinProbeMissingProfile drop. It names the repair because nothing else in// the daemon's output would: the CLI itself is installed, resolvable and@@ -2479,7 +2483,7 @@ func newRuntimeVerdict(verdict builtinProbeVerdict, reason, execPath string, insoffline.Repair = &repair}return runtimeVerdict{reason: reason, offline: offline}- case builtinProbeMissingProfile:+ case builtinProbeMissingProfile, builtinProbeProfileMigration:// The same class of finding as an unrunnable file: the machine is// reachable and the CLI cannot serve work, so the server must refuse// the trigger and say what is missing rather than queue behind a wait@@ -2490,7 +2494,7 @@ func newRuntimeVerdict(verdict builtinProbeVerdict, reason, execPath string, insoffline := &RuntimeOfflineReason{Code: RuntimeOfflineCodeDshProfile,Detail: reason,- Installing: installing,+ Installing: installing && verdict != builtinProbeProfileMigration,}repair := dshProfileRepair()offline.Repair = &repair@@ -2640,14 +2644,19 @@ probeLoop:// above.if name == "dsh" {// What the probe said decides what may happen next. Only a- // confirmed-absent profile may install a bundle or condemn the- // runtime. An incompatible one is reported and neither installed+ // confirmed-absent profile may install a bundle. A configuration+ // needing migration may demote the runtime but is never overwritten.+ // A protocol-incompatible profile is reported and neither installed// over nor demoted — the profile is deliberately there, and this// daemon may be the stale side of the skew. A probe that merely// failed is transient, on the same rule every other provider's// version probe gets.switch probeDshMulticaProfile(ctx, resolved.Path) {case dshProbeOK:+ case dshProbeNeedsMigration:+ d.logger.Warn("skip registering runtime: DSH Multica runtime profile needs manual migration",+ "name", name, "path", resolved.Path)+ return "", dshProfileMigrationReason, builtinProbeProfileMigrationcase dshProbeMissingProfile:d.logger.Warn("skip registering runtime: DSH Multica runtime profile is not installed","name", name, "path", resolved.Path)diff --git a/server/internal/daemon/dsh_profile.go b/server/internal/daemon/dsh_profile.goindex 6de0cb66ae..d12b07e65f 100644--- a/server/internal/daemon/dsh_profile.go+++ b/server/internal/daemon/dsh_profile.go@@ -56,16 +56,18 @@ const (// the install command so the two cannot drift.dshMulticaProfileName = "multica"- // dshMulticaRuntimePackage is the bridge a multica profile has to name+ // dshMulticaRuntimePackage is the bridge a multica profile has to load// before this daemon will treat the profile as installed. `dsh plugin add`// records that name in dependencies and, when the package is a bundle, in// dsh.profile.bundles — including installs from git, a directory, or a tarball.dshMulticaRuntimePackage = "@multica-ai/dsh-runtime"+ dshLegacyRuntimePackage = "dsh-profile-multica"+ dshBaseProfileBundle = "@deepseek-ai/dsh-base")// dshProfileManifest is the slice of a profile package.json this daemon reads.-// Dependency values are left raw: a string version and an object spec are both-// a named dependency, and a stricter type would make a real install look absent.+// Dependency values are left raw; only their presence matters when separating+// an existing configuration from an empty install skeleton.type dshProfileManifest struct {Dependencies map[string]json.RawMessage `json:"dependencies"`DSH struct {@@ -81,7 +83,7 @@ const dshProvisionTimeout = 3 * time.Minute// dshMulticaProfilePresent reports whether the `multica` profile is installed.//-// Installed means the manifest names the Multica runtime, not that the file+// Installed means the manifest loads the Multica runtime bundle, not that the file// exists. A refused `dsh plugin add` leaves package.json behind with empty// dependencies and only DSH's template bundle; a stat of that file made every// later probe look transient and blocked the automatic install.@@ -129,10 +131,12 @@ func dshMulticaProfileManifestPath() string {}// dshProfileNamesRuntime reports whether the manifest lists the Multica runtime-// as a dependency or as a profile bundle.+// as a loaded profile bundle, without the legacy bridge.func dshProfileNamesRuntime(manifest dshProfileManifest) bool {- if _, ok := manifest.Dependencies[dshMulticaRuntimePackage]; ok {- return true+ for _, bundle := range manifest.DSH.Profile.Bundles {+ if bundle == dshLegacyRuntimePackage {+ return false+ }}for _, bundle := range manifest.DSH.Profile.Bundles {if bundle == dshMulticaRuntimePackage {@@ -142,6 +146,29 @@ func dshProfileNamesRuntime(manifest dshProfileManifest) bool {return false}+// dshMulticaProfileNeedsMigration separates an existing bridge configuration+// from a missing profile or the empty template left by a refused install.+// Never provision over an existing bridge just because it is not usable.+func dshMulticaProfileNeedsMigration() bool {+ data, err := os.ReadFile(dshMulticaProfileManifestPath())+ if err != nil {+ return false+ }+ var manifest dshProfileManifest+ if json.Unmarshal(data, &manifest) != nil || dshProfileNamesRuntime(manifest) {+ return false+ }+ if len(manifest.Dependencies) > 0 {+ return true+ }+ for _, bundle := range manifest.DSH.Profile.Bundles {+ if bundle != dshBaseProfileBundle {+ return true+ }+ }+ return false+}+// dshProfileBundleSpecs returns the configured install candidates, in order,// or nil when the operator has not opted in.func dshProfileBundleSpecs() []string {@@ -321,6 +348,9 @@ func dshProvisionCommand(dshPath, spec string) *exec.Cmd {// best-effort either way, and the missing-profile verdict stands until a probe// succeeds.func provisionDshMulticaProfile(ctx context.Context, dshPath string, logger *slog.Logger) error {+ if dshMulticaProfileNeedsMigration() {+ return fmt.Errorf("%s", dshProfileMigrationReason)+ }specs := dshProfileBundleSpecs()if len(specs) == 0 {return nildiff --git a/server/internal/daemon/dsh_profile_test.go b/server/internal/daemon/dsh_profile_test.goindex 268a10e984..695b9d1244 100644--- a/server/internal/daemon/dsh_profile_test.go+++ b/server/internal/daemon/dsh_profile_test.go@@ -28,8 +28,8 @@ func fakeDsh(t *testing.T) (path, record string) {}// installedDshProfileManifest is a profile whose dependencies and bundle list-// both name the runtime. Either place is enough for the daemon to call it-// installed; writing both matches what a finished `dsh plugin add` leaves.+// both name the runtime. The bundle list decides what DSH loads;+// writing both matches what a finished `dsh plugin add` leaves.func installedDshProfileManifest() string {return "{\"dependencies\":{\"@multica-ai/dsh-runtime\":\"1.0.0\"},\"dsh\":{\"profile\":{\"bundles\":[\"@multica-ai/dsh-runtime\"]}}}\n"}@@ -562,6 +562,8 @@ func TestDshMulticaProfilePresent(t *testing.T) {name stringmanifest string}{+ {name: "dependency names the runtime", manifest: "{\"dependencies\":{\"@multica-ai/dsh-runtime\":\"1.0.0\"}}\n"},+ {name: "dependency value is an object", manifest: "{\"dependencies\":{\"@multica-ai/dsh-runtime\":{\"version\":\"1.0.0\"}}}\n"},{name: "empty object", manifest: "{}\n"},{name: "empty dependencies", manifest: "{\"dependencies\":{}}\n"},{name: "refused-install skeleton", manifest: dshSkeletonProfileManifest()},@@ -580,8 +582,6 @@ func TestDshMulticaProfilePresent(t *testing.T) {name stringmanifest string}{- {name: "dependency names the runtime", manifest: "{\"dependencies\":{\"@multica-ai/dsh-runtime\":\"1.0.0\"}}\n"},- {name: "dependency value is an object", manifest: "{\"dependencies\":{\"@multica-ai/dsh-runtime\":{\"version\":\"1.0.0\"}}}\n"},{name: "bundle names the runtime", manifest: "{\"dsh\":{\"profile\":{\"bundles\":[\"@multica-ai/dsh-runtime\"]}}}\n"},{name: "unparseable manifest", manifest: "{\n"},}@@ -793,3 +793,15 @@ func TestProvisionDshMulticaProfile_CancellationKillsTheWholeTree(t *testing.T)t.Fatalf("a grandchild outlived cancellation and wrote: %s", data)}}++func TestDshMulticaProfileUnreadableManifest(t *testing.T) {+ home := t.TempDir()+ t.Setenv("DSH_HOME", home)+ // A directory produces a read error even when tests run with elevated permissions.+ if err := os.MkdirAll(dshMulticaProfileManifestPath(), 0o755); err != nil {+ t.Fatal(err)+ }+ if !dshMulticaProfilePresent() || dshMulticaProfileNeedsMigration() {+ t.Fatal("an unreadable manifest must remain unknown, not missing or requiring migration")+ }+}diff --git a/server/internal/service/agent_ready.go b/server/internal/service/agent_ready.goindex c849a1856d..cba093e34c 100644--- a/server/internal/service/agent_ready.go+++ b/server/internal/service/agent_ready.go@@ -293,7 +293,7 @@ func RuntimeUnusableNotice(agentName string, verdict AgentVerdict) string {}// runtimeProfileMissingNotice explains a runtime whose CLI runs but whose-// Multica runtime profile is absent.+// Multica runtime profile is absent or needs manual migration.//// No fenced command, deliberately. The install is `dsh plugin --profile multica// add <bundle>`, and <bundle> is the operator's own choice of package,@@ -304,8 +304,9 @@ func RuntimeUnusableNotice(agentName string, verdict AgentVerdict) string {// bundle, and pointing at the docs that list them, is the honest version.func runtimeProfileMissingNotice(name string) string {return fmt.Sprintf(- "%s could not start: the DeepSeek Harness CLI is installed on that machine, but the `multica` runtime profile it needs is not, so this trigger was not queued.\n\n"+- "The profile supplies the protocol Multica drives — the CLI itself is fine, and reinstalling it changes nothing. On that machine, either add the Multica DSH runtime bundle to the profile with `dsh plugin --profile multica add`, or set `MULTICA_DSH_PROFILE_BUNDLE` for the daemon so it installs the bundle itself. See the agent runtime install docs for the bundle to use.\n\n"++ "%s could not start: the DeepSeek Harness CLI is installed on that machine, but its `multica` runtime profile is missing or needs migration, so this trigger was not queued.\n\n"++ "Build a compatible `@multica-ai/dsh-runtime` bundle from [multica-ai/dsh-multica-runtime](https://github.com/multica-ai/dsh-multica-runtime#local-development), following its README's DSH version requirements. For a missing profile, install the built directory or tarball with `dsh plugin --profile multica add`, or set `MULTICA_DSH_PROFILE_BUNDLE` for the daemon to install it.\n\n"++ "For an existing bridge configuration, back up the profile and install the compatible bundle manually. In `dsh.profile.bundles`, replace `dsh-profile-multica` with `@multica-ai/dsh-runtime`; if both are listed, remove `dsh-profile-multica`. If the first-party runtime is only in `dependencies`, add it to `dsh.profile.bundles`. `MULTICA_DSH_PROFILE_BUNDLE` will not migrate an existing bridge configuration.\n\n"+"The runtime registers on its own within a couple of minutes after that; trigger the agent again then.",name,)diff --git a/server/internal/service/reason_code_test.go b/server/internal/service/reason_code_test.goindex 566a8458ef..f7e4aa4f3e 100644--- a/server/internal/service/reason_code_test.go+++ b/server/internal/service/reason_code_test.go@@ -232,3 +232,26 @@ func TestRuntimeUnusableNotice(t *testing.T) {t.Errorf("access-denied notice must include both recovery paths:\n%s", accessDenied)}}++func TestRuntimeProfileNoticeIncludesManualMigrationPath(t *testing.T) {+ verdict := runtimeVerdict(db.AgentRuntime{+ Status: "offline",+ Metadata: []byte(`{"offline_reason":{"code":"dsh_profile","detail":"the multica DSH profile needs manual migration","installing":false}}`),+ }, db.Agent{})+ if !verdict.Blocked() || verdict.Reason != dispatch.ReasonRuntimeProfileMissing {+ t.Fatalf("migration must refuse the trigger with the existing profile reason: %+v", verdict)+ }+ notice := RuntimeUnusableNotice("Kit", verdict)+ for _, required := range []string{+ "Kit",+ "https://github.com/multica-ai/dsh-multica-runtime",+ "`dsh.profile.bundles`",+ "replace `dsh-profile-multica` with `@multica-ai/dsh-runtime`",+ "back up",+ "will not migrate",+ } {+ if !strings.Contains(notice, required) {+ t.Errorf("blocked-trigger notice lacks migration instruction %q:\n%s", required, notice)+ }+ }+}