-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Open
Labels
bugSomething isn't workingSomething isn't workingstaleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Bug Description
The bot used via Telegram channel gets stuck in an infinite loop, repeatedly sending the same message. The issue is caused by a corrupted/stuck session state that persists across service restarts. Simply clearing the update-offset-default.json file is not sufficient - the session file must also be deleted.
This appears to happen when an agent task fails (e.g., Python script errors during audio generation or even a simple cron related tasks [screenshots below]) and enters a retry loop. The session state grows large (200KB+) and gets reloaded on every restart, causing the bot to continue sending the same message repeatedly.
Environment
- OpenClaw Version:
2026.1.30 - Installation Method: npm global install
- OS: Linux (Ubuntu/Debian)
- Node Version: v22.22.0
- Telegram: Using polling mode (not webhook)
Steps to Reproduce
- Ask the agent to perform a task that may fail or timeout (e.g., generate audio/theme song using Python)
- Let the agent encounter errors and enter a retry loop
- Wait for the session to accumulate errors
- Restart the service:
systemctl --user restart openclaw - Bot loads the stuck session and continues the loop
Expected Behavior
- Service restart should clear any stuck/failed session states
- Or: Failed tasks should be cleaned up automatically after N retries
- Or: Option to "forget" session state on startup
Actual Behavior
- Session files (
~/.openclaw/agents/jatin/sessions/<uuid>.jsonl) persist across restarts - The bot re-loads the stuck session and continues sending duplicate messages
- Manual deletion of both the session file AND
update-offset-default.jsonis required to recover
Workarounds Tried
- ✗ Service restart alone:
systemctl --user restart openclaw- Does not help - ✗ Clearing telegram offset only:
rm ~/.openclaw/telegram/update-offset-default.json- Does not help - ✓ Clearing both session file AND offset: Works
Recovery script that works:
systemctl --user stop openclaw
rm -f ~/.openclaw/telegram/update-offset-default.json
rm -f ~/.openclaw/agents/jatin/sessions/<stuck-session-id>.jsonl
systemctl --user start openclawLogs
# From journalctl showing the stuck session being reloaded:
[agent/embedded] Removed orphaned user message to prevent consecutive user turns.
runId=a5a47ea7-11d3-4f82-9375-39b734ac3fba
sessionId=8f57b2a1-005e-4edf-bfc6-d20c6469dfa2
Session file sizes observed during stuck state:
8f57b2a1-005e-4edf-bfc6-d20c6469dfa2.jsonl: 438KBfed57ba4-9950-4118-b499-6757f7dbd400.jsonl: 220KB
Screenshots
Suggestions
- Auto-cleanup: Automatically delete or archive session files that exceed a certain size threshold
- Startup flag: Add a
--fresh-startflag to ignore existing session states - Session timeout: Automatically expire/forget sessions after X minutes of inactivity
- Max retry limit: Enforce a hard limit on retries for failed tasks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingstaleMarked as stale due to inactivityMarked as stale due to inactivity

