Skip to content

Cron state silently wiped during SQLite migration on upgrade to 2026.6.1 #90072

Closed

Description

@wlassalle724

Summary

Upgrading from 2026.5.28 to 2026.6.1 silently wiped 44 of 45 cron jobs during the SQLite migration. Only 1 job (the memory core memory_dreaming_promotion) survived. All other cron state was lost with no warning or backup prompt.

Reproduction

  1. Run OpenClaw 2026.5.28 with 45+ cron jobs configured
  2. Upgrade to 2026.6.1 via npm update -g openclaw
  3. Restart gateway
  4. Run openclaw cron list — only 1 job remains

Expected behavior

  • All existing cron jobs should be migrated to the new SQLite store
  • If migration cannot preserve jobs, a clear warning should be displayed
  • A pre-migration backup of cron state should be created automatically

Actual behavior

  • 44 of 45 cron jobs silently disappeared
  • No warning during upgrade
  • No automatic backup created
  • The cron table in openclaw.sqlite had only 1 row after upgrade
  • The old JSON/file-based cron state was not preserved

Environment

  • OpenClaw 2026.5.28 → 2026.6.1
  • macOS Sequoia 15.5, Apple Silicon M2, 16GB
  • 45 cron jobs (mix of systemEvent and isolated/agentTurn, neurometric/clawpack and openai/gpt-5.4 models)

Workaround / Recovery

We recovered by reconstructing all 43 cron jobs from session backup data. This required:

  1. Backing up sessions.json before the upgrade (which we did manually)
  2. Cross-referencing cron session keys with job definitions
  3. Recreating each job via openclaw cron add with the correct schedule, model, thinking, and delivery config

This process took approximately 2 hours of manual reconstruction.

Suggested fix

  1. The upgrade migration should migrate all existing cron jobs from the legacy format to SQLite
  2. If migration is not possible, a pre-flight check should warn the user and create a backup
  3. openclaw doctor should detect and report missing cron jobs after upgrade
  4. The migration should be idempotent — running it twice should not cause data loss

