Skip to content

feat(node-host): migrate retired state before connecting - #115495

Merged
steipete merged 2 commits into
mainfrom
feat/node-host-startup-state-migrations
Jul 29, 2026
Merged

steipete merged 2 commits into
mainfrom
feat/node-host-startup-state-migrations

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where node hosts detect retired state stores, instruct the operator to run openclaw doctor --fix, and then fail or log forever because no startup path invokes the migration owner.

Live fleet evidence from 2026-07-28 showed all three forms: legacy device auth killed node-host connection on two Macs, legacy device identity killed openclaw node run on miniclaw, and the Mac app logged the exec-approvals migration instruction once per second for days.

Why This Change Was Made

Node-host startup now invokes the existing Doctor-owned detection and migration functions for device auth, device identity, and exec approvals before constructing the runtime or first Gateway connection. Each existing migrator retains its own short SQLite-maintenance lock and fail-soft behavior; no config repair, Gateway startup behavior, migration gate, or SQLite schema version changes are included.

Design decision

The operator approved automatic migration when a tool detects its own retired state. Doctor remains the sole migration owner: node-host startup is an explicit second authorized entry point that invokes those migrators, while runtime code still contains no inline migration logic. Lock contention or migration failure logs once and startup continues so the existing store gates preserve the current fail-closed behavior without a retry loop.

User Impact

Installed node-host services and the Mac app node-host worker can recover the three retired JSON stores automatically on startup. Successful migrations emit one concise line; clean startup stays silent. A pending native identity claim is preserved with a warning, and failed or contended migrations remain available for Doctor recovery.

Evidence

  • node scripts/run-vitest.mjs src/node-host/startup-state-migrations.test.ts — 1 file passed, 6 tests passed.
  • node scripts/run-vitest.mjs src/node-host/runner.test.ts — 1 file passed, 33 tests passed.
  • git diff --check — clean.
  • Codex autoreview (--mode uncommitted) — clean, no accepted/actionable findings after applying the explicit warn-and-continue operator contract.

AI-assisted implementation; the migration ownership, lock behavior, native-claim preservation, runtime gates, startup wiring, and focused tests were inspected directly.

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Jul 29, 2026
@steipete
steipete marked this pull request as ready for review July 29, 2026 02:50
@steipete
steipete merged commit 6c81253 into main Jul 29, 2026
120 checks passed
@steipete
steipete deleted the feat/node-host-startup-state-migrations branch July 29, 2026 05:04
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant