Repository navigation
feat(node-host): migrate retired state before connecting - #115495
Merged
Merged
Conversation
steipete
marked this pull request as ready for review
July 29, 2026 02:50
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 29, 2026
…5495) * feat(node-host): run doctor-owned state migrations at startup * fix(node-host): satisfy startup migration lint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 runon 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.--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.