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.
This commit is contained in:
@@ -707,12 +707,24 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): {
|
|||||||
},
|
},
|
||||||
'Dispatching queued messages to agent',
|
'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({
|
const { deliverySucceeded, visiblePhase } = await executeTurn({
|
||||||
group,
|
group,
|
||||||
prompt,
|
prompt,
|
||||||
chatJid,
|
chatJid,
|
||||||
runId,
|
runId,
|
||||||
channel,
|
channel: turnChannel,
|
||||||
startSeq,
|
startSeq,
|
||||||
endSeq,
|
endSeq,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user