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

推荐订阅源

美团技术团队
Microsoft Azure Blog
Microsoft Azure Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog
Y
Y Combinator Blog
博客园_首页
有赞技术团队
有赞技术团队
博客园 - Franky
腾讯CDC
G
Google Developers Blog
Recent Announcements
Recent Announcements
博客园 - 【当耐特】
D
Docker
The GitHub Blog
The GitHub Blog
MyScale Blog
MyScale Blog
H
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
V
V2EX
U
Unit 42
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学

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(channels): refresh plugin registry after on-demand in...
vincentkoc · 2026-04-26 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -29,6 +29,7 @@ type ResolveInstallableChannelPluginResult = {

2929

plugin?: ChannelPlugin;

3030

catalogEntry?: ChannelPluginCatalogEntry;

3131

configChanged: boolean;

32+

pluginInstalled: boolean;

3233

};

3334
3435

function resolveWorkspaceDir(cfg: OpenClawConfig) {

@@ -197,6 +198,7 @@ export async function resolveInstallableChannelPlugin(params: {

197198

cfg: nextCfg,

198199

catalogEntry,

199200

configChanged: false,

201+

pluginInstalled: false,

200202

};

201203

}

202204

@@ -208,6 +210,7 @@ export async function resolveInstallableChannelPlugin(params: {

208210

plugin: existing,

209211

catalogEntry,

210212

configChanged: false,

213+

pluginInstalled: false,

211214

};

212215

}

213216

@@ -227,6 +230,7 @@ export async function resolveInstallableChannelPlugin(params: {

227230

plugin: scoped,

228231

catalogEntry,

229232

configChanged: false,

233+

pluginInstalled: false,

230234

};

231235

}

232236

@@ -258,6 +262,7 @@ export async function resolveInstallableChannelPlugin(params: {

258262

? { ...catalogEntry, pluginId: installedPluginId }

259263

: catalogEntry,

260264

configChanged: nextCfg !== params.cfg,

265+

pluginInstalled: installResult.installed,

261266

};

262267

}

263268

}

@@ -268,5 +273,6 @@ export async function resolveInstallableChannelPlugin(params: {

268273

plugin: existing,

269274

catalogEntry,

270275

configChanged: false,

276+

pluginInstalled: false,

271277

};

272278

}

Original file line numberDiff line numberDiff line change

@@ -30,6 +30,10 @@ const pluginInstallMocks = vi.hoisted(() => ({

3030

loadChannelSetupPluginRegistrySnapshotForChannel: vi.fn(),

3131

}));

3232
33+

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

34+

refreshPluginRegistryAfterConfigMutation: vi.fn(async () => undefined),

35+

}));

36+
3337

vi.mock("../channels/plugins/catalog.js", () => ({

3438

listChannelPluginCatalogEntries: catalogMocks.listChannelPluginCatalogEntries,

3539

}));

