openclaw - ✅(Solved) Fix tasks audit emits large numbers of false inconsistent_timestamps warnings when startedAt < createdAt by a few ms [1 pull requests, 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#72035Fetched 2026-04-27 05:35:49
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
closed ×1commented ×1cross-referenced ×1

openclaw tasks audit reports large numbers of inconsistent_timestamps warnings where startedAt is earlier than createdAt, even though the tasks appear to have completed normally. On this host the warning count was 954, with 953 warnings of this form and no corresponding operational failure.

Error Message

// warn: inconsistent_timestamps

Root Cause

openclaw tasks audit reports large numbers of inconsistent_timestamps warnings where startedAt is earlier than createdAt, even though the tasks appear to have completed normally. On this host the warning count was 954, with 953 warnings of this form and no corresponding operational failure.

Fix Action

Fixed

PR fix notes

PR #72063: fix(tasks): add jitter tolerance to audit timestamp checks

Description (problem / solution / changelog)

Summary

openclaw tasks audit emits large numbers of false inconsistent_timestamps warnings when startedAt precedes createdAt by only a few milliseconds (5–24 ms observed). These inversions are harmless timestamp jitter from separate Date.now() calls during task creation/start transitions.

Changes

  • task-registry.audit.ts: Add a TIMESTAMP_JITTER_MS = 100 tolerance constant. Timestamp ordering checks now compare the delta against the tolerance rather than using strict < — inversions under 100 ms are silently ignored.
  • task-flow-registry.audit.ts: Apply the same tolerance to the flow-level timestamp checks for consistency.
  • task-registry.audit.test.ts: Three new unit tests:
    • Within-tolerance jitter (24 ms) → no warning
    • Beyond-tolerance inversion (500 ms) → warning fires
    • endedAt vs startedAt jitter → no warning

Why 100 ms?

Reported deltas range from 5–24 ms. A 100 ms threshold gives ~4× headroom over observed jitter while still catching genuine timestamp corruption (which would typically be seconds/minutes off). The constant is named and documented for easy adjustment.

Before / After

Host with 954 tasksBeforeAfter
inconsistent_timestamps warnings9540 (all deltas < 100 ms)

Closes #72035

Changed files

  • src/tasks/task-flow-registry.audit.ts (modified, +10/-3)
  • src/tasks/task-registry.audit.test.ts (modified, +62/-0)
  • src/tasks/task-registry.audit.ts (modified, +10/-2)

Code Example

if (task.startedAt && task.startedAt < task.createdAt) {
  // warn: inconsistent_timestamps
  // detail: "startedAt is earlier than createdAt"
}

---

const createdAt = params.createdAt ?? Date.now();
RAW_BUFFERClick to expand / collapse

Summary

openclaw tasks audit reports large numbers of inconsistent_timestamps warnings where startedAt is earlier than createdAt, even though the tasks appear to have completed normally. On this host the warning count was 954, with 953 warnings of this form and no corresponding operational failure.

Version / environment

  • OpenClaw: 2026.4.24 (cbcfdf6)
  • Host OS: Ubuntu 22.04.3 LTS
  • Runtime observed from local installed distribution under ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.24-...

What I observed

openclaw tasks audit --json reported:

  • warnings: 954
  • byCode.inconsistent_timestamps: 954
  • warning detail: startedAt is earlier than createdAt

Representative rows from ~/.openclaw/tasks/runs.sqlite:

  • task 7e2001c0-cada-4682-bd92-e3e1e3745f34: created_at=1777078430262, started_at=1777078430238 (delta 24 ms)
  • task 347f9eb9-7be2-4e95-a4a6-2b8b00fc3fda: created_at=1776998259428, started_at=1776998259410 (delta 18 ms)
  • task 18a6b4fa-d92a-4763-9e42-bb39d06a6f31: created_at=1776896555577, started_at=1776896555572 (delta 5 ms)

These tasks were otherwise terminal/succeeded and not obviously broken.

Relevant code paths

The local installed bundle appears to do two things that make this warning easy to trigger:

  1. The audit logic flags any strict inversion with no tolerance:
if (task.startedAt && task.startedAt < task.createdAt) {
  // warn: inconsistent_timestamps
  // detail: "startedAt is earlier than createdAt"
}
  1. Task timestamps appear to come from separate Date.now() calls / fallback paths. One observed snippet from the local installed bundle:
const createdAt = params.createdAt ?? Date.now();

This makes it plausible for startedAt and createdAt to drift by a few milliseconds if they are sampled independently during task creation / start transitions.

Why this seems like a bug

This produces a large volume of audit noise for tasks that are not operationally unhealthy. The audit output makes the task store look broken even when the issue appears to be timestamp sampling/ordering jitter.

Suggested fixes

Any of these would likely solve it:

  1. Use a shared nowMs when creating/updating a task row so createdAt and startedAt are internally ordered.
  2. Normalize ordering when both values exist (for example clamp createdAt <= startedAt when appropriate).
  3. Add a small tolerance in audit (for example ignore startedAt < createdAt when the delta is under a small threshold like 10-50 ms).

My preference would be (1), possibly with (3) as belt-and-braces.

Impact

Low severity, but high annoyance/noise. On this host it drowned the task audit in false-positive warnings and made it harder to spot the one genuinely actionable task issue.

extent analysis

TL;DR

Implementing a shared timestamp or adding a small tolerance to the audit logic can likely resolve the inconsistent_timestamps warnings.

Guidance

  • Review the task creation logic to ensure that createdAt and startedAt timestamps are generated in a way that maintains their chronological order, potentially by using a shared nowMs value.
  • Consider adding a small tolerance (e.g., 10-50 ms) to the audit logic to ignore minor timestamp inversions that do not indicate actual operational issues.
  • Evaluate the impact of normalizing the ordering of createdAt and startedAt when both values exist, to prevent false-positive warnings.
  • Assess the trade-offs between the suggested fixes, including using a shared timestamp, normalizing ordering, or adding a tolerance, to determine the most appropriate solution.

Example

const nowMs = Date.now();
const createdAt = nowMs;
// Later, when starting the task
const startedAt = Math.max(nowMs, Date.now()); // Ensure startedAt is not earlier than createdAt

Notes

The choice of fix may depend on the specific requirements and constraints of the OpenClaw task management system, including performance considerations and the need to maintain accurate task timestamps.

Recommendation

Apply workaround by adding a small tolerance to the audit logic, as it is a relatively simple and non-invasive change that can effectively reduce the noise from false-positive warnings.

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 - ✅(Solved) Fix tasks audit emits large numbers of false inconsistent_timestamps warnings when startedAt < createdAt by a few ms [1 pull requests, 1 comments, 2 participants]