feat(FN-4806): complete Step 1 — split reclaim retry failure path
Fusion-Task-Id: FN-4806 Fusion-Task-Lineage: 4192226a-b24c-4681-b0fa-ce86f40fce64
This commit is contained in:
committed by
gsxdsm
parent
4c26aa6e91
commit
087b1a7668
@@ -4057,26 +4057,43 @@ export class TaskExecutor {
|
|||||||
|
|
||||||
if (priorRequeues < MAX_TASK_DONE_REQUEUE_RETRIES) {
|
if (priorRequeues < MAX_TASK_DONE_REQUEUE_RETRIES) {
|
||||||
await this.store.updateTask(task.id, {
|
await this.store.updateTask(task.id, {
|
||||||
status: "failed",
|
sessionFile: null,
|
||||||
error: errorMessage,
|
worktree: null,
|
||||||
taskDoneRetryCount: nextRequeueCount,
|
branch: null,
|
||||||
|
baseCommitSha: null,
|
||||||
});
|
});
|
||||||
await this.store.logEntry(
|
const reclaimMessage = "Worktree/branch reclaimed mid-retry — requeued to todo (engine self-heal, no failure)";
|
||||||
task.id,
|
await this.store.logEntry(task.id, reclaimMessage, undefined, this.currentRunContext);
|
||||||
`${errorMessage} — requeued to todo immediately (${nextRequeueCount}/${MAX_TASK_DONE_REQUEUE_RETRIES})`,
|
executorLog.log(`${task.id}: ${reclaimMessage}`);
|
||||||
undefined,
|
|
||||||
this.currentRunContext,
|
|
||||||
);
|
|
||||||
await this.store.moveTask(task.id, "todo", { preserveProgress: true });
|
await this.store.moveTask(task.id, "todo", { preserveProgress: true });
|
||||||
executorLog.log(`✗ ${task.id} failed after ${MAX_TASK_DONE_SESSION_RETRIES} retries — requeued to todo (${nextRequeueCount}/${MAX_TASK_DONE_REQUEUE_RETRIES})`);
|
|
||||||
} else {
|
} else {
|
||||||
await this.store.updateTask(task.id, { status: "failed", error: errorMessage });
|
const priorRequeues = task.taskDoneRetryCount ?? 0;
|
||||||
await this.store.logEntry(task.id, `${errorMessage} — moved to in-review for inspection`, undefined, this.currentRunContext);
|
const nextRequeueCount = priorRequeues + 1;
|
||||||
await this.persistTokenUsage(task.id);
|
const errorMessage = `Agent finished without calling fn_task_done (after ${MAX_TASK_DONE_SESSION_RETRIES} retries)`;
|
||||||
await this.store.moveTask(task.id, "in-review");
|
|
||||||
executorLog.log(`✗ ${task.id} failed after ${MAX_TASK_DONE_SESSION_RETRIES} retries — no fn_task_done → in-review`);
|
if (priorRequeues < MAX_TASK_DONE_REQUEUE_RETRIES) {
|
||||||
|
await this.store.updateTask(task.id, {
|
||||||
|
status: "failed",
|
||||||
|
error: errorMessage,
|
||||||
|
taskDoneRetryCount: nextRequeueCount,
|
||||||
|
});
|
||||||
|
await this.store.logEntry(
|
||||||
|
task.id,
|
||||||
|
`${errorMessage} — requeued to todo immediately (${nextRequeueCount}/${MAX_TASK_DONE_REQUEUE_RETRIES})`,
|
||||||
|
undefined,
|
||||||
|
this.currentRunContext,
|
||||||
|
);
|
||||||
|
await this.store.moveTask(task.id, "todo", { preserveProgress: true });
|
||||||
|
executorLog.log(`✗ ${task.id} failed after ${MAX_TASK_DONE_SESSION_RETRIES} retries — requeued to todo (${nextRequeueCount}/${MAX_TASK_DONE_REQUEUE_RETRIES})`);
|
||||||
|
} else {
|
||||||
|
await this.store.updateTask(task.id, { status: "failed", error: errorMessage });
|
||||||
|
await this.store.logEntry(task.id, `${errorMessage} — moved to in-review for inspection`, undefined, this.currentRunContext);
|
||||||
|
await this.persistTokenUsage(task.id);
|
||||||
|
await this.store.moveTask(task.id, "in-review");
|
||||||
|
executorLog.log(`✗ ${task.id} failed after ${MAX_TASK_DONE_SESSION_RETRIES} retries — no fn_task_done → in-review`);
|
||||||
|
}
|
||||||
|
this.options.onError?.(task, new Error(errorMessage));
|
||||||
}
|
}
|
||||||
this.options.onError?.(task, new Error(errorMessage));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user