Skip to content

Cron jobs not migrated from JSON file to SQLite on update (2026.6.1+) #91435

Closed

Description

@rglover666

After updating OpenClaw (from ~2026.5.x to 2026.6.1), all cron jobs disappear from the cron list API. The old JSON file at ~/.openclaw/cron/jobs.json still exists with all job configurations intact, but the new SQLite-backed store at ~/.openclaw/state/openclaw.sqlite has an empty cron_jobs table. Jobs are effectively lost despite the config file persisting on disk.

Root cause

OpenClaw 2026.6.1 switched cron job storage from a plain JSON file (~/.openclaw/cron/jobs.json) to a SQLite database (~/.openclaw/state/openclaw.sqlite, table cron_jobs). The upgrade path does not migrate the JSON contents into the new database — the cron_jobs table exists but is empty after update.

Evidence

Before update:

  • Cron jobs stored in ~/.openclaw/cron/jobs.json (text file)
  • Runtime state in ~/.openclaw/cron/jobs-state.json

After update (2026.6.1):

  • ~/.openclaw/cron/jobs.json still exists with all job configs (unmigrated)
  • ~/.openclaw/state/openclaw.sqlite has a cron_jobs table — 0 rows
  • cron list API returns empty
  • openclaw cron list CLI returns "No cron jobs."

Steps to reproduce

  1. Create cron jobs via cron add (stores to ~/.openclaw/cron/jobs.json)
  2. Update OpenClaw to 2026.6.1+
  3. Restart gateway
  4. Run cron list — jobs are gone
  5. Check ~/.openclaw/cron/jobs.json — jobs are still there
  6. Check ~/.openclaw/state/openclaw.sqlite → cron_jobs table — empty

Affected versions

2026.6.1+ (transition to SQLite-backed cron store)

Suggested fix

On startup (or during upgrade), the cron store loader should detect if the SQLite cron_jobs table is empty but ~/.openclaw/cron/jobs.json exists with job data, and import those jobs into the database. Alternatively, maintain backward compatibility by checking the JSON file when the SQLite store is empty.

Workaround (manual)

Recreate jobs via cron add using the config data from ~/.openclaw/cron/jobs.json.

Activity

  1. clawsweeper commented on Jun 8, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

    Current main already fixes the reported cron JSON-to-SQLite upgrade gap through the shared CLI/doctor preflight migration path; the fix is main-only after v2026.6.1 and has focused regression coverage.

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review details

    Best possible solution:

    Keep the current doctor/preflight import path on main and ship it in the next release; avoid adding a steady-state runtime JSON fallback reader.

    Do we have a high-confidence way to reproduce the issue?

    Yes. The high-confidence source path is a v2026.6.1 install with legacy cron JSON rows and empty SQLite cron rows; current main adds regression coverage for importing those legacy rows into SQLite.

    Is this the best way to solve the issue?

    Yes. The current fix uses the shared CLI/doctor preflight migration path, which matches the repository policy that legacy state migration belongs in doctor/preflight instead of runtime fallback readers.

    Security review:

    Security review: Non-PR issue triage; no patch security review applies.

    AGENTS.md: found and applied where relevant.

    What I checked:

    Likely related people:

    • Vincent Koc: Commit 66b91d7 added the current CLI/doctor preflight cron migration path and the regression tests for importing legacy JSON jobs into SQLite. (role: recent area contributor; confidence: high; commits: 66b91d78feb3; files: src/cli/program/config-guard.ts, src/commands/doctor-config-preflight.ts, src/commands/doctor/cron/index.ts)

    Codex review notes: model gpt-5.5, reasoning high; reviewed against da401341b685; fix evidence: commit 66b91d78feb3, main fix timestamp 2026-06-07T12:45:43+02:00.

  2. added
    P0Emergency: data loss, security bypass, crash loop, or unusable core runtime.
    impact:data-lossCan lose, corrupt, or silently drop user/session/config data.
    on Jun 8, 2026
  3. locked as resolved and limited conversation to collaborators on Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Emergency: data loss, security bypass, crash loop, or unusable core runtime.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions