Repository navigation
Description
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
- Running 2026.7.1-beta.5 successfully
openclaw updateupgrades core to 2026.7.1 (npm view for plugins fails — see related issue)- New gateway restarts automatically as part of update flow
- Output:
Gateway restart failed after 13s: service stayed stopped and port 19999 stayed free. lastExit=1 openclaw gateway status --deepshows: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:
needsStartupMigrationCheckpoint()returnstrue(no row, or oldapp_version)- Migration code tries to run, hits conflicts, skips
- Throws
Error("OpenClaw startup migrations did not complete cleanly...") process.exit(1)→ systemd entersfailedstate → 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)
-
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.
-
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").
-
doctor --fixshould set the checkpoint itself when no further migration actions remain. -
Recovery mechanism when the checkpoint row is missing entirely: assume "nothing to migrate" and proceed.
-
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
- OpenClaw 2026.7.1 (2d2ddc4), source file:
dist/startup-migration-checkpoint-DeoeCGYd.js - Issue filed alongside normalizeNpmViewMetadata fails on array input from 'npm view --json', breaking all plugin updates #107222
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jul 14, 2026
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:
src/commands/doctor-config-preflight.ts:296, 5a643e354310)src/commands/doctor-config-preflight.ts:663, 5a643e354310)src/commands/doctor-config-preflight.state-migration.test.ts:703, 5a643e354310)src/infra/state-migrations.plugin-state.ts:216, 5a643e354310)src/commands/doctor-config-preflight.ts:721, 4da0eb19c570)src/commands/doctor-config-preflight.ts:725, 5a643e354310)Likely related people:
src/commands/doctor-config-preflight.ts,src/infra/startup-migration-checkpoint.ts)src/infra/state-migrations.plugin-state.ts,src/infra/state-migrations.state-dir.ts)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.
jhazan-jpg commentedon Jul 17, 2026
This SQL worked for me. sqlite DB was in .openclaw/state/openclaw.sqlite
vincentkoc commentedon Aug 13, 2026
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
mainand shipped inv2026.7.2-beta.1and later beta releases. The stablev2026.7.1,v2026.7.1-1, andv2026.7.1-2releases predate the fix and do not contain it.Closing as completed.