feat(FN-4946): complete steps 5-8 implicit refusal docs and budget coverage

Fusion-Task-Id: FN-4946
Fusion-Task-Lineage: 9a48f72f-d2cc-4950-8a00-f69053dd1163
This commit is contained in:
Fusion (runfusion.ai)
2026-05-17 21:39:09 -07:00
committed by gsxdsm
parent c1a01fbb8a
commit 28595f57e9
3 changed files with 21 additions and 2 deletions

View File

@@ -77,10 +77,23 @@ describe("FN-4946 implicit refusal budget handling", () => {
const executor = new TaskExecutor(store as any, "/repo");
await executor.execute(currentTask);
// Burn explicit-path refusal budget from 2 -> 3 (still todo), then implicit refusal should escalate immediately.
await doneTool.execute("d1", { summary: "I am not done yet." });
await (executor as any).handleImplicitTaskDoneRefusal({ ...currentTask, id: "FN-4946-B2" }, "/repo/.worktrees/swift-falcon", refusal());
expect(currentTask.taskDoneRetryCount).toBe(3);
expect(store.moveTask).toHaveBeenCalledWith("FN-4946-B2", "in-review");
await (executor as any).handleImplicitTaskDoneRefusal(
{ ...currentTask, id: "FN-4946-B2", column: "todo" },
"/repo/.worktrees/swift-falcon",
refusal(),
);
const inReviewMoves = store.moveTask.mock.calls.filter((call: any[]) => call[0] === "FN-4946-B2" && call[1] === "in-review");
expect(inReviewMoves.length).toBeGreaterThanOrEqual(1);
const implicitEscalationUpdate = store.updateTask.mock.calls.find(
([id, patch]: [string, Record<string, unknown>]) =>
id === "FN-4946-B2" && patch.status === "failed" && !("taskDoneRetryCount" in patch),
);
expect(implicitEscalationUpdate).toBeTruthy();
});
it("resets taskDoneRetryCount after later clean completion", async () => {