Repository navigation
Replies: 9 comments 1 reply
|
I traced this through the Connection implementation and noticed that Since I'm curious whether plugins that register channels through |
复现补充 / Reproduction (Discussion #5926)
Environment: dsh 0.1.5-rc.1 (npm SymptomEvery custom RPC channel a third-party plugin registers is absent from the Host web server. Any POST hits the SPA fallback and returns 405 — indistinguishable from a made-up path: The plugin's own GUI shows Why it is silentThe throw happens inside the plugin's Root cause
// dsh-client-connection/lib/index.js:618
return owner.effect(() => owner.webServer.register(route), `client-connection: ${channel} rpc channel`);but the Web server is injected only in a child context: // dsh-client-connection/lib/index.js:758
ctx.inject(["webServer"], (webCtx) => { ... webCtx.effect(() => webCtx.webServer.register(route), "client-connection: /api route"); });Under cordis 4.x, reading a service property that was not injected throws, so the very first Local fix that works (verified)const rpcWebServer = this.ctx.get("webServer", false); // ctx.get() reads a service without the inject requirement
if (rpcWebServer === void 0) throw new Error(`client-connection: Web server is unavailable for RPC channel ${JSON.stringify(channel)}`);
return owner.effect(() => rpcWebServer.register(route), `client-connection: ${channel} rpc channel`);After this one-line change the same probes return 401 (registered + auth fence) instead of 405 and the plugin UI works again. ( Secondary observation
|
|
@jyotish6699 asked whether the calling plugin needs to declare @hudsonhou the Detail, source map, and the patch shape I would suggest (mirror Disclosure of scope: measured in the package's own test environment on |
|
补一个命中者,供修复优先级参考(现象与 #6105 的 405 视角一致):
条目级 workaround 在 0.1.5-rc.2 上实测有效(405 → 401,随后带会话 cookie 调用返回真实设置 JSON): # ~/.dsh/profiles/web/cordis.patch.yml
- id: connection
inject: [webRuntime, webServer] # inject 是整体替换,必须保留原有的 webRuntime与 #6105 同一提醒:这会让 web carrier 在条目层变成硬依赖,只适合 web profile(headless / 无 web carrier 的部署不要用)。 |
|
Confirming on DSH 0.1.5 from a third-party plugin that registers a Web RPC channel via |
|
Fourth affected plugin, plus one more fix shape that depends on neither the caller's nor the carrier's row-level Affected plugin
ctx.connection.rpc.handle("/autoUpdate", handler, { authority: "loopback" });Environment: Same signatureSo Two details that may help others localise it:
The regression is bracketed by two published versions
That lines up with the "worked before the upgrade" reports, and it also clears the plugin: its source is byte-identical to its upstream A carrier-independent fix shapelittle3tar's row-level patch ( For a plugin that must work in both, the channel can instead be mounted by the plugin itself, without going through ctx.inject(["webServer"], (webCtx) => {
webCtx.effect(() => webCtx.webServer.register({
kind: "prefix",
path: "/autoUpdate",
handler: async (req, res) => {
// same Host/Origin + auth fence as the shared channel
const rejection = ctx.connection.requestRejection(req);
if (rejection !== void 0) {
res.writeHead(rejection);
res.end(rejection === 401 ? "unauthorized" : "forbidden");
return;
}
if (req.method !== "POST") { res.writeHead(405); res.end("method not allowed"); return; }
// …read body, validate {type:"client-request", rpcId, method, payload},
// dispatch to the plugin's own handler, reply {type:"server-response", rpcId, result}
}
}), "auto-update: /autoUpdate rpc channel");
});
This shape is also independent of both inject lists, so it keeps working regardless of where the carrier sits in the fiber chain (PerryLink's finding above). Secondary issue: the third argument of
|
|
Fifth affected plugin, plus a secondary defect in the same call path that I have not seen filed yet. Affected plugin: Environment: DSH Desktop 0.9.0 bundling Same signature, with a three-way discriminator. Reproduced on an isolated instance ( 405 vs 401 vs 404 cleanly separates "route never mounted" from "mounted behind the auth fence" from "genuinely absent" — worth using as the standard probe. Independent confirmation of the root cause, obtained by instrumenting the plugin (plugin source left byte-identical to upstream) and then the cordis The fiber reaching Secondary defect in the same path — the third argument is silently dropped.
// @eric.wen/dsh-sight/lib/index.js:1248
ctx.connection.rpc.handle(SIGHT_RPC_CHANNEL, handler, { authority: "loopback" });Its own source comment says the channel is meant to be loopback-only ("only the plugin's own page can call it"). In 0.1.5-rc.2, Mentioned once earlier in this thread but with no second hit and no follow-up; flagging it here with a concrete affected plugin and line reference. Thanks for tracking this — the version bracket table earlier in the thread (0.1.2-rc.1 |
|
Independent confirmation on 0.1.5-rc.2 with a real Setup. One web profile containing four host/client plugins that register channels via Instrumenting the plugin side (plugin source otherwise untouched) gave the same throw, and I think this three-line probe is the cleanest one-shot discriminator: i.e. the caller's own Version bracket, same profile content. Booting the same pre-upgrade The row-level patch works here too (405 -> 200 on all four) — but watch - id: connection
name: '@deepseek-ai/dsh-client-connection'
inject: [webRuntime, webServer]
config:
trustedHosts: !!js ctx.webRuntime.trustedHosts # <- must be re-declaredThe Also agreeing with the headless caveat: this makes the web carrier a hard row-level dependency, so it is web-profile-only. For a plugin that must run under both, WangYvShun's self-mounted-route shape is the safer one. User-visible symptoms, for anyone matching a report. In our profile the same defect appeared as: a settings section rendering its "unavailable" state instead of live host data; a diagnostics section whose fields were empty; and one panel that reported "nothing here" for a session that did have entries (it keeps a client-side fallback, so only the whole-log baseline was missing). Only one of the four logged anything client-side; the host logged nothing at all. All returned to normal after the row patch — including the clock section, which went back to the live host time/timezone/hostname. Thanks for the thorough thread — the version bracket and the 405/401/404 discriminator are what let me stop looking at the plugins. |
|
Still present in 0.2.0-rc.2 (current latest), with a sixth affected plugin — and on 0.2 the failure is no longer silent. 摘要(中文):0.2.0-rc.2 仍未修复。受影响插件是 Environment — DSH Desktop 0.2.0-rc.2 ( Affected plugin — ctx.connection.rpc.handle("/dsh-automation", handler, { authority: "loopback" });Blast radius is larger than "channel missing". The registration sits inside the plugin's activation effect, so the throw fails the whole entry, not only its channel:
Reading the swallowed throw on 0.2 without instrumenting the plugin — both go through already-registered surfaces: # 1) which rows failed
POST /api/pluginInventory/list {"args": {}}
# -> entries[].fiberPhase == "failed"
# 2) the exact activation error, returned in the response body
POST /api/pluginManager/setPluginEnabled
{"args": {"id": "include:dsh-automation", "enabled": false}}
POST /api/pluginManager/setPluginEnabled
{"args": {"id": "include:dsh-automation", "enabled": true}}
# -> result.error.diagnostic:
# dsh-automation (@dsh-external/dsh-automation):
# Error: cannot get property "webServer" without injectCaveat for anyone reusing this: with HMR present the toggle re-runs Still unchanged in 0.2.0-rc.2 — Probe note for 0.2 — the 405/401/404 discriminator still holds, with one addition: on this build every legacy per-channel path returns 405, including the host's own historical channel names ( Workaround verified end-to-end on 0.2.0-rc.2 — the self-mounted route shape (mounting The plugin is innocent — diffing the installed bundle against upstream at the pinned commit shows only two local compatibility patches (a Thanks — the version bracket table and the probe discriminator in this thread are what stopped me looking at the plugin. Posting this mainly so the 0.2 line is on the record: the row-level |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
After upgrading from
dsh-v0.1.3-alpha.1todsh-v0.1.3-alpha.2(currently atc389f96bf3, merge #3713), bootingdsh webfails when a third-party client plugin (dsh-sshv0.3.0-pre, which registers its/dsh-sshchannel throughctx.connection.rpc.handle) tries to mount its channel:Root cause
HostConnectionService.register/registerFetchRoute(packages/client/connection/src/rpc-host.ts:178-179) accessowner.webServer.register(route)on the connection plugin's own context (owner=this.ctx), butconnection's top-level inject list (packages/client/connection/src/index.ts:69) only declares['credentials']and does not declarewebServer. With Cordis' strict service-access check (vendor/cordis/src/reflect.ts:144), reading an undeclared service on the plugin context throws and aborts the whole plugin-tree boot.First-party plugins register routes through their own declared services, so only third-party plugins that register an HTTP channel via
connection.rpc/connection.fetchhit this —dsh-sshis the first one to expose the gap.dsh-v0.1.3-alpha.1booted fine; the failure appeared after the alpha.2 upgrade.Expected behavior
Either declare
webServerinconnection's top-levelinject(it genuinely depends on the web server to mount channels), or wrap theowner.webServer.register(...)calls inregister/registerFetchRoutewith a localowner.inject(['webServer'], ...)so the dependency stays scoped.Workaround (local)
Environment
dsh-v0.1.3-alpha.2-133-gc389f96bf3(HEADc389f96bf3, 2026-09-08, merge An unset value in an MCP entry env kills the whole harness, and the error omits the key that caused it #3713)git clean -fdx && pnpm install && pnpm run buildall succeed;pnpm dsh webfails at plugin-tree boot$DSH_HOME/profiles/web/dsh-sshviactx.connection.rpc.handle, lib/web.js ~:298)All reactions