Skip to content

Commit fe2b921

Browse files
committed
fix(doctor): converge empty legacy state roots
1 parent 5f52d64 commit fe2b921

8 files changed

Lines changed: 184 additions & 965 deletions

‎src/commands/doctor-config-preflight-legacy-config.ts‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from "node:fs/promises";
22
import path from "node:path";
3-
import { resolveCanonicalConfigPath, resolveNewStateDir } from "../config/paths.js";
3+
import { resolveCanonicalConfigPath } from "../config/paths.js";
44
import { formatErrorMessage } from "../infra/errors.js";
55
import { resolveHomeDir } from "../utils.js";
66

@@ -25,25 +25,6 @@ export async function maybeMigrateLegacyConfig(): Promise<string[]> {
2525
for (const candidate of legacyCandidates) {
2626
try {
2727
await fs.access(candidate);
28-
// When the copy target is the default canonical root (~/.openclaw), copy only
29-
// out of a legacy dir the state-dir migration RESOLVED: a symlink pointing at
30-
// that same canonical root. Copying from an unresolved (real, or elsewhere-
31-
// pointing) legacy dir would plant the config into a root the migration has
32-
// not converged, forging the initialized-state-root marker
33-
// (state-migrations.state-dir.ts) and letting a later boot checkpoint while
34-
// real data sits in the legacy dir. Custom state dirs, explicit config paths,
35-
// and profiles are outside that migration's ownership and keep copying.
36-
const targetsDefaultStateRoot =
37-
path.resolve(targetDir) === path.resolve(resolveNewStateDir(() => home));
38-
if (targetsDefaultStateRoot) {
39-
const legacyDir = path.dirname(candidate);
40-
const resolvesToTarget = await Promise.all([fs.realpath(legacyDir), fs.realpath(targetDir)])
41-
.then(([resolvedLegacy, resolvedTarget]) => resolvedLegacy === resolvedTarget)
42-
.catch(() => false);
43-
if (!(await fs.lstat(legacyDir)).isSymbolicLink() || !resolvesToTarget) {
44-
continue;
45-
}
46-
}
4728
legacyPath = candidate;
4829
break;
4930
} catch {

‎src/commands/doctor-config-preflight.legacy-config.test.ts‎

Lines changed: 0 additions & 280 deletions
This file was deleted.

0 commit comments

Comments
 (0)