openclaw - 💡(How to fix) Fix [Bug]: Telegram stuck session blocks processing — session stays in state=processing indefinitely (120s+), no auto-recovery [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#74550Fetched 2026-04-30 06:23:05
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Timeline (top)
closed ×1commented ×1cross-referenced ×1

Telegram sessions enter a stuck state after prolonged processing (>120s) and remain stuck indefinitely. The diagnostic subsystem correctly detects them (every 30s, age increasing), but takes no recovery action. Multiple other Telegram sessions continue processing normally while one session is stuck. Gateway requires manual restart to recover.

Root Cause

Root Cause Hypothesis

Fix Action

Workaround

Identify stuck gateway process: ps aux | grep openclaw-gateway | grep -v grep Kill and restart: kill -9 <gateway-pid> then openclaw agents list (background) Wait ~90s for menu generation to complete

RAW_BUFFERClick to expand / collapse

Summary

Telegram sessions enter a stuck state after prolonged processing (>120s) and remain stuck indefinitely. The diagnostic subsystem correctly detects them (every 30s, age increasing), but takes no recovery action. Multiple other Telegram sessions continue processing normally while one session is stuck. Gateway requires manual restart to recover.

Environment

  • OpenClaw: 2026.4.x (latest as of 2026-04-29)
  • Channel: Telegram (polling mode)
  • OS: Debian GNU/Linux 12 (bookworm)
  • Node: v22.22.1
  • Setup: 3 Telegram bots (default, max, gpt) on same gateway instance

Symptoms

From our gateway log (2026-04-29):

stuck session: sessionId=max sessionKey=agent:max:telegram:direct:8071428512 state=processing age=149s queueDepth=1 stuck session: sessionId=max sessionKey=agent:max:telegram:direct:8071428512 state=processing age=179s queueDepth=1 stuck session: sessionId=max sessionKey=agent:max:telegram:direct:8071428512 state=processing age=209s queueDepth=1 ... (continues every 30s until restart)

Meanwhile, other Telegram sessions continue to process: telegram sendMessage ok chat=8071428512 message=3399 telegram sendMessage ok chat=8071428512 message=3400

Key Observations

  1. Only the affected session is stuck — other Telegram bots/sessions continue to receive and send messages normally
  2. No auto-recovery — stuck session stays in state=processing forever, detected but never cleared
  3. Manual restart required — only kill -9 <gateway-pid> + restart recovers
  4. The session key contains the Telegram chat_id (agent:max:telegram:direct:8071428512) — suggesting this is a specific user session that hit a long-running operation
  5. The stuck session does NOT block other sessions — sendMessage operations for other sessions continue to work

Root Cause Hypothesis

Based on issue #73510 (stuck sessions cause permanent gateway hang), the failure chain appears to be:

  1. Max agent session starts a long-running operation (>120s threshold)
  2. Session enters state=processing and stays there
  3. Diagnostic subsystem detects stuck session every 30s, logs WARNING, but takes no action
  4. Session remains in processing state indefinitely
  5. Only manual restart clears the stuck session

Impact

  • Affected user session is completely blocked
  • Other sessions on the same gateway continue to work normally
  • Gateway itself stays alive and responsive
  • Requires manual intervention to recover

Expected Behavior

Per issue #73327 (per-job configurable stuck-session threshold), the fix should be:

  • Configurable stuckSessionAbortMs threshold
  • Automatic session abortion after threshold exceeded
  • OR: automatic session reset after N consecutive detections
  • OR: gateway self-restart after threshold

Workaround

Identify stuck gateway process: ps aux | grep openclaw-gateway | grep -v grep Kill and restart: kill -9 <gateway-pid> then openclaw agents list (background) Wait ~90s for menu generation to complete

Related Issues

  • #73510 — Stuck sessions cause permanent gateway hang (same problem, different channel)
  • #73327 — Cron: per-job configurable stuck-session threshold (open, feature request)
  • #71127 — Stuck processing sessions detected but never aborted
  • #53745 — Gateway freezes after nested subagent activity, stops Telegram polling

extent analysis

TL;DR

Implement a configurable stuck-session threshold to automatically abort or reset stuck sessions after a specified time, as suggested in issue #73327.

Guidance

  • Review the diagnostic subsystem's configuration to understand why it detects stuck sessions but takes no action, and consider modifying it to trigger automatic recovery.
  • Investigate the long-running operation causing the session to stick, and optimize or split it to reduce processing time.
  • Consider implementing a temporary workaround by periodically checking for stuck sessions and manually restarting the gateway process if necessary.
  • Examine related issues #73510, #71127, and #53745 for potential insights into similar problems and their solutions.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The provided information suggests that the issue is specific to the Telegram channel and the max agent session. The fact that other sessions continue to work normally indicates that the problem might be related to the specific user session or the long-running operation it triggered.

Recommendation

Apply a workaround by implementing a script to periodically check for stuck sessions and restart the gateway process if necessary, until a permanent fix is available, such as the configurable stuck-session threshold suggested in issue #73327.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Telegram stuck session blocks processing — session stays in state=processing indefinitely (120s+), no auto-recovery [1 comments, 2 participants]