-
-
Notifications
You must be signed in to change notification settings - Fork 54.3k
Open
Labels
staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Problem
When the OpenClaw gateway restarts (due to crash, config error, maintenance, etc.), any messages sent to Telegram or Discord while the gateway was down are permanently missed. This leads to:
- Unanswered user messages
- Lost conversation context
- Poor user experience when the bot appears to "ignore" messages
Current Behavior
Both Telegram and Discord channels only process messages that arrive after the gateway connects:
- Telegram: Uses
getUpdatespolling or webhooks, but doesnt trackupdate_idfor catch-up - Discord: Uses gateway events, doesnt fetch missed messages on reconnect
Proposed Solution
Implement a message catch-up mechanism that:
-
Tracks last processed ID per channel/session:
- Telegram: Store last
update_id - Discord: Store last
message_idper channel
- Telegram: Store last
-
On gateway startup:
- Query each channel for messages/updates after the last seen ID
- Queue them for processing with rate limiting
-
Config options:
{
"channels": {
"telegram": {
"catchup": {
"enabled": true,
"maxMessages": 50,
"maxAgeHours": 24
}
},
"discord": {
"catchup": {
"enabled": true,
"maxMessages": 100,
"maxAgeHours": 48
}
}
}
}API Support
| Platform | API Capability | Retention |
|---|---|---|
| Telegram | getUpdates?offset=N |
~24 hours |
| Discord | GET /channels/{id}/messages?after={id} |
Unlimited (channel dependent) |
Benefits
- Reliability: No missed messages during downtime
- User Experience: Users get responses even if bot was temporarily offline
- Professionalism: Bot appears consistently available
Related Issues
- Feature: Cron job catch-up for missed runs after gateway restart #10067 (cron catch-up)
- [Bug]: Multi-Agent Queue Instability & Backlog / lagging event-horizon #25709 (queue backlog)
Willing to Contribute
Yes, I can help test and provide feedback on implementation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
staleMarked as stale due to inactivityMarked as stale due to inactivity