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

推荐订阅源

Y
Y Combinator Blog
V
V2EX
Jina AI
Jina AI
爱范儿
爱范儿
M
MIT News - Artificial intelligence
量子位
L
LangChain Blog
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
罗磊的独立博客
腾讯CDC
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss

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
fix(agents): load manifest-owned harnesses · openclaw/ope...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main

@@ -6,6 +6,7 @@ const mocks = vi.hoisted(() => ({

66

ensurePluginRegistryLoaded: vi.fn(),

77

resolveActivatableProviderOwnerPluginIds: vi.fn(),

88

resolveBundledProviderCompatPluginIds: vi.fn(),

9+

resolveManifestActivationPlan: vi.fn(),

910

resolveOwningPluginIdsForProvider: vi.fn(),

1011

}));

1112

@@ -20,14 +21,41 @@ vi.mock("../../plugins/providers.js", () => ({

2021

resolveOwningPluginIdsForProviderRef: mocks.resolveOwningPluginIdsForProvider,

2122

}));

222324+

vi.mock("../../plugins/activation-planner.js", () => ({

25+

resolveManifestActivationPlan: mocks.resolveManifestActivationPlan,

26+

}));

27+2328

describe("ensureSelectedAgentHarnessPlugin", () => {

2429

let ensureSelectedAgentHarnessPlugin: typeof import("./runtime-plugin.js").ensureSelectedAgentHarnessPlugin;

25302631

beforeEach(async () => {

2732

mocks.ensurePluginRegistryLoaded.mockReset();

2833

mocks.resolveActivatableProviderOwnerPluginIds.mockReset();

2934

mocks.resolveBundledProviderCompatPluginIds.mockReset();

35+

mocks.resolveManifestActivationPlan.mockReset();

3036

mocks.resolveOwningPluginIdsForProvider.mockReset();

37+

mocks.resolveManifestActivationPlan.mockImplementation(

38+

({

39+

trigger,

40+

config,

41+

}: {

42+

trigger: { kind: "agentHarness"; runtime: string };

43+

config?: OpenClawConfig;

44+

}) => {

45+

const pluginId = trigger.runtime;

46+

const allow = config?.plugins?.allow ?? [];

47+

if (

48+

config?.plugins?.entries?.[pluginId]?.enabled === false ||

49+

(allow.length > 0 && !allow.includes(pluginId))

50+

) {

51+

return { entries: [] };

52+

}

53+

return {

54+

entries:

55+

pluginId === "codex" || pluginId === "copilot" ? [{ pluginId, origin: "bundled" }] : [],

56+

};

57+

},

58+

);

3159

mocks.resolveOwningPluginIdsForProvider.mockImplementation(

3260

({ provider }: { provider: string }) => (provider === "openai" ? ["openai"] : undefined),

3361

);

@@ -132,6 +160,54 @@ describe("ensureSelectedAgentHarnessPlugin", () => {

132160

);

133161

});

134162163+

it("loads a manifest-owned custom harness runtime before selection", async () => {

164+

mocks.resolveManifestActivationPlan.mockReturnValueOnce({

165+

entries: [{ pluginId: "custom-harness-plugin", origin: "workspace" }],

166+

});

167+168+

await ensureSelectedAgentHarnessPlugin({

169+

provider: "custom-provider",

170+

modelId: "custom-model",

171+

config: {

172+

plugins: {

173+

entries: {

174+

"custom-harness-plugin": { enabled: true },

175+

},

176+

},

177+

} as OpenClawConfig,

178+

agentHarnessRuntimeOverride: "custom-harness",

179+

workspaceDir: "/tmp/workspace",

180+

});

181+182+

expect(mocks.resolveManifestActivationPlan).toHaveBeenCalledWith({

183+

trigger: { kind: "agentHarness", runtime: "custom-harness" },

184+

config: expect.any(Object),

185+

workspaceDir: "/tmp/workspace",

186+

});

187+

expect(mocks.ensurePluginRegistryLoaded).toHaveBeenCalledWith(

188+

expect.objectContaining({

189+

scope: "all",

190+

workspaceDir: "/tmp/workspace",

191+

onlyPluginIds: ["custom-harness-plugin", "memory-core"],

192+

}),

193+

);

194+

});

195+196+

it("does not activate an untrusted workspace harness from manifest metadata alone", async () => {

197+

mocks.resolveManifestActivationPlan.mockReturnValueOnce({

198+

entries: [{ pluginId: "custom-harness-plugin", origin: "workspace" }],

199+

});

200+201+

await ensureSelectedAgentHarnessPlugin({

202+

provider: "custom-provider",

203+

modelId: "custom-model",

204+

agentHarnessRuntimeOverride: "custom-harness",

205+

workspaceDir: "/tmp/workspace",

206+

});

207+208+

expect(mocks.ensurePluginRegistryLoaded).not.toHaveBeenCalled();

209+

});

210+135211

it("does not bypass a restrictive allowlist that omits a configured Copilot harness", async () => {

136212

// A configured harness can request loading, but explicit plugin allowlists

137213

// remain the operator's boundary and are not widened implicitly.

@@ -158,21 +234,7 @@ describe("ensureSelectedAgentHarnessPlugin", () => {

158234

workspaceDir: "/tmp/workspace",

159235

});

160236161-

expect(mocks.ensurePluginRegistryLoaded).toHaveBeenCalledWith(

162-

expect.objectContaining({

163-

scope: "all",

164-

workspaceDir: "/tmp/workspace",

165-

onlyPluginIds: ["copilot"],

166-

config: expect.objectContaining({

167-

plugins: expect.objectContaining({

168-

allow: ["telegram"],

169-

entries: expect.not.objectContaining({

170-

copilot: expect.anything(),

171-

}),

172-

}),

173-

}),

174-

}),

175-

);

237+

expect(mocks.ensurePluginRegistryLoaded).not.toHaveBeenCalled();

176238

});

177239178240

it("widens a scoped harness allowlist with the provider owner for openai models", async () => {

@@ -337,22 +399,7 @@ describe("ensureSelectedAgentHarnessPlugin", () => {

337399

expect(mocks.resolveOwningPluginIdsForProvider).not.toHaveBeenCalled();

338400

expect(mocks.resolveBundledProviderCompatPluginIds).not.toHaveBeenCalled();

339401

expect(mocks.resolveActivatableProviderOwnerPluginIds).not.toHaveBeenCalled();

340-

expect(mocks.ensurePluginRegistryLoaded).toHaveBeenCalledWith(

341-

expect.objectContaining({

342-

scope: "all",

343-

workspaceDir: "/tmp/workspace",

344-

onlyPluginIds: ["codex"],

345-

config: expect.objectContaining({

346-

plugins: expect.objectContaining({

347-

allow: ["telegram"],

348-

entries: expect.not.objectContaining({

349-

codex: expect.anything(),

350-

openai: expect.anything(),

351-

}),

352-

}),

353-

}),

354-

}),

355-

);

402+

expect(mocks.ensurePluginRegistryLoaded).not.toHaveBeenCalled();

356403

});

357404358405

it("keeps real bundled memory-core in a Codex scoped load when the provider has no owner plugin", async () => {

@@ -417,5 +464,6 @@ describe("ensureSelectedAgentHarnessPlugin", () => {

417464418465

expect(mocks.ensurePluginRegistryLoaded).not.toHaveBeenCalled();

419466

expect(mocks.resolveOwningPluginIdsForProvider).not.toHaveBeenCalled();

467+

expect(mocks.resolveManifestActivationPlan).not.toHaveBeenCalled();

420468

});

421469

});