openclaw - 💡(How to fix) Fix Task maintenance leaves multi-day running tasks stale; doctor/manual cancel required [1 pull requests]

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…

OpenClaw can retain very old running task rows for days. openclaw tasks maintenance --apply prunes task-flow records, but does not mark these stale running tasks lost/cancelled. In this state the gateway became intermittently non-responsive and required openclaw doctor --fix to recover the control path.

Root Cause

Related liveness symptoms

During the stale-task period the gateway repeatedly hit event-loop liveness warnings and websocket timeouts. A macOS sample during high CPU showed the gateway hot in V8 microtasks/JSON parsing, but the precise JS caller was not available without a Node CPU profile. This issue is specifically about the stale task cleanup gap, not claiming stale tasks are the sole CPU root cause.

Fix Action

Fixed

Code Example

Tasks maintenance (applied): tasks 0 reconcile · 0 recovered · 0 cleanup stamp · 0 prune; task-flows 0 reconcile · 65 prune
Tasks health after apply: 0 queued · 3 running · 3 audit errors · 25 audit warnings

---

9906af0e-df96-4840-921f-42ced79e82e7  created 2026-04-29 21:53  owner agent:main:web_b015a645b1_47aed28cc700
5e098c13-da22-45b8-91f9-4aa9e88c271e  created 2026-05-01 22:22  owner agent:main:subagent:771e97dc-c137-4af7-9e9b-570e40b8225c
b0fa03c6-460f-4bc6-9d4f-1240f231cc1d  created 2026-05-01 22:22  owner agent:main:subagent:22a5d09c-f5da-474f-a5c3-792f6d48026a

---

openclaw tasks cancel 9906af0e-df96-4840-921f-42ced79e82e7
openclaw tasks cancel 5e098c13-da22-45b8-91f9-4aa9e88c271e
openclaw tasks cancel b0fa03c6-460f-4bc6-9d4f-1240f231cc1d

Tasks health after apply: 0 queued · 0 running · 0 audit errors · 25 audit warnings
RAW_BUFFERClick to expand / collapse

Summary

OpenClaw can retain very old running task rows for days. openclaw tasks maintenance --apply prunes task-flow records, but does not mark these stale running tasks lost/cancelled. In this state the gateway became intermittently non-responsive and required openclaw doctor --fix to recover the control path.

Observed environment

  • OpenClaw: 2026.5.2 (8b2a6e5)
  • macOS: 26.4.1 arm64
  • Node: 25.8.1
  • Gateway LaunchAgent: ai.openclaw.gateway

Evidence

openclaw status showed:

  • Tasks: 4 active · 0 queued · 4 running · 67 issues
  • repeated gateway liveness warnings: event_loop_delay,event_loop_utilization,cpu
  • websocket handshake timeouts / connectivity probe timeouts while PID was still listening on port 18789

openclaw tasks maintenance --apply initially reported task-flow pruning, but still left stale running tasks:

Tasks maintenance (applied): tasks 0 reconcile · 0 recovered · 0 cleanup stamp · 0 prune; task-flows 0 reconcile · 65 prune
Tasks health after apply: 0 queued · 3 running · 3 audit errors · 25 audit warnings

The remaining running tasks were days old:

9906af0e-df96-4840-921f-42ced79e82e7  created 2026-04-29 21:53  owner agent:main:web_b015a645b1_47aed28cc700
5e098c13-da22-45b8-91f9-4aa9e88c271e  created 2026-05-01 22:22  owner agent:main:subagent:771e97dc-c137-4af7-9e9b-570e40b8225c
b0fa03c6-460f-4bc6-9d4f-1240f231cc1d  created 2026-05-01 22:22  owner agent:main:subagent:22a5d09c-f5da-474f-a5c3-792f6d48026a

Manual cancellation cleared the task audit errors:

openclaw tasks cancel 9906af0e-df96-4840-921f-42ced79e82e7
openclaw tasks cancel 5e098c13-da22-45b8-91f9-4aa9e88c271e
openclaw tasks cancel b0fa03c6-460f-4bc6-9d4f-1240f231cc1d

Tasks health after apply: 0 queued · 0 running · 0 audit errors · 25 audit warnings

Expected behavior

Task maintenance should detect impossible/stale running tasks, probably by age + missing live run/session/process signal, then mark them lost, timed_out, or cancelled without requiring manual lookup/cancel.

A conservative default would be to treat running tasks older than 24h as stale unless there is clear evidence of active work.

Actual behavior

Maintenance pruned task-flow records but left multi-day running task rows untouched. These showed as audit errors until manually cancelled.

Suggested fix

  • Extend openclaw tasks maintenance --apply to reconcile stale running tasks.
  • Add an age threshold or config knob, e.g. --max-running-age 24h / default 24h.
  • Include a dry-run line that lists stale running tasks that would be marked lost/cancelled.
  • Consider having doctor --fix invoke the same stale-running-task reconciliation.

Related liveness symptoms

During the stale-task period the gateway repeatedly hit event-loop liveness warnings and websocket timeouts. A macOS sample during high CPU showed the gateway hot in V8 microtasks/JSON parsing, but the precise JS caller was not available without a Node CPU profile. This issue is specifically about the stale task cleanup gap, not claiming stale tasks are the sole CPU root cause.

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

Task maintenance should detect impossible/stale running tasks, probably by age + missing live run/session/process signal, then mark them lost, timed_out, or cancelled without requiring manual lookup/cancel.

A conservative default would be to treat running tasks older than 24h as stale unless there is clear evidence of active work.

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 Task maintenance leaves multi-day running tasks stale; doctor/manual cancel required [1 pull requests]