From 94184c137dd4df06ba92f387ea9ea0e06a0a72bb Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Tue, 31 Mar 2026 08:50:58 +0900 Subject: [PATCH] fix: parse arbiter verdict with optional VERDICT: prefix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex arbiter sometimes outputs "VERDICT: PROCEED" instead of "PROCEED". The regex now handles optional "VERDICT:" prefix, preventing unknown verdict → false arbiter_escalated. --- src/paired-execution-context.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/paired-execution-context.ts b/src/paired-execution-context.ts index 5552054..27448f4 100644 --- a/src/paired-execution-context.ts +++ b/src/paired-execution-context.ts @@ -81,10 +81,13 @@ function classifyArbiterVerdict( const cleaned = summary.replace(/[\s\S]*?<\/internal>/g, '').trim(); if (!cleaned) return 'unknown'; const firstLine = cleaned.split('\n')[0].trim(); - if (/^\*{0,2}PROCEED\*{0,2}\b/i.test(firstLine)) return 'proceed'; - if (/^\*{0,2}REVISE\*{0,2}\b/i.test(firstLine)) return 'revise'; - if (/^\*{0,2}RESET\*{0,2}\b/i.test(firstLine)) return 'reset'; - if (/^\*{0,2}ESCALATE\*{0,2}\b/i.test(firstLine)) return 'escalate'; + // Match verdict keywords with optional prefix like "VERDICT:" and markdown bold + const verdictMatch = firstLine.match( + /\*{0,2}(?:VERDICT\s*[:—-]\s*)?(PROCEED|REVISE|RESET|ESCALATE)\*{0,2}/i, + ); + if (verdictMatch) { + return verdictMatch[1].toLowerCase() as ArbiterVerdictResult; + } return 'unknown'; }