From c954a383d3f04c0b3d85b7f30908ca030f606042 Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Mon, 30 Mar 2026 20:32:20 +0900 Subject: [PATCH] fix: route reviewer failover handoffs via reviewer channel Reviewer failover handoffs were routed through the owner channel, causing codex-review to run in owner mode instead of reviewer mode. Now detects reviewer handoffs by reason prefix and routes them through the correct reviewer channel. --- src/message-runtime.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/message-runtime.ts b/src/message-runtime.ts index 71d503c..966f879 100644 --- a/src/message-runtime.ts +++ b/src/message-runtime.ts @@ -435,6 +435,17 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): { return; } + // Reviewer failover handoffs (reason starts with "reviewer-") should + // run via the reviewer channel so they execute in reviewer mode. + const isReviewerHandoff = handoff.reason?.startsWith('reviewer-'); + let handoffChannel = channel; + if (isReviewerHandoff) { + const revChName = + REVIEWER_AGENT_TYPE === 'claude-code' ? 'discord' : 'discord-review'; + handoffChannel = + findChannelByName(deps.channels, revChName) || channel; + } + const runId = `handoff-${handoff.id}`; try { const result = await executeTurn({ @@ -442,7 +453,7 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): { prompt: handoff.prompt, chatJid: handoff.chat_jid, runId, - channel, + channel: handoffChannel, startSeq: handoff.start_seq, endSeq: handoff.end_seq, });