Skip to content

stale_running tasks remain in ledger and cannot be cleared #60892

Description

@Gernspi

Full logs + artifacts: https://gist.github.com/Gernspi/98ea2447e9502fff2ab64e89cdcdbecf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions