Skip to content

doctor: false positive for legacy cron payload kind normalization on already-normalized jobs #44054

@amzzzzzzz

Description

@amzzzzzzz

Summary

openclaw doctor reports that cron jobs "need payload kind normalization" even when ~/.openclaw/cron/jobs.json already stores payload.kind: "agentTurn" correctly.

This creates false urgency after upgrading to 2026.3.11 because the warning implies scheduled tasks may silently break, but the cron store appears already normalized.

Environment

  • OpenClaw: 2026.3.11
  • Install: Homebrew global npm install on macOS
  • Cron store path: ~/.openclaw/cron/jobs.json

Doctor output

◇  Cron

Legacy cron job storage detected at ~/.openclaw/cron/jobs.json.
- 14 jobs needs payload kind normalization
Repair with openclaw doctor --fix to normalize the store before the next scheduler run.

What I checked

I inspected ~/.openclaw/cron/jobs.json directly after running the suggested repair flow. All jobs already had normalized payload kinds like:

{
  "payload": {
    "kind": "agentTurn",
    "message": "...",
    "model": "haiku"
  }
}

I also tested the repair paths:

  • openclaw doctor --fix --non-interactive --yes
  • openclaw doctor --repair --yes

The warning still remained afterward.

Likely cause

From inspecting the built code, this looks like the legacy detector is lowercasing payload.kind and then treating already-correct camelCase values as legacy:

function normalizePayloadKind(payload) {
  const raw = typeof payload.kind === "string" ? payload.kind.trim().toLowerCase() : "";
  if (raw === "agentturn") {
    payload.kind = "agentTurn";
    return true;
  }
  if (raw === "systemevent") {
    payload.kind = "systemEvent";
    return true;
  }
  return false;
}

Because "agentTurn".toLowerCase() === "agentturn", the normalizer reports a mutation even when the stored value is already correct.

Expected behavior

If payload.kind is already agentTurn / systemEvent, doctor should not report legacy payload kind normalization as needed.

Actual behavior

Doctor reports a legacy cron normalization issue on already-normalized jobs, which makes the 2026.3.11 migration warning appear unresolved when it may already be fine.

Impact

  • unnecessary alarm after upgrading
  • users may distrust openclaw doctor
  • users may attempt risky manual cron edits even when no real migration is needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions