openclaw - 💡(How to fix) Fix [Bug]: expired lost tasks survive past cleanupAfter; add tasks reap-orphans CLI [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#78169Fetched 2026-05-06 06:16:21
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Author
Timeline (top)
closed ×1commented ×1

Expired lost task records can remain in the durable task store after cleanupAfter passes.

At 2026-05-06T01:06:29Z, openclaw tasks list --status lost --json still showed 3 cron tasks whose cleanupAfter had already expired.

Root Cause

Expired lost task records can remain in the durable task store after cleanupAfter passes.

At 2026-05-06T01:06:29Z, openclaw tasks list --status lost --json still showed 3 cron tasks whose cleanupAfter had already expired.

Code Example

[
  {
    "taskId": "0828e588-39e9-497c-af9a-17a413ed9ab6",
    "label": "verify:cron-fix-stability-20260429",
    "cleanupAfter": "2026-05-06T01:06:04.460Z"
  },
  {
    "taskId": "4b06d99e-3915-4bdf-a675-448a64cd3e88",
    "label": "📮 PTT 多版面監控",
    "cleanupAfter": "2026-05-06T01:06:04.460Z"
  },
  {
    "taskId": "333b5537-94ac-4651-9054-30ac6c6f5e9a",
    "label": "usage-guard:model-routing",
    "cleanupAfter": "2026-05-06T01:06:04.460Z"
  }
]

---

{
  "maintenance": {
    "tasks": {
      "reconciled": 1,
      "recovered": 0,
      "cleanupStamped": 0,
      "pruned": 3
    }
  }
}

---

openclaw tasks reap-orphans
RAW_BUFFERClick to expand / collapse

Summary

Expired lost task records can remain in the durable task store after cleanupAfter passes.

At 2026-05-06T01:06:29Z, openclaw tasks list --status lost --json still showed 3 cron tasks whose cleanupAfter had already expired.

Environment

  • OpenClaw CLI: 2026.4.23
  • CLI warning on every run: Config was last written by a newer OpenClaw (2026.4.24); current version is 2026.4.23.

Repro

  1. Run openclaw tasks audit.
  2. Wait until a known batch of lost cron tasks passes cleanupAfter.
  3. Run:
    • openclaw tasks list --status lost --json
    • openclaw tasks maintenance --json

Actual

tasks list --status lost --json still showed these expired records:

[
  {
    "taskId": "0828e588-39e9-497c-af9a-17a413ed9ab6",
    "label": "verify:cron-fix-stability-20260429",
    "cleanupAfter": "2026-05-06T01:06:04.460Z"
  },
  {
    "taskId": "4b06d99e-3915-4bdf-a675-448a64cd3e88",
    "label": "📮 PTT 多版面監控",
    "cleanupAfter": "2026-05-06T01:06:04.460Z"
  },
  {
    "taskId": "333b5537-94ac-4651-9054-30ac6c6f5e9a",
    "label": "usage-guard:model-routing",
    "cleanupAfter": "2026-05-06T01:06:04.460Z"
  }
]

At the same time, openclaw tasks maintenance --json reported candidates that look prunable:

{
  "maintenance": {
    "tasks": {
      "reconciled": 1,
      "recovered": 0,
      "cleanupStamped": 0,
      "pruned": 3
    }
  }
}

So the system appears able to identify expired orphan tasks, but they were still present after cleanupAfter elapsed.

Expected

One of these should exist:

  1. Expired lost tasks are auto-pruned once cleanupAfter passes.
  2. A dedicated operator command exists, e.g. openclaw tasks reap-orphans, to sweep expired orphan / lost records deterministically.

Request

Please add an explicit CLI for this path, such as:

openclaw tasks reap-orphans

Suggested behavior:

  • prune lost tasks whose cleanupAfter <= now
  • print counts by status / runtime
  • support --json
  • optionally support --dry-run

This would make cron cleanup observable and give operators a targeted recovery path when auto-prune misses records.

extent analysis

TL;DR

The issue can be mitigated by adding a dedicated CLI command, such as openclaw tasks reap-orphans, to manually prune expired lost tasks.

Guidance

  • The system appears to identify expired orphan tasks but fails to auto-prune them, suggesting a potential issue with the automatic cleanup process.
  • Running openclaw tasks maintenance --json indicates that the system can identify prunable tasks, but they are not being removed.
  • Implementing a manual prune command, such as openclaw tasks reap-orphans, could provide a workaround for this issue.
  • The suggested command should prune lost tasks whose cleanupAfter timestamp has passed and provide output on the number of tasks pruned.

Example

openclaw tasks reap-orphans --json

This command would prune expired lost tasks and output the results in JSON format.

Notes

  • The issue may be related to the version mismatch between the OpenClaw CLI and the config file, but this is not directly addressed by the suggested workaround.
  • The openclaw tasks reap-orphans command would provide a targeted recovery path when auto-prune misses records.

Recommendation

Apply workaround: Implement the openclaw tasks reap-orphans command to manually prune expired lost tasks, as this provides a clear and targeted solution to the issue at hand.

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

openclaw - 💡(How to fix) Fix [Bug]: expired lost tasks survive past cleanupAfter; add tasks reap-orphans CLI [1 comments, 2 participants]