fix(memory-wiki): pass app config into CLI metadata registrar (#65012)

* fix(memory-wiki): pass config into cli metadata registrar

* fix(memory-wiki): use cli context config for metadata registrar

* docs(changelog): note memory-wiki cli metadata fix

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
Leonard Sellem
2026-04-12 18:30:54 +02:00
committed by GitHub
parent 7518b8d339
commit c545e4605e
3 changed files with 82 additions and 3 deletions

View File

@@ -28,6 +28,7 @@ Docs: https://docs.openclaw.ai
- Gateway/cron: preserve requested isolated-agent config across runtime reloads so subagent jobs and heartbeat overrides keep the right workspace and heartbeat settings when the hot-loaded snapshot is stale. Thanks @l0cka and @vincentkoc.
- Gateway/plugins: always send a non-empty `idempotencyKey` for plugin subagent runs, so dreaming narrative jobs stop failing gateway schema validation. (#65354) Thanks @CodeForgeNet and @vincentkoc.
- Cron/isolated sessions: persist the right transcript path for each isolated run, including fresh session rollovers, so cron runs stop appending to stale session files. Thanks @samrusani and @vincentkoc.
- CLI/memory-wiki: pass the active app config into the metadata registrar so built `openclaw wiki` commands resolve the live wiki plugin config instead of silently falling back to defaults. (#65012) Thanks @leonardsellem and @vincentkoc.
- Dreaming/cron: wake managed dreaming jobs immediately instead of waiting for the next heartbeat, so scheduled dreaming runs start when the cron fires. (#65053) Thanks @l0cka and @vincentkoc.
- QA/packaging: stop packaged QA helpers from crashing when optional scenario execution config is unavailable, so npm distributions can skip the repo-only scenario pack without breaking completion-cache and startup paths. (#65118) Thanks @EdderTalmor and @vincentkoc.
- Media/audio transcription: surface the real provider failure when every audio transcription attempt fails, so status output and the CLI stop collapsing those errors into generic skips. (#65096) Thanks @l0cka and @vincentkoc.

View File

@@ -0,0 +1,74 @@
import { Command } from "commander";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { createTestPluginApi } from "../../test/helpers/plugins/plugin-api.js";
const mocks = vi.hoisted(() => ({
loadConfig: vi.fn(() => {
throw new Error("loadConfig should not be called during CLI metadata registration");
}),
registerWikiCli: vi.fn(),
resolveMemoryWikiConfig: vi.fn(),
}));
vi.mock("../../src/config/config.js", () => ({
loadConfig: mocks.loadConfig,
}));
vi.mock("./src/cli.js", () => ({
registerWikiCli: mocks.registerWikiCli,
}));
vi.mock("./src/config.js", () => ({
resolveMemoryWikiConfig: mocks.resolveMemoryWikiConfig,
}));
import plugin from "./cli-metadata.js";
describe("memory-wiki cli metadata entry", () => {
beforeEach(() => {
vi.clearAllMocks();
});
it("uses the registrar context config instead of reloading global config", async () => {
const registerCli = vi.fn();
const api = createTestPluginApi({
id: "memory-wiki",
name: "Memory Wiki",
registerCli,
});
const program = new Command();
const appConfig = {
plugins: {
entries: {
"memory-wiki": {
config: {
vaultMode: "bridge",
},
},
},
},
};
const resolvedConfig = { vaultMode: "bridge", vault: { path: "/vault" } };
mocks.resolveMemoryWikiConfig.mockReturnValue(resolvedConfig);
plugin.register(api);
const register = registerCli.mock.calls[0]?.[0];
expect(registerCli).toHaveBeenCalledTimes(1);
expect(typeof register).toBe("function");
await register({
program,
config: appConfig,
workspaceDir: "/tmp/openclaw",
logger: api.logger,
});
expect(mocks.loadConfig).not.toHaveBeenCalled();
expect(mocks.resolveMemoryWikiConfig).toHaveBeenCalledWith(
appConfig.plugins.entries["memory-wiki"].config,
);
expect(mocks.registerWikiCli).toHaveBeenCalledWith(program, resolvedConfig, appConfig);
});
});

View File

@@ -6,9 +6,13 @@ export default definePluginEntry({
description: "Persistent wiki compiler and Obsidian-friendly knowledge vault for OpenClaw.",
register(api) {
api.registerCli(
async ({ program }) => {
const { registerWikiCli } = await import("./src/cli.js");
registerWikiCli(program);
async ({ program, config: appConfig }) => {
const [{ registerWikiCli }, { resolveMemoryWikiConfig }] = await Promise.all([
import("./src/cli.js"),
import("./src/config.js"),
]);
const pluginConfig = appConfig.plugins?.entries?.["memory-wiki"]?.config;
registerWikiCli(program, resolveMemoryWikiConfig(pluginConfig), appConfig);
},
{
descriptors: [