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
This commit is contained in:
Claude
2026-02-01 18:13:34 +00:00
parent c255451ac3
commit 7aa051fa8a

View File

@@ -86,9 +86,8 @@ async function processMessage(msg: NewMessage): Promise<void> {
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}`);
}
}