openclaw - ✅(Solved) Fix [Bug] v2026.3.11: doctor --fix loops false legacy cron payload kind normalization [1 pull requests, 2 comments, 3 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#43796Fetched 2026-04-08 00:18:00
View on GitHub
Comments
2
Participants
3
Timeline
10
Reactions
0
Author
Timeline (top)
referenced ×4commented ×2cross-referenced ×2closed ×1

openclaw doctor --fix reports legacy cron payload kind normalization repeatedly on v2026.3.11, even when all jobs already have canonical payload.kind values (agentTurn / systemEvent).

Root Cause

openclaw doctor --fix reports legacy cron payload kind normalization repeatedly on v2026.3.11, even when all jobs already have canonical payload.kind values (agentTurn / systemEvent).

Fix Action

Fix / Workaround

Local workaround (confirmed)

Patched local compiled files:

  • dist/update-runner-CsfK3SMx.js
  • dist/update-runner-CvNIx6g2.js

After patch:

  • openclaw doctor --fix no longer reports legacy kind normalization.
  • openclaw cron list --json shows canonical payload.kind values.

Notes

Workaround is local and gets overwritten on update/reinstall. A canonical source fix in release artifacts would be ideal.

PR fix notes

PR #43839: fix(cron): prevent false positive legacy payload kind normalization

Description (problem / solution / changelog)

Summary

Fixes #43796

The normalizePayloadKind function in store-migration.ts was returning true even when payload.kind was already in canonical form (agentTurn or systemEvent). This caused doctor --fix to repeatedly report legacy payload kind normalization on every run, even when no actual changes were needed.

Changes

  • Modified normalizePayloadKind to only return true when an actual value change occurs
  • Compares the current value with the target canonical value before assignment

Test Plan

  • All 64 cron-related test files pass (503 tests)
  • Verified fix prevents false positive mutation detection

Changed files

  • src/agents/sandbox/prune.ts (modified, +29/-1)
  • src/cron/store-migration.ts (modified, +4/-2)
RAW_BUFFERClick to expand / collapse

Summary

openclaw doctor --fix reports legacy cron payload kind normalization repeatedly on v2026.3.11, even when all jobs already have canonical payload.kind values (agentTurn / systemEvent).

Impact

  • False-positive health warning persists.
  • doctor --fix appears to "repair" the same jobs on every run.
  • Creates noise in post-upgrade validation and automation runbooks.

Environment

  • OpenClaw: v2026.3.11
  • Install path: global pnpm package ([email protected])
  • Gateway: local systemd service, loopback bind

Repro

  1. Ensure cron jobs already store canonical values (payload.kind == agentTurn or systemEvent).
  2. Run:
    • openclaw doctor --fix
  3. Run again:
    • openclaw doctor --fix

Actual

Legacy cron normalization warning reappears (same jobs), despite no semantic change needed.

Expected

Once kinds are canonical, doctor --fix should converge and stop reporting legacy kind normalization.

Root-cause analysis (local)

In the compiled update runner, normalizePayloadKind(payload) reports mutation when no effective change is required in some paths.

Local workaround (confirmed)

Patched local compiled files:

  • dist/update-runner-CsfK3SMx.js
  • dist/update-runner-CvNIx6g2.js

After patch:

  • openclaw doctor --fix no longer reports legacy kind normalization.
  • openclaw cron list --json shows canonical payload.kind values.

Notes

Workaround is local and gets overwritten on update/reinstall. A canonical source fix in release artifacts would be ideal.

extent analysis

Fix Summary

Update the normalizePayloadKind implementation so it only reports a mutation when the payload’s kind actually changes.
The current compiled runner treats a no‑op rewrite as a mutation, causing openclaw doctor --fix to keep “repairing” already‑canonical jobs.


Step‑by‑Step Fix Plan

1. Locate the source file

The function lives in the TypeScript source (not the compiled dist/ files).
Typical path in the repo:

src/cron/update-runner.ts   // or src/cron/normalize.ts

If you can’t find it, search:

grep -R "normalizePayloadKind" -n src

2. Correct the implementation

Replace the existing logic with a guard that returns the original payload unchanged and signals “no mutation” when the value is already canonical.

/**
 * Normalises legacy payload.kind values to the current canonical set.
 * Returns a tuple: [newPayload, mutated]
 */
export function normalizePayloadKind(
  payload: { kind: string; [k: string]: any }
): [typeof payload, boolean] {
  const LEGACY_MAP: Record<string, string> = {
    // add any legacy aliases you still support
    turn: "agentTurn",
    event: "systemEvent",
  };

  const current = payload.kind;
  const canonical = LEGACY_MAP[current] ?? current; // unchanged if already canonical

  // If the value is already canonical, do **not** mark as mutated
  if (canonical === current) {
    return [payload, false];
  }

  // Otherwise create a shallow‑copy with the corrected kind
  const updated = { ...payload, kind: canonical };
  return [updated, true];
}

Key points:

  • Never mutate the original object – always return a new object when a change is needed.
  • Return false for the mutated flag when no change occurs.

3. Re‑compile the package

From the project root:

# install dev deps if not present
pnpm install

# run the build that produces the dist/ files
pnpm run build   # usually maps to

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] v2026.3.11: doctor --fix loops false legacy cron payload kind normalization [1 pull requests, 2 comments, 3 participants]