openclaw - 💡(How to fix) Fix stale_running tasks remain in ledger and cannot be cleared [1 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#60887Fetched 2026-04-08 02:46:01
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Fix Action

Fix / Workaround

Local workaround that resolved the stuck ledger:

  • stopped gateway
  • backed up runs.sqlite / registry.sqlite / subagents/runs.json
  • updated task_runs in ~/.openclaw/tasks/runs.sqlite from status='running' to status='failed' for stale entries
  • restarted gateway

Result after workaround:

  • 0 running tasks
  • tasks audit: 0 errors, 2 warnings
RAW_BUFFERClick to expand / collapse

Full logs + artifacts: https://gist.github.com/Gernspi/5fec03c23b4f629a3798d16b6c9cd990

Titel: stale_running tasks remain in ledger and cannot be cleared in OpenClaw 2026.4.2

Setup:

  • OpenClaw 2026.4.2
  • user systemd service: openclaw-gateway.service
  • no separate worker/runner systemd unit
  • only gateway process visible besides the shell/session

Observed behavior:

  • openclaw tasks audit reports many stale_running findings
  • openclaw tasks maintenance --apply reports success but does not reduce findings
  • restarting openclaw-gateway does not clear them
  • openclaw tasks list --status running --json still shows many tasks as running

Important inconsistency:

  • cancelling a listed subagent task returns: Subagent task not found.
  • cancelling the paired cli task returns: Task runtime does not support cancellation yet.

Example pair:

  • subagent taskId: 1d484e85-0a06-486e-8c29-e6682b14dbd3
  • cli taskId: 1fac6326-b1c5-4eac-a5b7-a054f47c6a00

Expected:

  • stale running tasks should either be cancellable, removable by maintenance, or reconciled after gateway restart

Actual:

  • task ledger continues to report stale running tasks that are no longer backed by a real subagent process and cannot be cleared through the available CLI paths

Artifacts attached:

  • version.txt
  • tasks-audit.txt
  • tasks-running.json

Original cancel outputs:

  • subagent cancel: Subagent task not found.
  • cli cancel: Task runtime does not support cancellation yet.

Local workaround that resolved the stuck ledger:

  • stopped gateway
  • backed up runs.sqlite / registry.sqlite / subagents/runs.json
  • updated task_runs in ~/.openclaw/tasks/runs.sqlite from status='running' to status='failed' for stale entries
  • restarted gateway

Result after workaround:

  • 0 running tasks
  • tasks audit: 0 errors, 2 warnings

extent analysis

TL;DR

Manually updating the task status in the database to 'failed' for stale entries may resolve the issue of stuck ledger tasks.

Guidance

  • The inconsistency between the task status and the actual process state suggests a database inconsistency, which can be resolved by manually updating the task status.
  • To verify the issue, check the tasks-audit.txt and tasks-running.json artifacts to confirm the presence of stale running tasks.
  • To mitigate the issue, try manually updating the task_runs table in the ~/.openclaw/tasks/runs.sqlite database to set the status of stale entries to 'failed', as described in the local workaround.
  • After applying the workaround, verify that the task ledger is updated correctly by running openclaw tasks audit and checking for any remaining errors.

Example

UPDATE task_runs SET status = 'failed' WHERE status = 'running' AND ...;  // update stale entries

Note: The exact SQL query will depend on the specific database schema and the criteria for identifying stale entries.

Notes

  • The local workaround provided in the issue description suggests that manually updating the task status can resolve the issue, but this may not be a permanent fix and may need to be repeated if the issue recurs.
  • The fact that cancelling a subagent task returns "Subagent task not found" while cancelling the paired cli task returns "Task runtime does not support cancellation yet" suggests a potential issue with the task runtime or the cancellation mechanism.

Recommendation

Apply workaround: Manually update the task status in the database to 'failed' for stale entries, as this has been shown to resolve the issue in the local workaround.

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