fix(paired): bound arbiter interventions to stop infinite arbiter loop

The owner↔reviewer↔arbiter loop could repeat forever: when the arbiter
ruled PROCEED/REVISE/RESET it reset round_trip_count to 0, and nothing
tracked how many times the arbiter had already intervened. A re-deadlock
re-invoked the arbiter without bound.

Add a persistent arbiter_intervention_count (new column + migration 020)
that survives the round-trip reset, and a configurable cap
ARBITER_MAX_INTERVENTIONS (default 1). Once the arbiter has intervened
that many times and the loop still deadlocks, requestArbiterOrEscalate
escalates straight to the user instead of re-invoking the arbiter.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-06-09 02:15:21 +09:00
parent 5f06673ac6
commit de54f13469
15 changed files with 197 additions and 5 deletions

View File

@@ -95,6 +95,14 @@ export const AGENT_LANGUAGE = CONFIG.paired.agentLanguage;
export const ARBITER_DEADLOCK_THRESHOLD =
CONFIG.paired.arbiterDeadlockThreshold;
/**
* Maximum number of times the arbiter may intervene on a single task before the
* task is escalated to the user instead of re-invoking the arbiter. This bounds
* the owner↔reviewer↔arbiter loop: once the arbiter has ruled this many times
* and the loop still deadlocks, a human is asked to step in.
*/
export const ARBITER_MAX_INTERVENTIONS = CONFIG.paired.arbiterMaxInterventions;
export function isArbiterEnabled(): boolean {
return ARBITER_AGENT_TYPE !== undefined;
}