From 39e94c47b3358e5ce6108636130acbf4dbd71a59 Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Mon, 30 Mar 2026 20:26:43 +0900 Subject: [PATCH] fix: collect handoffs for all service IDs in unified service The unified service runs all three bots (claude, codex-main, codex-review) in one process but only queried handoffs for SERVICE_ID (claude). Reviewer failover handoffs targeting codex-review were never picked up. Now queries all three service IDs. --- src/message-runtime.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/message-runtime.ts b/src/message-runtime.ts index 2593b1a..71d503c 100644 --- a/src/message-runtime.ts +++ b/src/message-runtime.ts @@ -21,6 +21,9 @@ import { type WorkItem, } from './db.js'; import { + CLAUDE_SERVICE_ID, + CODEX_MAIN_SERVICE_ID, + CODEX_REVIEW_SERVICE_ID, isSessionCommandSenderAllowed, REVIEWER_AGENT_TYPE, SERVICE_AGENT_TYPE, @@ -392,7 +395,17 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): { }; const enqueuePendingHandoffs = (): void => { - for (const handoff of getPendingServiceHandoffs(SERVICE_ID)) { + // Unified service handles all three bots — collect handoffs for all service IDs. + const allServiceIds = new Set([ + SERVICE_ID, + CLAUDE_SERVICE_ID, + CODEX_MAIN_SERVICE_ID, + CODEX_REVIEW_SERVICE_ID, + ]); + const allHandoffs = [...allServiceIds].flatMap((id) => + getPendingServiceHandoffs(id), + ); + for (const handoff of allHandoffs) { if (!claimServiceHandoff(handoff.id)) { continue; } @@ -930,10 +943,7 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): { !!loopPendingTask && (loopPendingTask.status === 'review_ready' || loopPendingTask.status === 'in_review'); - const loopCursorKey = pairedCursorKey( - chatJid, - loopIsReviewerTurn, - ); + const loopCursorKey = pairedCursorKey(chatJid, loopIsReviewerTurn); const rawPendingMessages = getMessagesSinceSeq( chatJid,