fix: break DONE_WITH_CONCERNS echo loop after 3 round trips

When both owner and reviewer keep echoing DONE_WITH_CONCERNS without
making progress, the system now stops the ping-pong after 3 round
trips and sets the task to completed, escalating to the user.
This commit is contained in:
Eyejoker
2026-03-30 21:00:31 +09:00
parent 196c885c9e
commit 27bf36c833

View File

@@ -484,6 +484,16 @@ export function completePairedExecutionContext(args: {
case 'done_with_concerns':
case 'continue':
default:
// If both sides keep echoing DONE_WITH_CONCERNS without progress,
// stop the loop after 3 round trips to prevent infinite ping-pong.
if (task.round_trip_count >= 3) {
updatePairedTask(taskId, { status: 'completed', updated_at: now });
logger.info(
{ taskId, verdict, roundTrips: task.round_trip_count },
'Stopped ping-pong after repeated DONE_WITH_CONCERNS — escalating to user',
);
break;
}
// Owner needs to address feedback — ping-pong continues
updatePairedTask(taskId, { status: 'active', updated_at: now });
logger.info(