openclaw - 💡(How to fix) Fix [Bug]: Session stuck in `processing` state causing infinite loop and API rate limiting [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#74862Fetched 2026-05-01 05:40:36
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Author
Timeline (top)
labeled ×2closed ×1commented ×1

After a user message, the session gets stuck in processing state indefinitely; the model enters an infinite loop generating the same response, blocking the event loop (eventLoopUtilization=1) and triggering API rate limiting. Gateway logs confirm stuck session warnings from age=164s to age=1049s.

Error Message

Key log lines from C:\Users\ADMINI~1\AppData\Local\Temp\openclaw\openclaw-2026-04-30.log:

Stuck session warnings (every ~30s): {"subsystem":"diagnostic"} "stuck session: sessionId=main sessionKey=agent:main:main state=processing age=1049s queueDepth=1"

Event loop blocking: {"subsystem":"diagnostic"} "liveness warning: reasons=event_loop_delay,event_loop_utilization interval=136s eventLoopDelayP99Ms=129788.5 eventLoopDelayMaxMs=129788.5 eventLoopUtilization=1 cpuCoreRatio=0.599 active=1 waiting=0 queued=1"

Tool call error: "[tools] read failed: EISDIR: illegal operation on a directory, raw_params={"path":"C:\Users\Administrator\AppData\Roaming\npm\node_modules\openclaw\docs\diagnostics"}"

Restart failure after upgrade: "Gateway did not become healthy after restart." "Gateway version mismatch: expected 2026.4.27, running gateway reported unavailable."

Full log file covers 08:50–10:11 UTC+8.

Root Cause

Possible root causes:

  1. No timeout mechanism for processing state in the session state machine
  2. Model API streaming response not properly terminated on timeout
  3. Session state not cleaned up during gateway restart/upgrade
  4. Tool call error (EISDIR) may have triggered an unhandled exception path

Fix Action

Fix / Workaround

  1. Start OpenClaw 2026.4.26 with openclaw-weixin channel and qwen/qwen3.5-plus model.
  2. Send a message via WeChat.
  3. Model API response hangs or times out.
  4. Session enters stuck state — confirmed by gateway logs showing stuck session: state=processing age=164s at 08:53:33.
  5. Session remains stuck through upgrade to 2026.4.27 and restart — confirmed by logs showing stuck session warnings continuing from 09:26 to 10:11 (age up to 1049s).

This is NOT a regression between specific versions — the issue started on 2026.4.26 and persisted through upgrade to 2026.4.27. The stuck session state was NOT cleared by the restart.

Code Example

Key log lines from C:\Users\ADMINI~1\AppData\Local\Temp\openclaw\openclaw-2026-04-30.log:

Stuck session warnings (every ~30s):
{"subsystem":"diagnostic"} "stuck session: sessionId=main sessionKey=agent:main:main state=processing age=1049s queueDepth=1"

Event loop blocking:
{"subsystem":"diagnostic"} "liveness warning: reasons=event_loop_delay,event_loop_utilization interval=136s eventLoopDelayP99Ms=129788.5 eventLoopDelayMaxMs=129788.5 eventLoopUtilization=1 cpuCoreRatio=0.599 active=1 waiting=0 queued=1"


Tool call error:
"[tools] read failed: EISDIR: illegal operation on a directory, raw_params={"path":"C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\openclaw\\docs\\diagnostics"}"


Restart failure after upgrade:
"Gateway did not become healthy after restart." "Gateway version mismatch: expected 2026.4.27, running gateway reported unavailable."

Full log file covers 08:5010:11 UTC+8.
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

After a user message, the session gets stuck in processing state indefinitely; the model enters an infinite loop generating the same response, blocking the event loop (eventLoopUtilization=1) and triggering API rate limiting. Gateway logs confirm stuck session warnings from age=164s to age=1049s.

Steps to reproduce

  1. Start OpenClaw 2026.4.26 with openclaw-weixin channel and qwen/qwen3.5-plus model.
  2. Send a message via WeChat.
  3. Model API response hangs or times out.
  4. Session enters stuck state — confirmed by gateway logs showing stuck session: state=processing age=164s at 08:53:33.
  5. Session remains stuck through upgrade to 2026.4.27 and restart — confirmed by logs showing stuck session warnings continuing from 09:26 to 10:11 (age up to 1049s).

Expected behavior

When the model API times out or hangs, the session should be automatically terminated with an error returned to the user. After a gateway restart, any stuck sessions should be cleaned up.

Actual behavior

Session remains in processing state indefinitely. The model enters an infinite loop generating the same content. Gateway logs show stuck session warnings every ~30s (age=164s at 08:53, age=1049s at 10:11). Event loop is blocked (eventLoopUtilization=1, eventLoopDelayP99Ms=129788.5). The issue persists through upgrade and restart.

OpenClaw version

2026.4.26 → 2026.4.27

Operating system

Windows Server 2022 (Windows_NT 10.0.20348)

Install method

npm global

Model

qwen/qwen3.5-plus

Provider / routing chain

openclaw-weixin → modelstudio → qwen/qwen3.5-plus

Additional provider/model setup details

Default route is openclaw-weixin → modelstudio → qwen/qwen3.5-plus. Config lives in ~/.openclaw/openclaw.json under auth.profiles and agent.model. Channel plugin: openclaw-weixin (C:\Users\Administrator.openclaw\extensions\openclaw-weixin).

Logs, screenshots, and evidence

Key log lines from C:\Users\ADMINI~1\AppData\Local\Temp\openclaw\openclaw-2026-04-30.log:

Stuck session warnings (every ~30s):
{"subsystem":"diagnostic"} "stuck session: sessionId=main sessionKey=agent:main:main state=processing age=1049s queueDepth=1"

Event loop blocking:
{"subsystem":"diagnostic"} "liveness warning: reasons=event_loop_delay,event_loop_utilization interval=136s eventLoopDelayP99Ms=129788.5 eventLoopDelayMaxMs=129788.5 eventLoopUtilization=1 cpuCoreRatio=0.599 active=1 waiting=0 queued=1"


Tool call error:
"[tools] read failed: EISDIR: illegal operation on a directory, raw_params={"path":"C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\openclaw\\docs\\diagnostics"}"


Restart failure after upgrade:
"Gateway did not become healthy after restart." "Gateway version mismatch: expected 2026.4.27, running gateway reported unavailable."

Full log file covers 08:50–10:11 UTC+8.

Impact and severity

Affected: WeChat channel users on Windows Severity: High (blocks entire session, consumes API quota, triggers rate limiting) Frequency: Observed once, but session remained stuck for 17+ minutes across upgrade/restart Consequence: User cannot use the session; excessive API calls trigger rate limiting; requires manual service restart to recover

Additional information

This is NOT a regression between specific versions — the issue started on 2026.4.26 and persisted through upgrade to 2026.4.27. The stuck session state was NOT cleared by the restart.

Possible root causes:

  1. No timeout mechanism for processing state in the session state machine
  2. Model API streaming response not properly terminated on timeout
  3. Session state not cleaned up during gateway restart/upgrade
  4. Tool call error (EISDIR) may have triggered an unhandled exception path

Suggested fixes:

  1. Add timeout for processing state (recommended: 5 minutes)
  2. Clean up stuck sessions on restart
  3. Improve streaming response timeout handling
  4. Add duplicate content detection to auto-terminate infinite loops

extent analysis

TL;DR

Implement a timeout mechanism for the processing state in the session state machine to prevent indefinite session sticking.

Guidance

  • Investigate and implement a timeout for the processing state, as suggested, with a recommended timeout of 5 minutes to prevent sessions from getting stuck indefinitely.
  • Review the model API's streaming response handling to ensure it properly terminates on timeout, which could be a contributing factor to the infinite loop.
  • Examine the session cleanup process during gateway restart/upgrade to ensure stuck sessions are properly cleaned up, preventing persistence across restarts.
  • Consider adding duplicate content detection to auto-terminate sessions that enter infinite loops, as a preventive measure against similar issues.

Example

No specific code example can be provided without knowing the exact implementation details of the session state machine and model API. However, the concept would involve setting a timer when a session enters the processing state and transitioning it to an error state or terminating it if the timer expires.

Notes

The provided log files and error messages indicate a complex issue involving session state management, model API interactions, and potential exceptions. The suggested fixes aim to address the most likely causes but may require further investigation and testing to fully resolve the issue.

Recommendation

Apply the workaround by implementing a timeout for the processing state, as this directly addresses one of the identified root causes and can help mitigate the issue of sessions getting stuck indefinitely.

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…

FAQ

Expected behavior

When the model API times out or hangs, the session should be automatically terminated with an error returned to the user. After a gateway restart, any stuck sessions should be cleaned up.

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]: Session stuck in `processing` state causing infinite loop and API rate limiting [1 comments, 2 participants]