fix(whatsapp_agent): retain unsent scheduled results across reconnects

This commit is contained in:
Xubin Ren committed 2026-10-18 14:49:49 +08:00
1 parent 86f16ff493
commit c49d84b4e5
3 files changed
+81 -10

No files matched your search

+1
View File
@@ -156,6 +156,7 @@ At most one poller may run per agent token. If you start a second gateway agains
- **Durable cursor.** nanobot records message ids before handling them and saves the server cursor after each batch. A restart deduplicates recorded ids. A crash between recording and dispatch can lose that message; this is not exactly-once delivery. If state cannot be saved, the channel stops instead of acknowledging more traffic.
- **Retention.** WhatsApp keeps updates for 30 days. On first run, nanobot saves the current time and reads from `offset=0`, discarding messages older than that time or without a timestamp. This avoids gaps after empty polls. Keep the gateway clock synchronized. Timestamps have one-second precision, so messages from the startup second are included. Reading a large backlog can delay the first reply. Restarts retain the original boundary and cursor; changing the token starts a new boundary.
- **Invalid token.** If WhatsApp rejects the token, the channel stops and logs an actionable message instead of retrying forever.
- **Scheduled results.** A result that reaches the channel before it connects or learns the creator identifier remains in the gateway's pending-delivery queue. After connection, the gateway can send the saved result without running the task again. A connection loss after any part is sent is recorded as an unknown outcome and is not automatically replayed.
- **Privacy.** Agent conversations are not end-to-end encrypted. nanobot processes these messages and sends them to your configured model provider. Downloaded attachments and session history may remain on the nanobot host. Your other WhatsApp chats are unaffected. Do not use this channel for data that requires end-to-end encryption.
## Troubleshooting