fix: harden paired runtime turn coordination

This commit is contained in:
ejclaw
2026-04-09 13:52:42 +09:00
parent e7a7b538b2
commit 0f994ab2ce
27 changed files with 2108 additions and 295 deletions

View File

@@ -21,6 +21,7 @@ export function handleFailedArbiterExecution(args: {
taskId,
currentStatus: task.status,
nextStatus: fallbackStatus,
expectedUpdatedAt: task.updated_at,
updatedAt: now,
});
logger.warn(
@@ -36,10 +37,11 @@ export function handleFailedArbiterExecution(args: {
}
export function handleArbiterCompletion(args: {
task: PairedTask;
taskId: string;
summary?: string | null;
}): void {
const { taskId, summary } = args;
const { task, taskId, summary } = args;
const now = new Date().toISOString();
const arbiterVerdict = classifyArbiterVerdict(summary);
@@ -56,6 +58,7 @@ export function handleArbiterCompletion(args: {
taskId,
currentStatus: 'in_arbitration',
nextStatus: 'active',
expectedUpdatedAt: task.updated_at,
updatedAt: now,
patch: {
round_trip_count: Math.max(0, ARBITER_DEADLOCK_THRESHOLD - 1),
@@ -72,6 +75,7 @@ export function handleArbiterCompletion(args: {
taskId,
currentStatus: 'in_arbitration',
nextStatus: 'completed',
expectedUpdatedAt: task.updated_at,
updatedAt: now,
patch: {
arbiter_verdict: 'escalate',
@@ -85,6 +89,7 @@ export function handleArbiterCompletion(args: {
taskId,
currentStatus: 'in_arbitration',
nextStatus: 'active',
expectedUpdatedAt: task.updated_at,
updatedAt: now,
patch: {
round_trip_count: Math.max(0, ARBITER_DEADLOCK_THRESHOLD - 1),