feat: implement MAGI 3-agent arbiter system for deadlock resolution
Introduces a third agent role (arbiter) that is summoned on-demand when owner and reviewer reach a deadlock (same verdict 3+ rounds). Architecture: - 3 Discord bots: owner (codex), reviewer (claude), arbiter (claude/codex) - Arbiter is NOT always-on — only invoked when deadlock detected - Arbiter renders binding verdict: PROCEED/REVISE/RESET/ESCALATE - Non-escalate verdicts reset round_trip_count and resume ping-pong - Backward compatible: ARBITER_AGENT_TYPE unset = existing 2-agent mode Changes across 13 source files + 7 test files: - types.ts: PairedRoomRole += 'arbiter', new statuses, ArbiterVerdict type - config.ts: ARBITER_AGENT_TYPE, ARBITER_SERVICE_ID, ARBITER_DEADLOCK_THRESHOLD - db.ts: schema migration (arbiter columns in channel_owner + paired_tasks) - service-routing.ts: arbiter_service_id in lease - room-role-context.ts: arbiter role detection - paired-execution-context.ts: deadlock->arbiter, verdict handling - message-runtime.ts: arbiter turn routing, cursor, sender labeling - message-agent-executor.ts: arbiter mode, failover - agent-runner.ts + environment.ts: arbiter container mode - platform-prompts.ts: arbiter prompt loading New files: - prompts/arbiter-paired-room.md: arbiter system prompt - src/arbiter-context.ts: builds conversation context for arbiter judgment
This commit is contained in:
11
src/types.ts
11
src/types.ts
@@ -23,14 +23,18 @@ export type VisiblePhase = 'silent' | 'progress' | 'final';
|
||||
|
||||
export type AgentVisibility = 'public' | 'silent';
|
||||
|
||||
export type PairedRoomRole = 'owner' | 'reviewer';
|
||||
export type PairedRoomRole = 'owner' | 'reviewer' | 'arbiter';
|
||||
|
||||
export type PairedTaskStatus =
|
||||
| 'active'
|
||||
| 'review_ready'
|
||||
| 'in_review'
|
||||
| 'merge_ready'
|
||||
| 'completed';
|
||||
| 'completed'
|
||||
| 'arbiter_requested'
|
||||
| 'in_arbitration';
|
||||
|
||||
export type ArbiterVerdict = 'proceed' | 'revise' | 'reset' | 'escalate';
|
||||
|
||||
export type PairedWorkspaceRole = 'owner' | 'reviewer';
|
||||
|
||||
@@ -42,6 +46,7 @@ export interface RoomRoleContext {
|
||||
ownerServiceId: string;
|
||||
reviewerServiceId: string;
|
||||
failoverOwner: boolean;
|
||||
arbiterServiceId?: string;
|
||||
}
|
||||
|
||||
export interface PairedProject {
|
||||
@@ -64,6 +69,8 @@ export interface PairedTask {
|
||||
review_requested_at: string | null;
|
||||
round_trip_count: number;
|
||||
status: PairedTaskStatus;
|
||||
arbiter_verdict: string | null;
|
||||
arbiter_requested_at: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user