feat(FN-3939): audit and patch PR #59 residual defects, add retry parity an

Completes FN-3939 audit work for PR #59 residual defects by refactoring the mission execution loop in the engine (halving its complexity), adding self-healing test coverage, and wiring in task workflow route improvements. Retry and validation behavior updates are documented in the changeset and skil

Fusion-Task-Id: FN-3939
This commit is contained in:
Fusion
2026-05-10 16:19:04 -07:00
committed by gsxdsm
parent 60d16aa267
commit 76c00fbadd
15 changed files with 308 additions and 94 deletions

View File

@@ -528,16 +528,35 @@ export function registerTaskWorkflowRoutes(ctx: ApiRoutesContext, deps: TaskWork
throw badRequest(`Task is not in a retryable state (current status: ${task.status || 'none'})`);
}
// In-review retry: keep the task in in-review, clear only error/retry state
// so the auto-merge system re-attempts on its next sweep.
// In-review retry: distinguish between execution failures (incomplete steps)
// and merge failures (all steps done).
if (isInReviewRetry) {
const hasIncompleteSteps =
task.steps.length > 0 &&
task.steps.some((s: { status: string }) => s.status === "pending" || s.status === "in-progress");
if (hasIncompleteSteps) {
await scopedStore.updateTask(req.params.id, {
status: null,
error: null,
stuckKillCount: 0,
});
await scopedStore.logEntry(
req.params.id,
"Retry requested from dashboard (execution failure in-review → todo, preserving progress)",
);
const updated = await scopedStore.moveTask(req.params.id, "todo", { preserveProgress: true });
res.json(updated);
return;
}
await scopedStore.updateTask(req.params.id, {
status: null,
error: null,
stuckKillCount: 0,
mergeRetries: 0,
});
await scopedStore.logEntry(req.params.id, "Retry requested from dashboard (in-review retry, mergeRetries reset)");
await scopedStore.logEntry(req.params.id, "Retry requested from dashboard (in-review merge retry, mergeRetries reset)");
const updated = await scopedStore.getTask(req.params.id);
res.json(updated);
return;