fix: keep stop hook aligned with target session

This commit is contained in:
Tak Hoffman
2026-04-10 20:59:19 -05:00
parent 07edaffb04
commit 78a4b0e8d3
2 changed files with 11 additions and 2 deletions

View File

@@ -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,

View File

@@ -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,
}),
);
});
});