openclaw - 💡(How to fix) Fix `tasks maintenance --apply` is a no-op for `lost` (backing-session-missing) and `stale_running` task records [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#72884Fetched 2026-04-28 06:30:54
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

openclaw tasks maintenance --apply reports 0 reconcile · 0 recovered · 0 cleanup stamp · 0 prune even when openclaw tasks audit reports lost and stale_running errors. These records are exactly what an operator would expect maintenance to clean.

Error Message

"severity": "error", Without this, the audit count grows unboundedly over time and operators have to bypass the supported tooling (direct DB/file edits) to reset the picture, or live with audit reports showing growing error counts that don't reflect real failures.

Root Cause

openclaw tasks maintenance --apply reports 0 reconcile · 0 recovered · 0 cleanup stamp · 0 prune even when openclaw tasks audit reports lost and stale_running errors. These records are exactly what an operator would expect maintenance to clean.

Code Example

$ openclaw tasks audit
... 22 errors (20× lost, 2× stale_running), 1204 warnings (all inconsistent_timestamps)

$ openclaw tasks maintenance --apply
Tasks maintenance (applied): tasks 0 reconcile · 0 recovered · 0 cleanup stamp · 0 prune; task-flows 0 reconcile · 0 prune
Tasks health after apply: 22 audit errors · 1204 audit warnings  (unchanged)

---

{
  "kind": "task",
  "severity": "error",
  "code": "lost",
  "detail": "backing session missing",
  "ageMs": 406998939,
  "status": "lost",
  ...
  "task": {"runtime": "cron", ...}
}
RAW_BUFFERClick to expand / collapse

Summary

openclaw tasks maintenance --apply reports 0 reconcile · 0 recovered · 0 cleanup stamp · 0 prune even when openclaw tasks audit reports lost and stale_running errors. These records are exactly what an operator would expect maintenance to clean.

Reproduction

On a long-lived install with the default 5-day session cleanup running:

$ openclaw tasks audit
... 22 errors (20× lost, 2× stale_running), 1204 warnings (all inconsistent_timestamps)

$ openclaw tasks maintenance --apply
Tasks maintenance (applied): tasks 0 reconcile · 0 recovered · 0 cleanup stamp · 0 prune; task-flows 0 reconcile · 0 prune
Tasks health after apply: 22 audit errors · 1204 audit warnings  (unchanged)

Sample lost-record audit detail:

{
  "kind": "task",
  "severity": "error",
  "code": "lost",
  "detail": "backing session missing",
  "ageMs": 406998939,
  "status": "lost",
  ...
  "task": {"runtime": "cron", ...}
}

These are tasks whose backing session JSONL was archived/removed by the 5-day Session & Cache Cleanup cron, but the task record itself persists indefinitely. With heavy cron usage the task store accumulates (this install has 2,556 task records; expected steady-state would be much smaller).

Suggested fix

  • tasks maintenance --apply should prune (or at least mark and prune after a grace period) task records whose backing session is gone and whose status is lost.
  • inconsistent_timestamps warnings (startedAt < createdAt — almost always benign clock skew) could be auto-corrected by clamping startedAt to createdAt when the delta is below a threshold.

Why it matters

Without this, the audit count grows unboundedly over time and operators have to bypass the supported tooling (direct DB/file edits) to reset the picture, or live with audit reports showing growing error counts that don't reflect real failures.

Environment

  • OpenClaw 2026.4.24 (cbcfdf6)
  • Darwin 25.3.0 / arm64 / node v25.9.0

extent analysis

TL;DR

The openclaw tasks maintenance --apply command should be modified to prune task records with a lost status and missing backing session.

Guidance

  • Review the openclaw tasks maintenance --apply command to ensure it correctly handles task records with a lost status and missing backing session.
  • Verify that the command prunes or marks these records for pruning after a grace period to prevent accumulation.
  • Investigate the inconsistent_timestamps warnings and consider auto-correcting them by clamping startedAt to createdAt when the delta is below a threshold.
  • Check the task store size and expected steady-state to determine the effectiveness of the maintenance command.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The issue is specific to the OpenClaw 2026.4.24 version, and the suggested fix may not apply to other versions. The inconsistent_timestamps warnings may not be critical, but auto-correcting them could improve the overall health of the task store.

Recommendation

Apply workaround: Modify the openclaw tasks maintenance --apply command to prune task records with a lost status and missing backing session to prevent accumulation and ensure accurate audit reports.

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