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
// 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 (
pairedExecutionContext &&
pairedExecutionStatus === 'succeeded' &&
pairedSawOutput
) {
deps.queue.enqueueMessageCheck(chatJid);
const finishedCheck = getPairedTaskById(pairedExecutionContext.task.id);
if (finishedCheck?.status !== 'completed') {
deps.queue.enqueueMessageCheck(chatJid);
}
}
}
}