From 7aa051fa8a1e9df1f1a7474f50b330f0a6fedd4a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Feb 2026 18:13:34 +0000 Subject: [PATCH] Fix: only update lastAgentTimestamp on agent success Previously, lastAgentTimestamp was updated regardless of whether runAgent succeeded or failed. This caused messages to be skipped on retry after a failure since they were already marked as processed. Now the timestamp is only advanced when the agent returns a valid response, ensuring failed messages will be included in the next retry. https://claude.ai/code/session_0118wNAJCKY2Asr17Lb91TE2 --- src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 8167aef..37f21a9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -86,9 +86,8 @@ async function processMessage(msg: NewMessage): Promise { const response = await runAgent(group, prompt, msg.chat_jid); await setTyping(msg.chat_jid, false); - lastAgentTimestamp[msg.chat_jid] = msg.timestamp; - if (response) { + lastAgentTimestamp[msg.chat_jid] = msg.timestamp; await sendMessage(msg.chat_jid, `${ASSISTANT_NAME}: ${response}`); } }