From 5865dea5582d88bc6f7a11c25c2d21a3e291945d Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Mon, 30 Mar 2026 00:54:51 +0900 Subject: [PATCH] fix: route reviewer output to reviewer channel in queued message path When reviewer was triggered via the normal message dispatch path (not the review_ready check path), output was sent through the owner channel. Now checks paired task status to determine the correct output channel. --- src/message-runtime.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/message-runtime.ts b/src/message-runtime.ts index e60f19e..4684468 100644 --- a/src/message-runtime.ts +++ b/src/message-runtime.ts @@ -707,12 +707,24 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): { }, 'Dispatching queued messages to agent', ); + // Use reviewer channel when the agent will run in reviewer mode. + // This is determined by the paired task status — if review_ready + // or in_review, the executor switches to reviewer mode. + const pendingTaskForChannel = isPairedRoomJid(chatJid) + ? getLatestOpenPairedTaskForChat(chatJid) + : null; + const useReviewerChannel = + pendingTaskForChannel && + (pendingTaskForChannel.status === 'review_ready' || + pendingTaskForChannel.status === 'in_review'); + const turnChannel = useReviewerChannel ? reviewerChannel : channel; + const { deliverySucceeded, visiblePhase } = await executeTurn({ group, prompt, chatJid, runId, - channel, + channel: turnChannel, startSeq, endSeq, });