fix(FN-874): recover stuck-killed tasks reliably

This commit is contained in:
gsxdsm
2026-04-04 09:45:45 -07:00
parent cbc87a43ca
commit 866b97a1c2
4 changed files with 81 additions and 13 deletions

View File

@@ -4563,6 +4563,41 @@ describe("TaskExecutor bounded recovery retries", () => {
}));
});
it("exits cleanly when a stuck-killed session resolves without throwing", async () => {
const store = createMockStore();
const executor = new TaskExecutor(store, "/tmp/test", {});
mockedCreateHaiAgent.mockImplementation(async () => ({
session: {
prompt: vi.fn(async () => {
executor.markStuckAborted("FN-001");
}),
dispose: vi.fn(),
state: {},
},
}) as any);
await executor.execute({
id: "FN-001",
title: "Test",
description: "Test",
column: "in-progress",
dependencies: [],
steps: [],
currentStep: 0,
log: [],
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
});
expect(mockedCreateHaiAgent).toHaveBeenCalledTimes(1);
expect(store.updateTask).not.toHaveBeenCalledWith(
"FN-001",
expect.objectContaining({ status: "failed" }),
);
expect(store.moveTask).not.toHaveBeenCalledWith("FN-001", "in-review");
});
it("clears recovery metadata after successful run completes", async () => {
const store = createMockStore();