fix: preserve handoff roles during failover

This commit is contained in:
Eyejoker
2026-04-01 02:54:35 +09:00
parent a955964522
commit 60f360b5ea
8 changed files with 235 additions and 11 deletions

View File

@@ -525,6 +525,30 @@ export function completePairedExecutionContext(args: {
: null;
if (hasNewChanges === true) {
if (task.round_trip_count >= ARBITER_DEADLOCK_THRESHOLD) {
if (isArbiterEnabled()) {
updatePairedTask(taskId, {
status: 'arbiter_requested',
arbiter_requested_at: now,
updated_at: now,
});
logger.info(
{ taskId, roundTrips: task.round_trip_count, hasNewChanges },
'Owner finalize DONE loop detected — requesting arbiter',
);
} else {
updatePairedTask(taskId, {
status: 'completed',
completion_reason: 'escalated',
updated_at: now,
});
logger.info(
{ taskId, roundTrips: task.round_trip_count, hasNewChanges },
'Owner finalize DONE loop detected — escalating to user',
);
}
return;
}
// Owner made changes after approval → needs re-review
logger.info(
{