From 4ec7b551054a782b86485a06bb5e78493f34d192 Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Sun, 29 Mar 2026 19:17:19 +0900 Subject: [PATCH] fix: reset task to active on failed execution to prevent stuck state --- src/paired-execution-context.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/paired-execution-context.ts b/src/paired-execution-context.ts index 3a73b72..25aa214 100644 --- a/src/paired-execution-context.ts +++ b/src/paired-execution-context.ts @@ -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) {