@@ -50,6 +54,8 @@ vi.mock("../channels/plugins/bundled.js", async () => {

5054
5155

vi.mock("./channel-setup/plugin-install.js", () => pluginInstallMocks);

5256
57+

vi.mock("../cli/plugins-registry-refresh.js", () => registryRefreshMocks);

58+
5359

const runtime = createTestRuntime();

5460
5561

function listConfiguredAccountIds(

@@ -268,6 +274,7 @@ describe("channelsAddCommand", () => {

268274

vi.mocked(loadChannelSetupPluginRegistrySnapshotForChannel).mockReturnValue(

269275

createTestRegistry(),

270276

);

277+

registryRefreshMocks.refreshPluginRegistryAfterConfigMutation.mockClear();

271278

setMinimalChannelsAddRegistryForTests();

272279

});

273280

@@ -481,6 +488,16 @@ describe("channelsAddCommand", () => {

481488

expect(loadChannelSetupPluginRegistrySnapshotForChannel).toHaveBeenCalledWith(

482489

expect.objectContaining({ installRuntimeDeps: false }),

483490

);

491+

expect(registryRefreshMocks.refreshPluginRegistryAfterConfigMutation).toHaveBeenCalledWith(

492+

expect.objectContaining({

493+

config: expect.objectContaining({

494+

channels: expect.objectContaining({

495+

"external-chat": expect.objectContaining({ enabled: true }),

496+

}),

497+

}),

498+

reason: "source-changed",

499+

}),

500+

);

484501

expectExternalChatEnabledConfigWrite();

485502

expect(runtime.error).not.toHaveBeenCalled();

486503

expect(runtime.exit).not.toHaveBeenCalled();

Original file line numberDiff line numberDiff line change

@@ -19,6 +19,10 @@ const catalogMocks = vi.hoisted(() => ({

1919

listChannelPluginCatalogEntries: vi.fn((): ChannelPluginCatalogEntry[] => []),

2020

}));

2121
22+

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

23+

refreshPluginRegistryAfterConfigMutation: vi.fn(async () => undefined),

24+

}));

25+
2226

vi.mock("../channels/plugins/catalog.js", async () => {

2327

const actual = await vi.importActual<typeof import("../channels/plugins/catalog.js")>(

2428

"../channels/plugins/catalog.js",

@@ -48,6 +52,8 @@ vi.mock("./channel-setup/plugin-install.js", async () => {

4852

return createMockChannelSetupPluginInstallModule(actual);

4953

});

5054
55+

vi.mock("../cli/plugins-registry-refresh.js", () => registryRefreshMocks);

56+
5157

const runtime = createTestRuntime();

5258
5359

describe("channelsRemoveCommand", () => {

@@ -79,6 +85,7 @@ describe("channelsRemoveCommand", () => {

7985

vi.mocked(loadChannelSetupPluginRegistrySnapshotForChannel).mockReturnValue(

8086

createTestRegistry(),

8187

);

88+

registryRefreshMocks.refreshPluginRegistryAfterConfigMutation.mockClear();

8289

setActivePluginRegistry(createTestRegistry());

8390

});

8491

@@ -123,6 +130,11 @@ describe("channelsRemoveCommand", () => {

123130

expect.objectContaining({ entry: catalogEntry }),

124131

);

125132

expect(loadChannelSetupPluginRegistrySnapshotForChannel).toHaveBeenCalledTimes(2);

133+

expect(registryRefreshMocks.refreshPluginRegistryAfterConfigMutation).toHaveBeenCalledWith(

134+

expect.objectContaining({

135+

reason: "source-changed",

136+

}),

137+

);

126138

expect(configMocks.writeConfigFile).toHaveBeenCalledWith(

127139

expect.not.objectContaining({

128140

channels: expect.objectContaining({

Original file line numberDiff line numberDiff line change

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

88

readConfigFileSnapshot: vi.fn(),

99

applyPluginAutoEnable: vi.fn(),

1010

replaceConfigFile: vi.fn(),

11+

refreshPluginRegistryAfterConfigMutation: vi.fn(async () => undefined),

1112

resolveMessageChannelSelection: vi.fn(),

1213

resolveInstallableChannelPlugin: vi.fn(),

1314

getChannelPlugin: vi.fn(),

@@ -27,6 +28,10 @@ vi.mock("../config/config.js", () => ({

2728

replaceConfigFile: mocks.replaceConfigFile,

2829

}));

2930
31+

vi.mock("../cli/plugins-registry-refresh.js", () => ({

32+

refreshPluginRegistryAfterConfigMutation: mocks.refreshPluginRegistryAfterConfigMutation,

33+

}));

34+
3035

vi.mock("../config/plugin-auto-enable.js", () => ({

3136

applyPluginAutoEnable: mocks.applyPluginAutoEnable,

3237

}));

@@ -54,6 +59,7 @@ describe("channelsResolveCommand", () => {

5459

vi.clearAllMocks();

5560

mocks.loadConfig.mockReturnValue({ channels: {} });

5661

mocks.readConfigFileSnapshot.mockResolvedValue({ hash: "config-1" });

62+

mocks.refreshPluginRegistryAfterConfigMutation.mockResolvedValue(undefined);

5763

mocks.applyPluginAutoEnable.mockImplementation(({ config }) => ({ config, changes: [] }));

5864

mocks.replaceConfigFile.mockResolvedValue(undefined);

5965

mocks.resolveCommandSecretRefsViaGateway.mockResolvedValue({

@@ -88,6 +94,7 @@ describe("channelsResolveCommand", () => {

8894

cfg: installedCfg,

8995

channelId: "whatsapp",

9096

configChanged: true,

97+

pluginInstalled: true,

9198

plugin: {

9299

id: "whatsapp",

93100

resolver: { resolveTargets },

@@ -112,6 +119,12 @@ describe("channelsResolveCommand", () => {

112119

nextConfig: installedCfg,

113120

baseHash: "config-1",

114121

});

122+

expect(mocks.refreshPluginRegistryAfterConfigMutation).toHaveBeenCalledWith(

123+

expect.objectContaining({

124+

config: installedCfg,

125+

reason: "source-changed",

126+

}),

127+

);

115128

expect(resolveTargets).toHaveBeenCalledWith(

116129

expect.objectContaining({

117130

cfg: installedCfg,

Original file line numberDiff line numberDiff line change

@@ -5,6 +5,7 @@ import { moveSingleAccountChannelSectionToDefaultAccount } from "../../channels/

55

import type { ChannelSetupPlugin } from "../../channels/plugins/setup-wizard-types.js";

66

import type { ChannelPlugin } from "../../channels/plugins/types.plugin.js";

77

import type { ChannelId, ChannelSetupInput } from "../../channels/plugins/types.public.js";

8+

import { refreshPluginRegistryAfterConfigMutation } from "../../cli/plugins-registry-refresh.js";

89

import { replaceConfigFile, type OpenClawConfig } from "../../config/config.js";

910

import {

1011

PLUGIN_INSTALLS_CONFIG_PATH,

@@ -116,6 +117,7 @@ export async function channelsAddCommand(

116117

const cfg = (configSnapshot.sourceConfig ?? configSnapshot.config) as OpenClawConfig;

117118

const baseHash = configSnapshot.hash;

118119

let nextConfig = cfg;

120+

let pluginRegistrySourceChanged = false;

119121
120122

const useWizard = shouldUseWizard(params);

121123

if (useWizard) {

@@ -258,6 +260,13 @@ export async function channelsAddCommand(

258260

? { writeOptions: { unsetPaths: [Array.from(PLUGIN_INSTALLS_CONFIG_PATH)] } }

259261

: {}),

260262

});

263+

if (shouldMovePluginInstalls) {

264+

await refreshPluginRegistryAfterConfigMutation({

265+

config: writtenConfig,

266+

reason: "source-changed",

267+

logger: { warn: (message) => runtime.log(message) },

268+

});

269+

}

261270

await onboardChannels.runCollectedChannelOnboardingPostWriteHooks({

262271

hooks: postWriteHooks.drain(),

263272

cfg: writtenConfig,

@@ -320,6 +329,7 @@ export async function channelsAddCommand(

320329

if (!result.installed) {

321330

return;

322331

}

332+

pluginRegistrySourceChanged = true;

323333

catalogEntry = {

324334

...catalogEntry,

325335

...(result.pluginId ? { pluginId: result.pluginId } : {}),

@@ -401,6 +411,13 @@ export async function channelsAddCommand(

401411

? { writeOptions: { unsetPaths: [Array.from(PLUGIN_INSTALLS_CONFIG_PATH)] } }

402412

: {}),

403413

});

414+

if (shouldMovePluginInstalls || pluginRegistrySourceChanged) {

415+

await refreshPluginRegistryAfterConfigMutation({

416+

config: writtenConfig,

417+

reason: "source-changed",

418+

logger: { warn: (message) => runtime.log(message) },

419+

});

420+

}

404421

runtime.log(`Added ${plugin.meta.label ?? channelLabel(channel)} account "${accountId}".`);

405422

const afterAccountConfigWritten = plugin.setup?.afterAccountConfigWritten;

406423

if (afterAccountConfigWritten) {

Original file line numberDiff line numberDiff line change

@@ -12,6 +12,7 @@ const resolveDefaultAccountId = () => DEFAULT_ACCOUNT_ID;

1212

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

1313

readConfigFileSnapshot: vi.fn(),

1414

replaceConfigFile: vi.fn(),

15+

refreshPluginRegistryAfterConfigMutation: vi.fn(async () => undefined),

1516

resolveInstallableChannelPlugin: vi.fn(),

1617

}));

1718

@@ -37,6 +38,10 @@ vi.mock("../../config/config.js", async () => {

3738

};

3839

});

3940
41+

vi.mock("../../cli/plugins-registry-refresh.js", () => ({

42+

refreshPluginRegistryAfterConfigMutation: mocks.refreshPluginRegistryAfterConfigMutation,

43+

}));

44+
4045

vi.mock("../channel-setup/channel-plugin-resolution.js", () => ({

4146

resolveInstallableChannelPlugin: mocks.resolveInstallableChannelPlugin,

4247

}));

@@ -203,6 +208,7 @@ describe("channelsCapabilitiesCommand", () => {

203208

channelId: "whatsapp",

204209

plugin,

205210

configChanged: true,

211+

pluginInstalled: true,

206212

});

207213

vi.mocked(listChannelPlugins).mockReturnValue([]);

208214

vi.mocked(getChannelPlugin).mockReturnValue(undefined);

@@ -221,6 +227,11 @@ describe("channelsCapabilitiesCommand", () => {

221227

}),

222228

baseHash: "config-1",

223229

});

230+

expect(mocks.refreshPluginRegistryAfterConfigMutation).toHaveBeenCalledWith(

231+

expect.objectContaining({

232+

reason: "source-changed",

233+

}),

234+

);

224235

expect(logs.join("\n")).toContain("Probe: linked");

225236

});

226237

});

Original file line numberDiff line numberDiff line change

@@ -10,6 +10,7 @@ import type {

1010

ChannelCapabilitiesDisplayLine,

1111

ChannelPlugin,

1212

} from "../../channels/plugins/types.public.js";

13+

import { refreshPluginRegistryAfterConfigMutation } from "../../cli/plugins-registry-refresh.js";

1314

import {

1415

readConfigFileSnapshot,

1516

replaceConfigFile,

@@ -269,6 +270,13 @@ export async function channelsCapabilitiesCommand(

269270

? { writeOptions: { unsetPaths: [Array.from(PLUGIN_INSTALLS_CONFIG_PATH)] } }

270271

: {}),

271272

});

273+

if (shouldMovePluginInstalls || resolved.pluginInstalled) {

274+

await refreshPluginRegistryAfterConfigMutation({

275+

config: cfg,

276+

reason: "source-changed",

277+

logger: { warn: (message) => runtime.log(message) },

278+

});

279+

}

272280

}

273281

return resolved.plugin ? [resolved.plugin] : null;

274282

})();

Original file line numberDiff line numberDiff line change

@@ -4,6 +4,7 @@ import {

44

listChannelPlugins,

55

normalizeChannelId,

66

} from "../../channels/plugins/index.js";

7+

import { refreshPluginRegistryAfterConfigMutation } from "../../cli/plugins-registry-refresh.js";

78

import { replaceConfigFile, type OpenClawConfig } from "../../config/config.js";

89

import {

910

PLUGIN_INSTALLS_CONFIG_PATH,

@@ -190,6 +191,13 @@ export async function channelsRemoveCommand(

190191

? { writeOptions: { unsetPaths: [Array.from(PLUGIN_INSTALLS_CONFIG_PATH)] } }

191192

: {}),

192193

});

194+

if (shouldMovePluginInstalls || resolvedPluginState?.pluginInstalled) {

195+

await refreshPluginRegistryAfterConfigMutation({

196+

config: next,

197+

reason: "source-changed",

198+

logger: { warn: (message) => runtime.log(message) },

199+

});

200+

}

193201

if (useWizard && prompter) {

194202

await prompter.outro(

195203

deleteConfig

Original file line numberDiff line numberDiff line change

@@ -5,6 +5,7 @@ import type {

55

} from "../../channels/plugins/types.adapters.js";

66

import { resolveCommandConfigWithSecrets } from "../../cli/command-config-resolution.js";

77

import { getChannelsCommandSecretTargetIds } from "../../cli/command-secret-targets.js";

8+

import { refreshPluginRegistryAfterConfigMutation } from "../../cli/plugins-registry-refresh.js";

89

import { loadConfig, readConfigFileSnapshot, replaceConfigFile } from "../../config/config.js";

910

import { danger } from "../../globals.js";

1011

import { resolveMessageChannelSelection } from "../../infra/outbound/channel-selection.js";

@@ -158,6 +159,13 @@ export async function channelsResolveCommand(opts: ChannelsResolveOptions, runti

158159

? { writeOptions: { unsetPaths: [Array.from(PLUGIN_INSTALLS_CONFIG_PATH)] } }

159160

: {}),

160161

});

162+

if (shouldMovePluginInstalls || resolvedExplicit.pluginInstalled) {

163+

await refreshPluginRegistryAfterConfigMutation({

164+

config: cfg,

165+

reason: "source-changed",

166+

logger: { warn: (message) => runtime.log(message) },

167+

});

168+

}

161169

}

162170
163171

const selection = explicitChannel