openclaw - 💡(How to fix) Fix [Bug]: tasks cancel not supported + tasks maintenance --apply prunes 0 stuck running tasks [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#61610Fetched 2026-04-08 02:56:53
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

openclaw tasks cancel returns "Task runtime does not support cancellation yet." and openclaw tasks maintenance --apply prunes 0 stuck tasks. Full gateway stop + start also fails to clear these persisted task records.

I have 6 background tasks stuck in running state that cannot be recovered.

Root Cause

openclaw tasks cancel returns "Task runtime does not support cancellation yet." and openclaw tasks maintenance --apply prunes 0 stuck tasks. Full gateway stop + start also fails to clear these persisted task records.

I have 6 background tasks stuck in running state that cannot be recovered.

Code Example

openclaw tasks cancel <task-id>
# -> Task runtime does not support cancellation yet.

openclaw tasks maintenance --apply
# -> tasks 0 reconcile, 0 cleanup stamp, 0 prune

openclaw gateway stop && openclaw gateway start
openclaw tasks list --status running
# -> Still 6 running tasks (persisted to disk)
RAW_BUFFERClick to expand / collapse

Summary

openclaw tasks cancel returns "Task runtime does not support cancellation yet." and openclaw tasks maintenance --apply prunes 0 stuck tasks. Full gateway stop + start also fails to clear these persisted task records.

I have 6 background tasks stuck in running state that cannot be recovered.

Steps to reproduce

  1. Run cron jobs with sessionTarget: "isolated" using rate-limited free-tier models
  2. Provider returns 401/403/429 — tasks enter running state but never resolve
  3. Attempt cleanup:
openclaw tasks cancel <task-id>
# -> Task runtime does not support cancellation yet.

openclaw tasks maintenance --apply
# -> tasks 0 reconcile, 0 cleanup stamp, 0 prune

openclaw gateway stop && openclaw gateway start
openclaw tasks list --status running
# -> Still 6 running tasks (persisted to disk)

Expected behavior

  • tasks cancel transitions task to terminal state
  • tasks maintenance --apply prunes stale running tasks
  • Gateway stop + start clears in-flight task state

Actual behavior

6 zombie tasks survive all recovery attempts:

  • 4 x weekly-evolution (deleted cron, orphaned tasks, age 1-2d)
  • 1 x memory-extraction (active cron, stuck 2d+)
  • 1 x daily-openclaw-backup (active cron, stuck 2d+)

Environment

  • OpenClaw: 2026.4.2
  • OS: macOS 26.3.1 (ARM64)
  • Node.js: v22.22.1
  • Install: npm global

Suggested fixes

  1. Implement tasks cancel for cron runtime tasks — even just updating the database record to a terminal state would suffice.
  2. Stale-running pruning in tasks maintenance --apply — auto-transition tasks running > 2× their timeoutSeconds to timed_out.
  3. Orphan cleanup on cron deletion — when a cron is deleted, transition all child tasks with sourceId matching the deleted cron to cancelled.
  4. Gateway stop flush — clear in-flight task state on shutdown rather than persisting running for tasks that can't resume.

Related issues

  • #48488 — Lane queue has no task-level timeout, hung promises permanently block session lanes
  • #10934 — Cron jobs stuck running marker prevents automatic execution
  • #40243 — ACP session stays state: "running" after agent process dies

extent analysis

TL;DR

Implementing a mechanism to cancel or prune stuck tasks, such as updating the database record to a terminal state or auto-transitioning tasks to timed_out, is likely to resolve the issue.

Guidance

  • Investigate implementing tasks cancel for cron runtime tasks to update the database record to a terminal state.
  • Consider adding stale-running pruning in tasks maintenance --apply to auto-transition tasks running > 2× their timeoutSeconds to timed_out.
  • Review the possibility of implementing orphan cleanup on cron deletion to transition child tasks to cancelled.
  • Examine the gateway stop flush mechanism to clear in-flight task state on shutdown.

Example

No specific code snippet is provided, but an example of how to implement tasks cancel could involve updating the task's status in the database:

// Pseudo-code example
async function cancelTask(taskId) {
  const task = await getTaskFromDatabase(taskId);
  task.status = 'cancelled';
  await updateTaskInDatabase(task);
}

Notes

The provided issue lacks information about the specific database schema and task management implementation, making it difficult to provide a more detailed solution.

Recommendation

Apply a workaround by implementing a custom task cancellation mechanism, such as a script that updates the task status in the database, until a permanent fix is available. This is because the current implementation does not support task cancellation, and a workaround is necessary to resolve the issue.

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

  • tasks cancel transitions task to terminal state
  • tasks maintenance --apply prunes stale running tasks
  • Gateway stop + start clears in-flight task state

Still need to ship something?

×6

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

Back to top recommendations

TRENDING