mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 17:51:22 +00:00
fix: keep stop hook aligned with target session
This commit is contained in:
@@ -153,7 +153,7 @@ export const handleStopCommand: CommandHandler = async (params, allowTextCommand
|
||||
"stop",
|
||||
abortTarget.key ?? params.sessionKey ?? "",
|
||||
{
|
||||
sessionEntry: abortTarget.entry ?? params.sessionEntry,
|
||||
sessionEntry: abortTarget.entry,
|
||||
sessionId: abortTarget.sessionId,
|
||||
commandSource: params.command.surface,
|
||||
senderId: params.command.senderId,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { handleStopCommand } from "./commands-session-abort.js";
|
||||
import type { HandleCommandsParams } from "./commands-types.js";
|
||||
|
||||
const abortEmbeddedPiRunMock = vi.hoisted(() => vi.fn());
|
||||
const createInternalHookEventMock = vi.hoisted(() => vi.fn(() => ({})));
|
||||
const persistAbortTargetEntryMock = vi.hoisted(() => vi.fn(async () => true));
|
||||
const replyRunAbortMock = vi.hoisted(() => vi.fn());
|
||||
const resolveSessionIdMock = vi.hoisted(() => vi.fn(() => undefined));
|
||||
@@ -18,7 +19,7 @@ vi.mock("../../globals.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../../hooks/internal-hooks.js", () => ({
|
||||
createInternalHookEvent: vi.fn(() => ({})),
|
||||
createInternalHookEvent: createInternalHookEventMock,
|
||||
triggerInternalHook: vi.fn(async () => undefined),
|
||||
}));
|
||||
|
||||
@@ -113,5 +114,13 @@ describe("handleStopCommand target fallback", () => {
|
||||
requesterSessionKey: "agent:target:telegram:direct:123",
|
||||
}),
|
||||
);
|
||||
expect(createInternalHookEventMock).toHaveBeenCalledWith(
|
||||
"command",
|
||||
"stop",
|
||||
"agent:target:telegram:direct:123",
|
||||
expect.objectContaining({
|
||||
sessionEntry: undefined,
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user