mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 13:11:40 +00:00
fix(plugins): late-binding subagent runtime for non-gateway load paths (#46648)
Merged via squash.
Prepared head SHA: 44742652c9
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Reviewed-by: @jalehman
This commit is contained in:
@@ -926,6 +926,44 @@ module.exports = { id: "skipped", register() { throw new Error("skipped plugin s
|
||||
expect(third).toBe(second);
|
||||
});
|
||||
|
||||
it("does not reuse cached registries across gateway subagent binding modes", () => {
|
||||
useNoBundledPlugins();
|
||||
const plugin = writePlugin({
|
||||
id: "cache-gateway-bindable",
|
||||
filename: "cache-gateway-bindable.cjs",
|
||||
body: `module.exports = { id: "cache-gateway-bindable", register() {} };`,
|
||||
});
|
||||
|
||||
const options = {
|
||||
workspaceDir: plugin.dir,
|
||||
config: {
|
||||
plugins: {
|
||||
allow: ["cache-gateway-bindable"],
|
||||
load: {
|
||||
paths: [plugin.file],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const defaultRegistry = loadOpenClawPlugins(options);
|
||||
const gatewayBindableRegistry = loadOpenClawPlugins({
|
||||
...options,
|
||||
runtimeOptions: {
|
||||
allowGatewaySubagentBinding: true,
|
||||
},
|
||||
});
|
||||
const gatewayBindableAgain = loadOpenClawPlugins({
|
||||
...options,
|
||||
runtimeOptions: {
|
||||
allowGatewaySubagentBinding: true,
|
||||
},
|
||||
});
|
||||
|
||||
expect(gatewayBindableRegistry).not.toBe(defaultRegistry);
|
||||
expect(gatewayBindableAgain).toBe(gatewayBindableRegistry);
|
||||
});
|
||||
|
||||
it("evicts least recently used registries when the loader cache exceeds its cap", () => {
|
||||
useNoBundledPlugins();
|
||||
const plugin = writePlugin({
|
||||
|
||||
Reference in New Issue
Block a user