fix: send NEEDS_CONTEXT straight to the user instead of the arbiter

A NEEDS_CONTEXT from the owner or reviewer is a question only the user can
answer, and the arbiter's own rules say to ESCALATE it. Routing it through the
arbiter added a full turn first (13 of 23 arbiter calls in 30 days). Escalate
directly; BLOCKED and deadlocks still go to the arbiter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-10-01 18:32:08 +09:00
parent 3fcb4efa43
commit de2de33c3e
3 changed files with 77 additions and 0 deletions

View File

@@ -240,6 +240,7 @@ function handleOwnerFinalizeCompletion(args: {
expectedUpdatedAt: task.updated_at,
now,
arbiterInterventionCount: task.arbiter_intervention_count ?? 0,
maxArbiterInterventions: ownerVerdict === 'needs_context' ? 0 : undefined,
arbiterLogMessage,
escalateLogMessage,
logContext: {
@@ -470,6 +471,9 @@ export function handleOwnerCompletion(args: {
expectedUpdatedAt: task.updated_at,
now,
arbiterInterventionCount: task.arbiter_intervention_count ?? 0,
// A question for the user can only be answered by the user; routing it
// through the arbiter just added a turn that ESCALATEd anyway.
maxArbiterInterventions: ownerVerdict === 'needs_context' ? 0 : undefined,
arbiterLogMessage: 'Owner blocked/needs_context — requesting arbiter',
escalateLogMessage: 'Owner blocked/needs_context — escalating to user',
logContext: {