fix(FN-4946): align implicit refusal helper signature and tests
Fusion-Task-Id: FN-4946 Fusion-Task-Lineage: 9a48f72f-d2cc-4950-8a00-f69053dd1163
This commit is contained in:
committed by
gsxdsm
parent
28595f57e9
commit
58fe3652dc
@@ -40,7 +40,7 @@ describe("FN-4946 implicit refusal budget handling", () => {
|
||||
const store = createMockStore();
|
||||
const executor = new TaskExecutor(store as any, "/repo");
|
||||
|
||||
await (executor as any).handleImplicitTaskDoneRefusal(task(2), "/repo/.worktrees/swift-falcon", refusal());
|
||||
await (executor as any).handleImplicitTaskDoneRefusal(task(2), refusal());
|
||||
|
||||
expect(store.updateTask).toHaveBeenCalledWith("FN-4946-B", expect.objectContaining({ taskDoneRetryCount: 3, status: "failed" }));
|
||||
expect(store.moveTask).toHaveBeenCalledWith("FN-4946-B", "todo", { preserveProgress: true });
|
||||
@@ -52,7 +52,7 @@ describe("FN-4946 implicit refusal budget handling", () => {
|
||||
const executor = new TaskExecutor(store as any, "/repo");
|
||||
const persistSpy = vi.spyOn(executor as any, "persistTokenUsage").mockResolvedValue(undefined);
|
||||
|
||||
await (executor as any).handleImplicitTaskDoneRefusal(task(3), "/repo/.worktrees/swift-falcon", refusal());
|
||||
await (executor as any).handleImplicitTaskDoneRefusal(task(3), refusal());
|
||||
|
||||
expect(store.updateTask).toHaveBeenCalledWith("FN-4946-B", expect.objectContaining({ status: "failed" }));
|
||||
expect(store.moveTask).toHaveBeenCalledWith("FN-4946-B", "in-review");
|
||||
@@ -83,7 +83,6 @@ describe("FN-4946 implicit refusal budget handling", () => {
|
||||
|
||||
await (executor as any).handleImplicitTaskDoneRefusal(
|
||||
{ ...currentTask, id: "FN-4946-B2", column: "todo" },
|
||||
"/repo/.worktrees/swift-falcon",
|
||||
refusal(),
|
||||
);
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ describe("FN-4946 implicit completion + REVISE verdict interaction", () => {
|
||||
const store = createMockStore();
|
||||
const executor = new TaskExecutor(store as any, "/repo");
|
||||
|
||||
await (executor as any).handleImplicitTaskDoneRefusal(makeTask({ id: "FN-4946-R1" }), "/repo/.worktrees/swift-falcon", refusal());
|
||||
await (executor as any).handleImplicitTaskDoneRefusal(makeTask({ id: "FN-4946-R1" }), refusal());
|
||||
|
||||
expect(store.updateTask).toHaveBeenCalledWith("FN-4946-R1", expect.objectContaining({ taskDoneRetryCount: 1, status: "failed" }));
|
||||
expect(store.moveTask).toHaveBeenCalledWith("FN-4946-R1", "todo", { preserveProgress: true });
|
||||
@@ -73,7 +73,7 @@ describe("FN-4946 implicit completion + REVISE verdict interaction", () => {
|
||||
const store = createMockStore();
|
||||
const executor = new TaskExecutor(store as any, "/repo");
|
||||
|
||||
await (executor as any).handleImplicitTaskDoneRefusal(makeTask({ id: "FN-4946-R2" }), "/repo/.worktrees/swift-falcon", refusal());
|
||||
await (executor as any).handleImplicitTaskDoneRefusal(makeTask({ id: "FN-4946-R2" }), refusal());
|
||||
|
||||
const retryCountUpdates = store.updateTask.mock.calls.filter(
|
||||
([id, patch]: [string, Record<string, unknown>]) => id === "FN-4946-R2" && "taskDoneRetryCount" in patch,
|
||||
|
||||
@@ -3976,7 +3976,7 @@ export class TaskExecutor {
|
||||
// Implicit path has no summary; evaluateTaskDoneRefusal will skip summary-claims-incomplete and only enforce pending-code-review-revise / bulk-step-completion-without-review.
|
||||
const refusal = evaluateTaskDoneRefusal(implicitCheck, {}, codeReviewVerdicts);
|
||||
if (!refusal.ok) {
|
||||
await this.handleImplicitTaskDoneRefusal(implicitCheck, worktreePath, refusal);
|
||||
await this.handleImplicitTaskDoneRefusal(implicitCheck, refusal);
|
||||
return;
|
||||
}
|
||||
taskDone = true;
|
||||
@@ -4210,7 +4210,7 @@ export class TaskExecutor {
|
||||
// Implicit path has no summary; evaluateTaskDoneRefusal will skip summary-claims-incomplete and only enforce pending-code-review-revise / bulk-step-completion-without-review.
|
||||
const refusal = evaluateTaskDoneRefusal(implicitCheck, {}, codeReviewVerdicts);
|
||||
if (!refusal.ok) {
|
||||
await this.handleImplicitTaskDoneRefusal(implicitCheck, worktreePath, refusal);
|
||||
await this.handleImplicitTaskDoneRefusal(implicitCheck, refusal);
|
||||
retrySession?.dispose();
|
||||
retrySession = null;
|
||||
retryAbortedDueToReclaim = false;
|
||||
@@ -5482,10 +5482,8 @@ export class TaskExecutor {
|
||||
|
||||
private async handleImplicitTaskDoneRefusal(
|
||||
task: Task,
|
||||
worktreePath: string,
|
||||
refusal: Extract<ReturnType<typeof evaluateTaskDoneRefusal>, { ok: false }>,
|
||||
): Promise<void> {
|
||||
void worktreePath;
|
||||
|
||||
await this.store.logEntry(task.id, refusal.message, undefined, this.currentRunContext);
|
||||
executorLog.error(`${task.id}: fn_task_done refused (${refusal.refusalClass}) — ${refusal.reason} (implicit completion)`);
|
||||
|
||||
Reference in New Issue
Block a user