Skip to content

Commit 781ded8

Browse files
authored
fix(plugins): register static node-host commands without activation (#127043)
The node host resolves its plugin registry via loadPluginRegistryHandle (activate:false). Since #117587 static definition.nodeHostCommands only registered under runFullActivationOnlyRegistrations, so headless nodes silently lost browser.proxy (and the browser/file caps), breaking the meeting-bot chain with 'No connected Google Meet-capable node with browser proxy'. Register node-host commands in every load mode; each command keeps its own isAvailable gate. reload and security audit collectors stay activation-only.
1 parent 4343b38 commit 781ded8

2 files changed

Lines changed: 56 additions & 3 deletions

File tree

‎src/plugins/loader-runtime-candidate.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,17 @@ export function loadRuntimePluginCandidate(params: {
507507
}
508508
return;
509509
}
510+
// Node-host commands register in every load mode: the node host resolves its
511+
// registry without activation (loadPluginRegistryHandle), and each command is
512+
// already availability-gated per invocation. Gating them on full activation
513+
// silently strips static registrations like browser.proxy from headless nodes.
514+
for (const nodeHostCommand of definition?.nodeHostCommands ?? []) {
515+
params.registryBuilder.registerNodeHostCommand(record, nodeHostCommand);
516+
}
510517
if (registrationPlan.runFullActivationOnlyRegistrations) {
511518
if (definition?.reload) {
512519
params.registryBuilder.registerReload(record, definition.reload);
513520
}
514-
for (const nodeHostCommand of definition?.nodeHostCommands ?? []) {
515-
params.registryBuilder.registerNodeHostCommand(record, nodeHostCommand);
516-
}
517521
for (const collector of definition?.securityAuditCollectors ?? []) {
518522
params.registryBuilder.registerSecurityAuditCollector(record, collector);
519523
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/** Verifies static plugin nodeHostCommands survive non-activating registry loads (node-host path). */
2+
import { afterAll, afterEach, expect, it } from "vitest";
3+
import {
4+
cleanupPluginLoaderFixturesForTest,
5+
loadOpenClawPlugins,
6+
resetPluginLoaderTestStateForTest,
7+
useNoBundledPlugins,
8+
writePlugin,
9+
} from "./loader.test-fixtures.js";
10+
11+
afterEach(resetPluginLoaderTestStateForTest);
12+
afterAll(cleanupPluginLoaderFixturesForTest);
13+
14+
// The node host resolves its registry via loadPluginRegistryHandle (activate:false).
15+
// Static nodeHostCommands (e.g. the browser plugin's browser.proxy) must register
16+
// there too, or headless meeting/browser nodes silently lose their surface.
17+
it("registers static nodeHostCommands without activation", () => {
18+
useNoBundledPlugins();
19+
const plugin = writePlugin({
20+
id: "node-surface",
21+
body: `module.exports = {
22+
id: "node-surface",
23+
nodeHostCommands: [{
24+
command: "nodesurface.proxy",
25+
cap: "node-surface",
26+
handle: async () => "ok",
27+
}],
28+
register() {},
29+
};`,
30+
});
31+
32+
const registry = loadOpenClawPlugins({
33+
cache: false,
34+
activate: false,
35+
workspaceDir: plugin.dir,
36+
config: {
37+
plugins: {
38+
load: { paths: [plugin.file] },
39+
allow: [plugin.id],
40+
},
41+
},
42+
onlyPluginIds: [plugin.id],
43+
});
44+
45+
expect(registry.plugins.find((entry) => entry.id === plugin.id)?.status).toBe("loaded");
46+
expect(registry.nodeHostCommands.map((entry) => entry.command.command)).toContain(
47+
"nodesurface.proxy",
48+
);
49+
});

0 commit comments

Comments
 (0)