Activity

  1. clawsweeper commented on Jun 4, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 3, 2026, 8:34 PM ET / 00:34 UTC.

    Summary
    Codex review failed: timeout.

    Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Include the exact command, prompt, or workflow that triggered it.

    Next step
    Review did not complete, so no work-lane recommendation was made.

    Review details

    Best possible solution:

    Retry the Codex review after fixing the execution failure.

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

    Unclear. The review failed before ClawSweeper could establish a reproduction path.

    Is this the best way to solve the issue?

    Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

    AGENTS.md: unclear because the file could not be read completely.

    Remaining risk / open question:

    • No close action taken because the review did not complete.

    Codex review notes: model gpt-5.5, reasoning high; reviewed against c5d52bf2a715.

    Label changes

    Label changes:

    • add issue-rating: 🦪 silver shellfish: Current issue advisory state selects this label.
    • add clawsweeper:needs-info: Current issue advisory state selects this label.
    Evidence reviewed

    What I checked:

    • failure reason: timeout.
    • codex failure detail: Codex review failed for this issue: spawnSync codex ETIMEDOUT.
    • codex stdout: Per-item Codex failure; continuing with the rest of the shard.

    Likely related people:

    • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. wlassalle724 commented on Jun 4, 2026

    @wlassalle724
    Author

    Detailed reproduction steps

    Environment

    • macOS Sequoia 15.5, Apple Silicon M2, 16GB RAM
    • OpenClaw 2026.5.28 → 2026.6.1 upgrade via npm update -g openclaw
    • 45 cron jobs configured (mix of systemEvent and agentTurn, neurometric/clawpack and openai/gpt-5.4)

    Step-by-step reproduction

    1. Pre-upgrade state — verify cron jobs exist:
    $ openclaw cron list | wc -l
    47  # 45 jobs + 2 header lines
    
    1. Back up (manual, not automatic):
    cp ~/.openclaw/openclaw.json ~/.openclaw/backups/pre-2026.6.1/openclaw.json.bak
    cp ~/.openclaw/agents/main/sessions/sessions.json ~/.openclaw/backups/pre-2026.6.1/sessions.json.bak
    
    1. Upgrade:
    $ npm update -g openclaw
    $ openclaw --version
    2026.6.1
    
    1. Restart gateway:
    $ openclaw gateway restart
    
    1. Post-upgrade — check cron state:
    $ openclaw cron list | wc -l
    2  # header only — only 1 job survived (memory_dreaming_promotion)
    
    1. Verify SQLite migration:
    $ sqlite3 ~/.openclaw/state/openclaw.sqlite "SELECT count(*) FROM cron_jobs;"
    1
    

    What happened

    • The migration from JSON/file-based cron state to SQLite preserved only 1 of 45 jobs
    • The cron_jobs table in the new SQLite database had 1 row
    • No warning was displayed during upgrade
    • No automatic backup of cron state was created
    • The legacy cron state was not preserved or migrated

    Recovery process

    We recovered by:

    1. Cross-referencing session keys in the backed-up sessions.json with cron job definitions
    2. Reconstructing each job via openclaw cron add with correct schedule, model, thinking, and delivery config
    3. Deduplicating jobs that survived the migration AND were recreated (removed the stale originals)
    4. Final count: 43 unique jobs restored

    This took approximately 2 hours of manual reconstruction.

    Suggested fix

    1. The upgrade migration should migrate all existing cron jobs from legacy format to SQLite
    2. If migration is not possible, a pre-flight check should warn the user and create a backup
    3. openclaw doctor should detect and report missing cron jobs after upgrade
    4. The migration should be idempotent — running twice should not cause data loss
  3. cnah66 commented on Jun 4, 2026

    @cnah66

    I'm experiencing the exact same issue. After upgrading from 2026.5.28 to 2026.6.1, 15 out of 16 cron jobs were lost — only "Memory Dreaming Promotion" was loaded.

    The data files are intact: both jobs.json and jobs-state.json contain all 16 job records with valid IDs. The scheduler simply didn't read and register them during the upgrade. I manually re-added all 15 jobs via cron add and they're working now.

    Environment: Linux x64, running in Docker container.

  4. Countermarch commented on Jun 4, 2026

    @Countermarch
    Contributor

    Additional confirmation from another OpenClaw 2026.5.28 → 2026.6.1 (2e08f0f) npm-package upgrade on macOS. In this case the legacy cron JSON files were still present and intact, but the live Gateway/SQLite cron surface only exposed one post-update job.

    Observed state

    • Legacy <stateDir>/cron/jobs.json: 44 total jobs, 25 enabled jobs.
    • Legacy <stateDir>/cron/jobs-state.json: runtime state still exists for the missing legacy jobs.
    • Shared SQLite <stateDir>/state/openclaw.sqlite table cron_jobs: 1 row.
    • openclaw cron list --all --json: 1 job.
    • openclaw cron status --json: jobs: 1, while still reporting storePath: <stateDir>/cron/jobs.json.
    • openclaw cron show <legacy-job-id> for an existing enabled legacy job: Error: cron job not found.
    • openclaw cron runs --id <legacy-job-id> returned no entries even though the legacy state file had recent successful state.
    • openclaw doctor --lint --json did not report a cron-specific missing-migration warning; it only reported an unrelated core/doctor/legacy-state plugin install metadata warning on this machine.

    Representative command output:

    $ openclaw --version
    OpenClaw 2026.6.1 (2e08f0f)
    
    $ openclaw cron status --json
    {
      "enabled": true,
      "storePath": "<stateDir>/cron/jobs.json",
      "jobs": 1,
      "nextWakeAtMs": 1780626600000
    }
    
    $ openclaw cron show <legacy-job-id> --json
    Error: cron job not found: <legacy-job-id>
    
    $ sqlite count from <stateDir>/state/openclaw.sqlite
    cron_jobs 1
    
    $ legacy JSON count from <stateDir>/cron/jobs.json
    total 44
    enabled 25
    

    Representative legacy state for jobs invisible to live cron show still had normal state, for example:

    {"name":"Wiki Maintenance Sync","enabled":true,"expr":"0 4 * * *","lastRunStatus":"ok","lastRunAt":"2026-06-03T12:59:05-04:00","nextRunAt":"2026-06-04T04:00:00-04:00","consecutiveErrors":0}
    {"name":"Weekly Brain Skills Directory Refresh","enabled":true,"expr":"25 2 * * 2","lastRunStatus":"ok","lastRunAt":"2026-06-03T12:55:16-04:00","nextRunAt":"2026-06-09T02:25:00-04:00","consecutiveErrors":0}
    {"name":"LinkedIn Job Alert Triage","enabled":true,"expr":"*/30 6-22 * * *","lastRunStatus":"ok","lastRunAt":"2026-06-03T22:00:00-04:00","nextRunAt":"2026-06-03T22:30:00-04:00","consecutiveErrors":0}
    {"name":"Process meeting recordings","enabled":true,"expr":"*/30 8-22 * * *","lastRunStatus":"ok","lastRunAt":"2026-06-03T22:00:09-04:00","nextRunAt":"2026-06-03T22:30:00-04:00","consecutiveErrors":0}

    Recovery caution

    The installed CLI help suggests openclaw doctor --fix, and the installed doctor cron repair code appears able to normalize/migrate legacy cron storage. I did not run it automatically because restoring 25 enabled recurring jobs with stale nextRunAt values could immediately trigger side-effecting jobs. The repair path should document catch-up semantics, or offer a safe dry-run/disable-restored-jobs mode, before operators run it on production cron state.

    Redactions: replaced local usernames and absolute home paths with <stateDir> and omitted private cron prompts, delivery targets, personal account identifiers, and local artifact paths. Kept version, command names, table/count evidence, high-level job categories, schedule expressions, and status fields.

  5. haumanto commented on Jun 5, 2026

    @haumanto

    Another confirmation — and a one-command recovery that avoids the manual reconstruction described above.

    Repro (matches exactly): OpenClaw 2026.5.28 → 2026.6.1 (npm global), Linux/systemd. After the upgrade restart, openclaw cron list showed only the memory-core "Memory Dreaming Promotion" job (re-registered fresh by the plugin on boot). Both user-defined crons silently vanished from the live scheduler. openclaw cron status hung. memory-core logged managed dreaming cron could not be reconciled (cron service unavailable). The legacy ~/.openclaw/cron/jobs.json was fully intact — the scheduler just never imported it into the new SQLite store. Gateway + agents were otherwise healthy (model calls fine); only the cron subsystem was affected.

    Recovery — openclaw doctor --fix (no manual rebuild needed):

    openclaw doctor already detects this. Its Cron section reports:

    Legacy cron job storage detected at ~/.openclaw/cron/jobs.json.
    - N legacy JSON cron jobs will be imported into SQLite
    - legacy JSON cron run logs will be imported into SQLite
    

    Running openclaw doctor --fix --yes performed the import the upgrade had deferred: it migrated all legacy jobs into the SQLite store with their original IDs, schedules, delivery config, prompts, and run history intact, and archived the source to jobs.json.migrated. Once the scheduler had the full job set it recovered on its own and fired the overdue jobs on catch-up. Total fix time: under a minute, zero manual cron add.

    One gotcha worth flagging: the doctor import is asynchronous. Immediately after doctor --fix returned, cron list still showed only the dreaming job, so I wrongly concluded the import had failed and started manually re-adding jobs — which created duplicates. ~60s later the imported originals appeared and I removed the dupes. Wait and re-list before assuming the import failed.

    So the underlying defect is narrower than "state wiped": the data is never lost (jobs.json is preserved), and doctor does detect + repair it. The bug is that the 6.1 upgrade migrates plugin-state/tasks/flows automatically but does NOT run the cron→SQLite import, leaving user crons silently non-firing until doctor --fix is manually run. The fix is likely just: run the same cron import that doctor --fix performs as part of the upgrade's auto-migration step (or surface a loud post-upgrade warning pointing users at doctor --fix).

    Suggest the issue's "Suggested fix #3" (doctor should detect/report) is already satisfied — doctor detects it fine; the missing piece is making the upgrade either run the import or fail loudly.

  6. olveww-dot commented on Jun 5, 2026

    @olveww-dot

    Hi, I've submitted a fix for the related issue #90378 (which overlaps with this one). The PR is here: #90626

    The fix changes the default delivery mode from "announce" to "none" for isolated agentTurn cron jobs, which resolves the channel-required error on fresh installs. It also addresses the cron store migration path through the existing doctor repair flow.

    All tests pass locally. Happy to adjust anything based on maintainer feedback.

  7. locked as resolved and limited conversation to collaborators on Jun 8, 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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions