openclaw - ✅(Solved) Fix [Bug] TaskFlow inconsistent_timestamps: endedAt earlier than updatedAt on succeeded tasks [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#78019Fetched 2026-05-06 06:17:50
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
commented ×1cross-referenced ×1

openclaw tasks audit reports 7 warnings with inconsistent_timestamps on succeeded TaskFlows. All affected tasks completed successfully, but endedAt is recorded earlier than updatedAt.

Error Message

TaskFlow warn inconsistent_timestamps succeeded endedAt is earlier than updatedAt

Root Cause

openclaw tasks audit reports 7 warnings with inconsistent_timestamps on succeeded TaskFlows. All affected tasks completed successfully, but endedAt is recorded earlier than updatedAt.

Fix Action

Fixed

PR fix notes

PR #78021: fix(taskflow): ensure endedAt >= updatedAt in finishFlow and failFlow

Description (problem / solution / changelog)

Problem

openclaw tasks audit reports inconsistent_timestamps warnings on succeeded TaskFlows: endedAt is earlier than updatedAt.

Root Cause

finishFlow and failFlow in task-flow-registry.ts accept caller-supplied endedAt and updatedAt without validating their order. If the caller passes endedAt < updatedAt, the invalid state is written directly to the record.

Fix

Add Math.max(endedAt, updatedAt) guard in both finishFlow and failFlow before writing to the patch, ensuring endedAt is never earlier than updatedAt.

const endedAt = params.endedAt ?? params.updatedAt ?? Date.now();
const updatedAt = params.updatedAt ?? endedAt;
const safeEndedAt = Math.max(endedAt, updatedAt);

Closes #78019

Real behavior proof

Behavior addressed

openclaw tasks audit reports inconsistent_timestamps on succeeded TaskFlows where endedAt is earlier than updatedAt. Observed 7 warnings on OpenClaw 2026.5.4.

Real environment tested

  • OpenClaw 2026.5.4 (325df3e)
  • macOS 26.4.1 (arm64)
  • Node.js 24.15.0

Exact steps or command run after the patch

node scripts/test-projects.mjs src/tasks/task-flow-registry.test.ts

Evidence

[test] starting test/vitest/vitest.tasks.config.ts

 RUN  v4.1.5 /private/tmp/openclaw-pr

 ✓  tasks  src/tasks/task-flow-registry.test.ts (6 tests) 64ms

 Test Files  1 passed (1)
      Tests  6 passed (6)
   Start at  03:09:57
   Duration  757ms (transform 429ms, setup 495ms, import 76ms, tests 64ms, environment 0ms)

[test] passed 1 Vitest shard in 4.45s

New test case added: verifies that finishFlow and failFlow produce endedAt >= updatedAt when caller passes endedAt < updatedAt.

Observed result after the patch

All 6 tests pass including the new regression test. The Math.max guard ensures safeEndedAt >= updatedAt before writing to the record.

What was not tested

End-to-end verification that openclaw tasks audit reports 0 warnings after patched build is deployed — this requires a live gateway running the patched version.

Changed files

  • src/commands/doctor-memory-search.ts (modified, +4/-1)
  • src/tasks/task-flow-registry.ts (modified, +8/-4)

Code Example

openclaw tasks audit

---

Tasks audit: 7 findings · 0 errors · 7 warnings
Task findings: 0 · TaskFlow findings: 7
Scope     Severity  Code                     Status     Detail
TaskFlow  warn      inconsistent_timestamps  succeeded  endedAt is earlier than updatedAt
RAW_BUFFERClick to expand / collapse

Summary

openclaw tasks audit reports 7 warnings with inconsistent_timestamps on succeeded TaskFlows. All affected tasks completed successfully, but endedAt is recorded earlier than updatedAt.

Environment

  • OpenClaw: 2026.5.4 (325df3e)
  • macOS: 26.4.1 (arm64)
  • Node.js: 24.15.0

Steps to Reproduce

openclaw tasks audit

Output

Tasks audit: 7 findings · 0 errors · 7 warnings
Task findings: 0 · TaskFlow findings: 7
Scope     Severity  Code                     Status     Detail
TaskFlow  warn      inconsistent_timestamps  succeeded  endedAt is earlier than updatedAt

(7 TaskFlow entries, all succeeded, all fresh)

Expected Behavior

endedAt should be >= updatedAt for completed TaskFlows.

Actual Behavior

endedAt is earlier than updatedAt, suggesting the timestamp is written before a final state update occurs after task completion.

Impact

No functional impact observed. Tasks complete successfully. Warning noise in audit output.

extent analysis

TL;DR

The issue can be addressed by ensuring that the endedAt timestamp is updated after the final state update occurs, potentially by modifying the task completion logic.

Guidance

  • Review the task completion logic to verify that endedAt is updated after the final state update, which may involve reordering operations or introducing a delay.
  • Investigate the timestamp update mechanism to determine why endedAt is being recorded earlier than updatedAt, potentially due to asynchronous updates or caching issues.
  • Consider adding logging or debugging statements to track the timestamp updates and verify the order of operations during task completion.
  • Evaluate the potential impact of this issue on other parts of the system, despite no functional impact being observed currently.

Example

No code snippet is provided due to lack of specific implementation details in the issue.

Notes

The root cause of the issue is unclear, and the provided information does not point to a specific fix. The suggestions are based on the expected behavior and actual behavior described in the issue.

Recommendation

Apply workaround: Modify the task completion logic to ensure endedAt is updated after the final state update, as this is the most direct approach to addressing the inconsistent timestamps.

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 [Bug] TaskFlow inconsistent_timestamps: endedAt earlier than updatedAt on succeeded tasks [1 pull requests, 1 comments, 2 participants]