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.
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user