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.
This commit is contained in:
@@ -21,6 +21,9 @@ import {
|
|||||||
type WorkItem,
|
type WorkItem,
|
||||||
} from './db.js';
|
} from './db.js';
|
||||||
import {
|
import {
|
||||||
|
CLAUDE_SERVICE_ID,
|
||||||
|
CODEX_MAIN_SERVICE_ID,
|
||||||
|
CODEX_REVIEW_SERVICE_ID,
|
||||||
isSessionCommandSenderAllowed,
|
isSessionCommandSenderAllowed,
|
||||||
REVIEWER_AGENT_TYPE,
|
REVIEWER_AGENT_TYPE,
|
||||||
SERVICE_AGENT_TYPE,
|
SERVICE_AGENT_TYPE,
|
||||||
@@ -392,7 +395,17 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const enqueuePendingHandoffs = (): void => {
|
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)) {
|
if (!claimServiceHandoff(handoff.id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -930,10 +943,7 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): {
|
|||||||
!!loopPendingTask &&
|
!!loopPendingTask &&
|
||||||
(loopPendingTask.status === 'review_ready' ||
|
(loopPendingTask.status === 'review_ready' ||
|
||||||
loopPendingTask.status === 'in_review');
|
loopPendingTask.status === 'in_review');
|
||||||
const loopCursorKey = pairedCursorKey(
|
const loopCursorKey = pairedCursorKey(chatJid, loopIsReviewerTurn);
|
||||||
chatJid,
|
|
||||||
loopIsReviewerTurn,
|
|
||||||
);
|
|
||||||
|
|
||||||
const rawPendingMessages = getMessagesSinceSeq(
|
const rawPendingMessages = getMessagesSinceSeq(
|
||||||
chatJid,
|
chatJid,
|
||||||
|
|||||||
Reference in New Issue
Block a user