refactor: drop idle queue state

This commit is contained in:
Eyejoker
2026-03-23 04:57:13 +09:00
parent 02408aae8e
commit 7c6019dea3
6 changed files with 158 additions and 212 deletions

View File

@@ -126,6 +126,25 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): {
channel?.isOwnMessage?.bind(channel),
);
const filterLoopingPairedBotMessages = (
chatJid: string,
messages: Parameters<typeof filterProcessableMessages>[0],
failureText: string,
) => {
if (!isPairedRoomJid(chatJid)) return messages;
// Keep mentionless paired-room collaboration intact, but drop the generic
// failure boilerplate from other bots so paired agents do not amplify it
// into a reply loop.
return messages.filter(
(message) =>
!(
message.is_bot_message &&
message.content.trim() === failureText
),
);
};
const deliverOpenWorkItem = async (
channel: Channel,
item: WorkItem,
@@ -575,10 +594,10 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): {
sinceSeqCursor,
deps.assistantName,
);
const missedMessages = getProcessableMessages(
const missedMessages = filterLoopingPairedBotMessages(
chatJid,
rawMissedMessages,
channel,
getProcessableMessages(chatJid, rawMissedMessages, channel),
FAILURE_FINAL_TEXT,
);
if (missedMessages.length === 0) {