惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Martin Fowler
Martin Fowler
I
InfoQ
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
爱范儿
爱范儿
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
D
Docker
博客园 - 三生石上(FineUI控件)
Y
Y Combinator Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
B
Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
Jina AI
Jina AI
V
Visual Studio Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
perf(plugins): reuse compatible gateway startup registry ...
ai-hpc · 2026-05-21 · via Recent Commits to openclaw:main

@@ -0,0 +1,116 @@

1+

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

2+

import { clearPluginLoaderCache, testing } from "../loader.js";

3+

import { createEmptyPluginRegistry } from "../registry-empty.js";

4+

import type { PluginRegistry } from "../registry-types.js";

5+

import { resetPluginRuntimeStateForTest, setActivePluginRegistry } from "../runtime.js";

6+7+

const loaderMocks = vi.hoisted(() => ({

8+

loadOpenClawPlugins: vi.fn<typeof import("../loader.js").loadOpenClawPlugins>(),

9+

}));

10+11+

vi.mock("../loader.js", async (importOriginal) => {

12+

const actual = await importOriginal<typeof import("../loader.js")>();

13+

return {

14+

...actual,

15+

loadOpenClawPlugins: (...args: Parameters<typeof loaderMocks.loadOpenClawPlugins>) =>

16+

loaderMocks.loadOpenClawPlugins(...args),

17+

};

18+

});

19+20+

const { ensureStandaloneRuntimePluginRegistryLoaded } =

21+

await import("./standalone-runtime-registry-loader.js");

22+23+

function createRegistryWithPlugin(pluginId: string): PluginRegistry {

24+

const registry = createEmptyPluginRegistry();

25+

registry.plugins.push({

26+

id: pluginId,

27+

status: "loaded",

28+

} as never);

29+

return registry;

30+

}

31+32+

beforeEach(() => {

33+

loaderMocks.loadOpenClawPlugins.mockReset();

34+

});

35+36+

afterEach(() => {

37+

clearPluginLoaderCache();

38+

resetPluginRuntimeStateForTest();

39+

});

40+41+

describe("ensureStandaloneRuntimePluginRegistryLoaded", () => {

42+

it("reuses a compatible gateway startup registry for gateway-bindable dispatch load options", () => {

43+

const activeRegistry = createRegistryWithPlugin("telegram");

44+

activeRegistry.coreGatewayMethodNames = ["sessions.get", "sessions.list"];

45+

const config = { plugins: { allow: ["telegram"] } };

46+

const startupLoadOptions = {

47+

config,

48+

activationSourceConfig: config,

49+

autoEnabledReasons: {},

50+

workspaceDir: "/tmp/ws",

51+

onlyPluginIds: ["telegram"],

52+

coreGatewayMethodNames: ["sessions.get", "sessions.list"],

53+

runtimeOptions: {

54+

allowGatewaySubagentBinding: true,

55+

},

56+

preferBuiltPluginArtifacts: true,

57+

};

58+

const { cacheKey } = testing.resolvePluginLoadCacheContext(startupLoadOptions);

59+

setActivePluginRegistry(activeRegistry, cacheKey, "gateway-bindable", "/tmp/ws");

60+61+

const result = ensureStandaloneRuntimePluginRegistryLoaded({

62+

loadOptions: {

63+

config,

64+

onlyPluginIds: ["telegram"],

65+

runtimeOptions: {

66+

allowGatewaySubagentBinding: true,

67+

},

68+

workspaceDir: "/tmp/ws",

69+

},

70+

});

71+72+

expect(result).toBe(activeRegistry);

73+

expect(loaderMocks.loadOpenClawPlugins).not.toHaveBeenCalled();

74+

});

75+76+

it("loads a fresh registry when dispatch config is not startup-compatible", () => {

77+

const activeRegistry = createRegistryWithPlugin("telegram");

78+

activeRegistry.coreGatewayMethodNames = ["sessions.get", "sessions.list"];

79+

const config = { plugins: { allow: ["telegram"] } };

80+

const startupLoadOptions = {

81+

config,

82+

activationSourceConfig: config,

83+

autoEnabledReasons: {},

84+

workspaceDir: "/tmp/ws",

85+

onlyPluginIds: ["telegram"],

86+

coreGatewayMethodNames: ["sessions.get", "sessions.list"],

87+

runtimeOptions: {

88+

allowGatewaySubagentBinding: true,

89+

},

90+

preferBuiltPluginArtifacts: true,

91+

};

92+

const { cacheKey } = testing.resolvePluginLoadCacheContext(startupLoadOptions);

93+

setActivePluginRegistry(activeRegistry, cacheKey, "gateway-bindable", "/tmp/ws");

94+

const loadedRegistry = createRegistryWithPlugin("telegram");

95+

loaderMocks.loadOpenClawPlugins.mockReturnValue(loadedRegistry);

96+97+

const result = ensureStandaloneRuntimePluginRegistryLoaded({

98+

loadOptions: {

99+

config: {

100+

plugins: {

101+

allow: ["telegram"],

102+

load: { paths: ["/tmp/changed.js"] },

103+

},

104+

},

105+

onlyPluginIds: ["telegram"],

106+

runtimeOptions: {

107+

allowGatewaySubagentBinding: true,

108+

},

109+

workspaceDir: "/tmp/ws",

110+

},

111+

});

112+113+

expect(result).toBe(loadedRegistry);

114+

expect(loaderMocks.loadOpenClawPlugins).toHaveBeenCalledOnce();

115+

});

116+

});