Skip to content

After 'openclaw update', new gateway refuses to start due to schema_meta checkpoint mismatch with no escape hatch #107223

Closed

Description

@foxrainhy

Bug

After a successful openclaw update to a new version (e.g. 2026.7.1-beta.5 → 2026.7.1), the new gateway CLI refuses to start, logs:

OpenClaw startup migrations did not complete cleanly; refusing to report the gateway ready.

In dist/startup-migration-checkpoint-DeoeCGYd.js, needsStartupMigrationCheckpoint({env}) compares schema_meta.app_version for meta_key='startup-migrations' against the current VERSION. If they don't match, the gateway runs the migration suite on every restart. The "Skipped" warnings from the migration suite (because legacy migration sidecars already exist as .migrated archives) trigger process.exit(1) — even though the gateway is otherwise fully functional.

Reproduction

  1. Running 2026.7.1-beta.5 successfully
  2. openclaw update upgrades core to 2026.7.1 (npm view for plugins fails — see related issue)
  3. New gateway restarts automatically as part of update flow
  4. Output: Gateway restart failed after 13s: service stayed stopped and port 19999 stayed free. lastExit=1
  5. openclaw gateway status --deep shows: Runtime: stopped, lastExit=1, reason=1

Why it happens

recordSuccessfulStartupMigrations() only runs after the startupMigrationCheckpoint JSON path records a checkpoint. If migrations are skipped (with warnings) instead of completing, no checkpoint is written, and the next gateway start hits the same dead loop:

  1. needsStartupMigrationCheckpoint() returns true (no row, or old app_version)
  2. Migration code tries to run, hits conflicts, skips
  3. Throws Error("OpenClaw startup migrations did not complete cleanly...")
  4. process.exit(1) → systemd enters failed state → restart loop disallowed

doctor --fix enters the same path and fails the same way.

Current escape hatch

A user has to manually find the SQLite database, locate the row, and update it via raw SQL:

INSERT INTO schema_meta (meta_key, role, schema_version, agent_id, app_version, created_at, updated_at)
VALUES ('startup-migrations', 'global', 1, NULL, '2026.7.1', <now_ms>, <now_ms>)
ON CONFLICT(meta_key) DO UPDATE SET app_version='2026.7.1', updated_at=<now_ms>;

This is undocumented and not sustainable for users who don't read OpenClaw internals.

Suggested fixes (pick one or more)

  1. Allow override env var analogous to existing OPENCLAW_ALLOW_OLDER_BINARY_DESTRUCTIVE_ACTIONS:

    OPENCLAW_ALLOW_MIGRATION_CHECKPOINT_OVERRIDE=1 openclaw gateway start

    Skips the comparison check.

  2. Auto-write the checkpoint when the migration suite completes or all migrations are already archived (skip + warnings counts as "nothing to do, we're current").

  3. doctor --fix should set the checkpoint itself when no further migration actions remain.

  4. Recovery mechanism when the checkpoint row is missing entirely: assume "nothing to migrate" and proceed.

  5. Better diagnostic at startup — when migrations are "Skipped" because of sidecar archive presence, log: "checkpoint mismatch is informational, not blocking" instead of process.exit(1).

Impact

Reported reproducing on every beta → stable OpenClaw update since 2026.7.1-beta.5. After upgrading, the gateway is dead until the user edits SQLite manually, which breaks the user experience of openclaw update (an end-user command that should keep the user's gateway running).

Environment

Activity

  1. added
    P0Emergency: data loss, security bypass, crash loop, or unusable core runtime.
    impact:crash-loopCrash, hang, restart loop, or process-level availability failure.
    impact:ux-release-blockerA non-technical user is blocked without terminal, logs, config, or support.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on Jul 14, 2026
  2. clawsweeper commented on Jul 14, 2026

    @clawsweeper
    Contributor

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

    Current main resolves the reported archive-residue checkpoint loop: non-blocking migration residue is recorded as a notice and checkpoints successfully, while real unresolved conflicts remain fail-closed.

    Possible regression — probable (reproduction; failure trace). No predecessor PR is attributed.

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

    Review details

    Best possible solution:

    Keep the current notice-versus-warning classification: archive already-covered residue and checkpoint it, while preserving refusal for ambiguous or unsafe migration conflicts.

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

    No current-main reproduction of the reported archive-residue loop was established: current source classifies covered archive collisions as notices and focused regression coverage records the checkpoint.

    Is this the best way to solve the issue?

    Yes. Current main fixes the owner boundary by classifying safely archived residue as non-blocking rather than adding a global override that could bypass real migration conflicts.

    Security review:

    Security review: This issue has no proposed patch requiring a security review.

    AGENTS.md: found and applied where relevant.

    What I checked:

    Likely related people:

    • steipete: Authored the convergence fix and subsequent startup-migration lease hardening. (role: recent startup-migration contributor; confidence: high; commits: 4da0eb19c570, 7dc4dc83fe8b; files: src/commands/doctor-config-preflight.ts, src/infra/startup-migration-checkpoint.ts)
    • Ayaan Zaidi: Authored the earlier archive-collision convergence work used by the legacy migration path. (role: archive-collision contributor; confidence: medium; commits: 474d660137d0; files: src/infra/state-migrations.plugin-state.ts, src/infra/state-migrations.state-dir.ts)
    • Sally O'Malley: History identifies the original container-upgrade readiness work that established this migration boundary. (role: original readiness-gate contributor; confidence: medium; commits: b81666ca6af2; files: src/commands/doctor-config-preflight.ts, src/infra/startup-migration-checkpoint.ts)

    Codex review notes: model internal, reasoning high; reviewed against 5a643e354310; fix evidence: commit 4da0eb19c570, main fix timestamp 2026-07-13T20:05:24-07:00.

  3. jhazan-jpg commented on Jul 17, 2026

    @jhazan-jpg

    This SQL worked for me. sqlite DB was in .openclaw/state/openclaw.sqlite

  4. added
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.
    and removed
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    on Jul 31, 2026
  5. added
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:not-repro-on-mainClawSweeper found high-confidence evidence that this issue no longer reproduces on main.
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    and removed
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    on Aug 12, 2026
  6. self-assigned this
    on Aug 13, 2026
  7. vincentkoc commented on Aug 13, 2026

    @vincentkoc
    Member

    Fixed by #107002 in commit 4da0eb1.

    The repair makes safely archived migration residue non-blocking and records the successful startup-migration checkpoint, while unresolved migration conflicts remain fail-closed. The fix is present on current main and shipped in v2026.7.2-beta.1 and later beta releases. The stable v2026.7.1, v2026.7.1-1, and v2026.7.1-2 releases predate the fix and do not contain it.

    Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0Emergency: data loss, security bypass, crash loop, or unusable core runtime.clawsweeper:not-repro-on-mainClawSweeper found high-confidence evidence that this issue no longer reproduces on main.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:ux-release-blockerA non-technical user is blocked without terminal, logs, config, or support.issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions