11import fs from "node:fs/promises" ;
22import path from "node:path" ;
3- import { resolveCanonicalConfigPath , resolveNewStateDir } from "../config/paths.js" ;
3+ import { resolveCanonicalConfigPath } from "../config/paths.js" ;
44import { formatErrorMessage } from "../infra/errors.js" ;
55import { 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 {
0 commit comments