mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:00:42 +00:00
fix(channels): avoid bundled plugin load paths
This commit is contained in:
@@ -19,6 +19,7 @@ Docs: https://docs.openclaw.ai
|
||||
|
||||
### Fixes
|
||||
|
||||
- Channels/setup: treat bundled channel plugins as already bundled during `channels add` and onboarding, enabling them without writing redundant `plugins.load.paths` entries or path install records. Fixes #72740. Thanks @iCodePoet.
|
||||
- Git hooks: skip ignored staged paths when formatting and restaging pre-commit files, so merge commits no longer abort when `.gitignore` newly ignores staged merged content. Fixes #72744. Thanks @100yenadmin.
|
||||
- Memory-core/dreaming: add a supported `dreaming.model` knob for Dream Diary narrative subagents, wired through phase config and the existing plugin subagent model-override trust gate. Refs #65963. Thanks @esqandil and @mjamiv.
|
||||
- Memory-core/dreaming: treat request-scoped narrative fallback as expected, skip session cleanup when no subagent run was created, and remove duplicate phase-level cleanup so fallback no longer emits warning noise. Fixes #67152. Thanks @jsompis.
|
||||
|
||||
@@ -446,9 +446,9 @@ describe("ensureChannelSetupPluginInstalled", () => {
|
||||
|
||||
expect(select).not.toHaveBeenCalled();
|
||||
expect(result.installed).toBe(true);
|
||||
expect(result.cfg.plugins?.load?.paths).toContain(
|
||||
bundledPluginRootAt("/opt/openclaw", "bundled-chat"),
|
||||
);
|
||||
expect(result.cfg.plugins?.entries?.["bundled-chat"]?.enabled).toBe(true);
|
||||
expect(result.cfg.plugins?.load?.paths).toBeUndefined();
|
||||
expect(result.cfg.plugins?.installs).toBeUndefined();
|
||||
});
|
||||
|
||||
it("does not default to bundled local path when an external catalog overrides the npm spec", async () => {
|
||||
|
||||
@@ -5,7 +5,9 @@ import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import type { PluginEnableResult } from "../plugins/enable.js";
|
||||
import { withTempDir } from "../test-helpers/temp-dir.js";
|
||||
|
||||
const resolveBundledInstallPlanForCatalogEntry = vi.hoisted(() => vi.fn(() => undefined));
|
||||
const resolveBundledInstallPlanForCatalogEntry = vi.hoisted(() =>
|
||||
vi.fn<(...args: unknown[]) => unknown>(() => undefined),
|
||||
);
|
||||
vi.mock("../cli/plugin-install-plan.js", () => ({
|
||||
resolveBundledInstallPlanForCatalogEntry,
|
||||
}));
|
||||
@@ -479,6 +481,51 @@ describe("ensureOnboardingPluginInstalled", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("enables bundled plugins without adding their bundled directory as a local install", async () => {
|
||||
await withTempDir({ prefix: "openclaw-onboarding-install-bundled-record-" }, async (temp) => {
|
||||
const bundledDir = path.join(temp, "dist", "extensions", "discord");
|
||||
await fs.mkdir(bundledDir, { recursive: true });
|
||||
const realBundledDir = await fs.realpath(bundledDir);
|
||||
resolveBundledInstallPlanForCatalogEntry.mockReturnValueOnce({
|
||||
bundledSource: {
|
||||
localPath: realBundledDir,
|
||||
},
|
||||
});
|
||||
enablePluginInConfig.mockReturnValueOnce({
|
||||
config: {
|
||||
plugins: {
|
||||
entries: {
|
||||
discord: { enabled: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
enabled: true,
|
||||
});
|
||||
|
||||
const result = await ensureOnboardingPluginInstalled({
|
||||
cfg: {},
|
||||
entry: {
|
||||
pluginId: "discord",
|
||||
label: "Discord",
|
||||
install: {
|
||||
npmSpec: "@openclaw/discord",
|
||||
},
|
||||
},
|
||||
prompter: {
|
||||
select: vi.fn(async () => "local"),
|
||||
} as never,
|
||||
runtime: {} as never,
|
||||
promptInstall: false,
|
||||
});
|
||||
|
||||
expect(result.installed).toBe(true);
|
||||
expect(result.cfg.plugins?.entries?.discord?.enabled).toBe(true);
|
||||
expect(result.cfg.plugins?.load?.paths).toBeUndefined();
|
||||
expect(result.cfg.plugins?.installs).toBeUndefined();
|
||||
expect(recordPluginInstall).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("records local install source metadata when npm install falls back to local", async () => {
|
||||
await withTempDir(
|
||||
{ prefix: "openclaw-onboarding-install-npm-fallback-record-" },
|
||||
|
||||
@@ -116,6 +116,18 @@ function addPluginLoadPath(cfg: OpenClawConfig, pluginPath: string): OpenClawCon
|
||||
};
|
||||
}
|
||||
|
||||
function pathsReferToSameDirectory(
|
||||
left: string | null | undefined,
|
||||
right: string | null | undefined,
|
||||
): boolean {
|
||||
if (!left || !right) {
|
||||
return false;
|
||||
}
|
||||
const realLeft = resolveRealDirectory(left);
|
||||
const realRight = resolveRealDirectory(right);
|
||||
return Boolean(realLeft && realRight && realLeft === realRight);
|
||||
}
|
||||
|
||||
function formatPortableLocalPath(localPath: string, workspaceDir?: string): string | undefined {
|
||||
const bases = [workspaceDir, process.cwd()].filter((entry): entry is string => Boolean(entry));
|
||||
for (const base of bases) {
|
||||
@@ -478,6 +490,14 @@ export async function ensureOnboardingPluginInstalled(params: {
|
||||
status: "failed",
|
||||
};
|
||||
}
|
||||
if (pathsReferToSameDirectory(localPath, bundledLocalPath)) {
|
||||
return {
|
||||
cfg: enableResult.config,
|
||||
installed: true,
|
||||
pluginId: entry.pluginId,
|
||||
status: "installed",
|
||||
};
|
||||
}
|
||||
next = addPluginLoadPath(enableResult.config, localPath);
|
||||
next = await recordLocalPluginInstall({ cfg: next, entry, localPath, npmSpec, workspaceDir });
|
||||
return {
|
||||
@@ -595,6 +615,14 @@ export async function ensureOnboardingPluginInstalled(params: {
|
||||
status: "failed",
|
||||
};
|
||||
}
|
||||
if (pathsReferToSameDirectory(localPath, bundledLocalPath)) {
|
||||
return {
|
||||
cfg: enableResult.config,
|
||||
installed: true,
|
||||
pluginId: entry.pluginId,
|
||||
status: "installed",
|
||||
};
|
||||
}
|
||||
next = addPluginLoadPath(enableResult.config, localPath);
|
||||
next = await recordLocalPluginInstall({ cfg: next, entry, localPath, npmSpec, workspaceDir });
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user