fix: skip enqueueMessageCheck when task is already completed (ESCALATE/done)

This commit is contained in:
Eyejoker
2026-03-31 04:59:27 +09:00
parent 636c54702a
commit 196c453ccf
2 changed files with 11 additions and 3 deletions

View File

@@ -1076,13 +1076,16 @@ export async function runAgentForGroup(
// After owner/reviewer completes, enqueue the next turn so // After owner/reviewer completes, enqueue the next turn so
// the message loop picks it up without waiting for a new message. // the message loop picks it up without waiting for a new message.
// Skip if owner produced no output — likely interrupted by /stop. // Skip if: no output (interrupted), or task already completed (ESCALATE, done, etc.)
if ( if (
pairedExecutionContext && pairedExecutionContext &&
pairedExecutionStatus === 'succeeded' && pairedExecutionStatus === 'succeeded' &&
pairedSawOutput pairedSawOutput
) { ) {
const finishedCheck = getPairedTaskById(pairedExecutionContext.task.id);
if (finishedCheck?.status !== 'completed') {
deps.queue.enqueueMessageCheck(chatJid); deps.queue.enqueueMessageCheck(chatJid);
} }
} }
} }
}

View File

@@ -246,7 +246,12 @@ export function preparePairedExecutionContext(args: {
return undefined; return undefined;
} }
const task = ensureActiveTask(group, chatJid, roomRoleContext, args.hasHumanMessage); const task = ensureActiveTask(
group,
chatJid,
roomRoleContext,
args.hasHumanMessage,
);
if (!task) { if (!task) {
return undefined; return undefined;
} }