fix: reset task to active on failed execution to prevent stuck state

This commit is contained in:
Eyejoker
2026-03-29 19:17:19 +09:00
parent fcb854e9de
commit 4ec7b55105

View File

@@ -223,11 +223,22 @@ export function completePairedExecutionContext(args: {
'Paired execution completed',
);
if (status !== 'succeeded') return;
const task = getPairedTaskById(taskId);
if (!task) return;
// On failure, reset task to active so the flow isn't stuck
if (status !== 'succeeded') {
if (task.status !== 'active') {
const now = new Date().toISOString();
updatePairedTask(taskId, { status: 'active', updated_at: now });
logger.info(
{ taskId, role, previousStatus: task.status },
'Reset task to active after failed execution',
);
}
return;
}
// Owner finished → auto-trigger reviewer (if within round trip limit)
if (role === 'owner') {
if (task.round_trip_count >= PAIRED_MAX_ROUND_TRIPS) {