Skip to content

Commit a57d681

Browse files
committed
fix: keep plugin command status on cold index
1 parent 6e3eeb5 commit a57d681

7 files changed

Lines changed: 32 additions & 22 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ Docs: https://docs.openclaw.ai
7575
- Telegram: preserve exact selected quote text when sending native quote replies, and retry with legacy replies if Telegram rejects quote parameters. (#71952) Thanks @rubencu.
7676
- Plugins/CLI: preserve manifest name, description, format, and source metadata in cold `openclaw plugins list` output without importing plugin runtime. Thanks @shakkernerd.
7777
- Security/audit: read channel exposure and plugin allowlist ownership from read-only plugin index metadata so cold audits do not depend on loaded channel runtime. Thanks @shakkernerd.
78+
- Plugins/chat: keep `/plugins list`, `/plugins enable`, and `/plugins disable` on the persisted plugin index path so chat plugin management does not load diagnostic/runtime plugin registries before execution. Thanks @shakkernerd.
79+
- Plugins/doctor: read workspace plugin status and legacy web-search ownership through installed-index manifest metadata instead of broad manifest registry scans. Thanks @shakkernerd.
7880
- Logging: redact configured secret patterns at console and file-log sink exits
7981
so credentials that reach the logger are masked before terminal display or
8082
JSONL persistence. Fixes #67953. Thanks @Ziy1-Tan.

‎src/auto-reply/reply/commands-plugins.test.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { buildPluginsCommandParams } from "./commands.test-harness.js";
66
const readConfigFileSnapshotMock = vi.hoisted(() => vi.fn());
77
const validateConfigObjectWithPluginsMock = vi.hoisted(() => vi.fn());
88
const writeConfigFileMock = vi.hoisted(() => vi.fn(async () => undefined));
9-
const buildPluginSnapshotReportMock = vi.hoisted(() => vi.fn());
9+
const buildPluginRegistrySnapshotReportMock = vi.hoisted(() => vi.fn());
1010
const buildPluginDiagnosticsReportMock = vi.hoisted(() => vi.fn());
1111
const buildPluginInspectReportMock = vi.hoisted(() => vi.fn());
1212
const buildAllPluginInspectReportsMock = vi.hoisted(() => vi.fn());
@@ -69,7 +69,7 @@ vi.mock("../../plugins/status.js", () => ({
6969
buildAllPluginInspectReports: buildAllPluginInspectReportsMock,
7070
buildPluginDiagnosticsReport: buildPluginDiagnosticsReportMock,
7171
buildPluginInspectReport: buildPluginInspectReportMock,
72-
buildPluginSnapshotReport: buildPluginSnapshotReportMock,
72+
buildPluginRegistrySnapshotReport: buildPluginRegistrySnapshotReportMock,
7373
formatPluginCompatibilityNotice: formatPluginCompatibilityNoticeMock,
7474
}));
7575

@@ -121,7 +121,7 @@ describe("handlePluginsCommand", () => {
121121
config: buildCfg(),
122122
issues: [],
123123
});
124-
buildPluginSnapshotReportMock.mockReturnValue({
124+
buildPluginRegistrySnapshotReportMock.mockReturnValue({
125125
workspaceDir: "/tmp/plugins-workspace",
126126
plugins: [
127127
{
@@ -260,8 +260,8 @@ describe("handlePluginsCommand", () => {
260260
);
261261
});
262262

263-
it("resolves write targets by runtime-derived plugin name", async () => {
264-
buildPluginDiagnosticsReportMock.mockReturnValue({
263+
it("resolves write targets by indexed plugin name without loading diagnostics", async () => {
264+
buildPluginRegistrySnapshotReportMock.mockReturnValue({
265265
workspaceDir: "/tmp/plugins-workspace",
266266
plugins: [
267267
{
@@ -280,8 +280,8 @@ describe("handlePluginsCommand", () => {
280280

281281
const result = await handlePluginsCommand(params, true);
282282
expect(result?.reply?.text).toContain('Plugin "superpowers" enabled');
283-
expect(buildPluginDiagnosticsReportMock).toHaveBeenCalled();
284-
expect(buildPluginSnapshotReportMock).not.toHaveBeenCalled();
283+
expect(buildPluginRegistrySnapshotReportMock).toHaveBeenCalled();
284+
expect(buildPluginDiagnosticsReportMock).not.toHaveBeenCalled();
285285
});
286286

287287
it("returns an explicit unauthorized reply for native /plugins list", async () => {

‎src/auto-reply/reply/commands-plugins.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
buildAllPluginInspectReports,
2727
buildPluginDiagnosticsReport,
2828
buildPluginInspectReport,
29-
buildPluginSnapshotReport,
29+
buildPluginRegistrySnapshotReport,
3030
formatPluginCompatibilityNotice,
3131
type PluginStatusReport,
3232
} from "../../plugins/status.js";
@@ -308,7 +308,7 @@ async function loadPluginCommandState(
308308
report:
309309
options?.loadModules === true
310310
? buildPluginDiagnosticsReport({ config, workspaceDir })
311-
: buildPluginSnapshotReport({ config, workspaceDir }),
311+
: buildPluginRegistrySnapshotReport({ config, workspaceDir }),
312312
};
313313
}
314314

@@ -399,7 +399,7 @@ export const handlePluginsCommand: CommandHandler = async (params, allowTextComm
399399
}
400400

401401
const loaded = await loadPluginCommandState(params.workspaceDir, {
402-
loadModules: pluginsCommand.action !== "list",
402+
loadModules: pluginsCommand.action === "inspect",
403403
});
404404
if (!loaded.ok) {
405405
return {

‎src/commands/doctor-workspace-status.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const mocks = vi.hoisted(() => ({
1111
resolveAgentWorkspaceDir: vi.fn(),
1212
resolveDefaultAgentId: vi.fn(),
1313
buildWorkspaceSkillStatus: vi.fn(),
14-
buildPluginSnapshotReport: vi.fn(),
14+
buildPluginRegistrySnapshotReport: vi.fn(),
1515
buildPluginCompatibilityWarnings: vi.fn(),
1616
listTaskFlowRecords: vi.fn<() => unknown[]>(() => []),
1717
listTasksForFlowId: vi.fn<(flowId: string) => unknown[]>((_flowId: string) => []),
@@ -27,7 +27,8 @@ vi.mock("../agents/skills-status.js", () => ({
2727
}));
2828

2929
vi.mock("../plugins/status.js", () => ({
30-
buildPluginSnapshotReport: (...args: unknown[]) => mocks.buildPluginSnapshotReport(...args),
30+
buildPluginRegistrySnapshotReport: (...args: unknown[]) =>
31+
mocks.buildPluginRegistrySnapshotReport(...args),
3132
buildPluginCompatibilityWarnings: (...args: unknown[]) =>
3233
mocks.buildPluginCompatibilityWarnings(...args),
3334
}));
@@ -53,7 +54,7 @@ async function runNoteWorkspaceStatusForTest(
5354
mocks.buildWorkspaceSkillStatus.mockReturnValue({
5455
skills: [],
5556
});
56-
mocks.buildPluginSnapshotReport.mockReturnValue({
57+
mocks.buildPluginRegistrySnapshotReport.mockReturnValue({
5758
workspaceDir: "/workspace",
5859
...loadResult,
5960
});
@@ -85,7 +86,7 @@ describe("noteWorkspaceStatus", () => {
8586
}),
8687
);
8788
try {
88-
expect(mocks.buildPluginSnapshotReport).toHaveBeenCalledWith({
89+
expect(mocks.buildPluginRegistrySnapshotReport).toHaveBeenCalledWith({
8990
config: {},
9091
workspaceDir: "/workspace",
9192
});
@@ -183,7 +184,7 @@ describe("noteWorkspaceStatus", () => {
183184
"legacy-plugin still uses legacy before_agent_start",
184185
]);
185186
try {
186-
expect(mocks.buildPluginSnapshotReport).toHaveBeenCalledWith({
187+
expect(mocks.buildPluginRegistrySnapshotReport).toHaveBeenCalledWith({
187188
config: {},
188189
workspaceDir: "/workspace",
189190
});

‎src/commands/doctor-workspace-status.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agents/agent
22
import { buildWorkspaceSkillStatus } from "../agents/skills-status.js";
33
import { formatCliCommand } from "../cli/command-format.js";
44
import type { OpenClawConfig } from "../config/types.openclaw.js";
5-
import { buildPluginCompatibilityWarnings, buildPluginSnapshotReport } from "../plugins/status.js";
5+
import {
6+
buildPluginCompatibilityWarnings,
7+
buildPluginRegistrySnapshotReport,
8+
} from "../plugins/status.js";
69
import { listTasksForFlowId } from "../tasks/runtime-internal.js";
710
import { listTaskFlowRecords } from "../tasks/task-flow-runtime-internal.js";
811
import { note } from "../terminal/note.js";
@@ -69,7 +72,7 @@ export function noteWorkspaceStatus(cfg: OpenClawConfig) {
6972
"Skills status",
7073
);
7174

72-
const pluginRegistry = buildPluginSnapshotReport({
75+
const pluginRegistry = buildPluginRegistrySnapshotReport({
7376
config: cfg,
7477
workspaceDir,
7578
});

‎src/commands/doctor/shared/legacy-web-search-migrate.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { describe, expect, it, vi } from "vitest";
22
import type { OpenClawConfig } from "../../../config/config.js";
33

4-
vi.mock("../../../plugins/manifest-registry.js", () => ({
5-
loadPluginManifestRegistry: () => ({
4+
vi.mock("../../../plugins/plugin-registry.js", () => ({
5+
loadPluginManifestRegistryForPluginRegistry: () => ({
66
plugins: [
77
{
88
id: "brave",

‎src/commands/doctor/shared/legacy-web-search-migrate.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { mergeMissing } from "../../../config/legacy.shared.js";
22
import type { OpenClawConfig } from "../../../config/types.openclaw.js";
3-
import { loadPluginManifestRegistry } from "../../../plugins/manifest-registry.js";
4-
import { resolveManifestContractOwnerPluginId } from "../../../plugins/plugin-registry.js";
3+
import {
4+
loadPluginManifestRegistryForPluginRegistry,
5+
resolveManifestContractOwnerPluginId,
6+
} from "../../../plugins/plugin-registry.js";
57
import {
68
cloneRecord,
79
ensureRecord,
@@ -20,7 +22,9 @@ let legacyWebSearchProviderIdsCache: string[] | undefined;
2022
let legacyWebSearchProviderIdSetCache: Set<string> | undefined;
2123

2224
function getLegacyWebSearchProviderIds(): string[] {
23-
legacyWebSearchProviderIdsCache ??= loadPluginManifestRegistry({ cache: true })
25+
legacyWebSearchProviderIdsCache ??= loadPluginManifestRegistryForPluginRegistry({
26+
includeDisabled: true,
27+
})
2428
.plugins.filter((plugin) => plugin.origin === "bundled")
2529
.flatMap((plugin) => plugin.contracts?.webSearchProviders ?? [])
2630
.filter((providerId) => !NON_MIGRATED_LEGACY_WEB_SEARCH_PROVIDER_IDS.has(providerId))

0 commit comments

Comments
 (0)