feat(FN-4625): complete Step 4 — add self-healing worktrunk pause guardrail

Fusion-Task-Id: FN-4625
Fusion-Task-Lineage: c1d9b414-b5dd-4786-ba51-0b8adec4acf5
This commit is contained in:
Fusion (runfusion.ai)
2026-05-15 20:41:14 -07:00
committed by gsxdsm
parent 743b7a480d
commit 3339d94d42
4 changed files with 129 additions and 24 deletions

View File

@@ -25,6 +25,7 @@ const task = {
const makeStore = () => ({
updateTask: vi.fn().mockResolvedValue(undefined),
pauseTask: vi.fn().mockResolvedValue(undefined),
logEntry: vi.fn().mockResolvedValue(undefined),
});
@@ -111,7 +112,7 @@ describe("acquireTaskWorktree worktrunk wiring", () => {
).rejects.toMatchObject({ code: "worktrunk_operation_failed", operation: "create" });
expect(execMock.mock.calls.some((call) => String(call[0]).includes('"worktrunk" "switch" "--create" "fusion/fn-1"'))).toBe(true);
expect(events.some((event) => event.type === "worktree:worktrunk-fallback")).toBe(false);
expect(events.some((event) => event.type === "worktree:worktrunk-fallback-native")).toBe(false);
});
it("falls back to native when onFailure=fallback-native", async () => {
@@ -138,7 +139,7 @@ describe("acquireTaskWorktree worktrunk wiring", () => {
expect(execMock.mock.calls.some((call) => String(call[0]).includes('"worktrunk" "switch" "--create" "fusion/fn-1"'))).toBe(true);
expect(execMock.mock.calls.some((call) => String(call[0]).includes("git worktree add -b"))).toBe(true);
expect(events.filter((event) => event.type === "worktree:worktrunk-fallback")).toHaveLength(1);
expect(events.filter((event) => event.type === "worktree:worktrunk-fallback-native")).toHaveLength(1);
});
it("fails with binary missing when enabled and binaryPath absent", async () => {