mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-14 16:10:48 +00:00
[codex] Fix message CLI plugin preload failure exit (#76846)
Summary: - The branch moves configured-channel plugin registry loading for `openclaw message` into `runCommandWithRuntime`, adds regression coverage for preload failure exit handling, and adds a changelog fix entry for #76168. - Reproducibility: yes. for the exit-path bug: current main calls plugin registry preload before `runCommandWi ... the high-CPU child process in this read-only review, but the missing exit boundary is source-reproducible. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head95b67ea9ba. - Required merge gates passed before the squash merge. Prepared head SHA:95b67ea9baReview: https://github.com/openclaw/openclaw/pull/76846#issuecomment-4366747104 Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
committed by
GitHub
parent
ec73e9985c
commit
11a08e3ef0
@@ -136,6 +136,20 @@ describe("runMessageAction", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("exits with failure when plugin registry loading fails before dispatch", async () => {
|
||||
vi.mocked(ensurePluginRegistryLoaded).mockImplementationOnce(() => {
|
||||
throw new Error("plugin load failed");
|
||||
});
|
||||
|
||||
await runSendAction();
|
||||
|
||||
expect(messageCommandMock).not.toHaveBeenCalled();
|
||||
expect(errorMock).toHaveBeenCalledWith("Error: plugin load failed");
|
||||
expect(exitMock).toHaveBeenCalledOnce();
|
||||
expect(exitMock).toHaveBeenCalledWith(1);
|
||||
expect(exitMock).not.toHaveBeenCalledWith(0);
|
||||
});
|
||||
|
||||
it("runs gateway_stop hooks before exit when registered", async () => {
|
||||
hasHooksMock.mockReturnValueOnce(true);
|
||||
await runSendAction();
|
||||
|
||||
@@ -82,12 +82,12 @@ export function createMessageCliHelpers(
|
||||
|
||||
const runMessageAction = async (action: string, opts: Record<string, unknown>) => {
|
||||
setVerbose(Boolean(opts.verbose));
|
||||
ensurePluginRegistryLoaded(resolveMessagePluginLoadOptions(opts));
|
||||
const deps = createDefaultDeps();
|
||||
let failed = false;
|
||||
await runCommandWithRuntime(
|
||||
defaultRuntime,
|
||||
async () => {
|
||||
ensurePluginRegistryLoaded(resolveMessagePluginLoadOptions(opts));
|
||||
const deps = createDefaultDeps();
|
||||
await messageCommand(
|
||||
{
|
||||
...normalizeMessageOptions(opts),
|
||||
|
||||
Reference in New Issue
Block a user