From 92eae979613dca230cb08f23b4d53c816bd72b15 Mon Sep 17 00:00:00 2001 From: Aditya Mer Date: Fri, 30 Jan 2026 14:54:45 +0530 Subject: [PATCH] fix(paths): update legacy config filenames to use resolved state directory --- src/config/paths.test.ts | 9 +++++---- src/config/paths.ts | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/config/paths.test.ts b/src/config/paths.test.ts index be5fd99c0..f292f73df 100644 --- a/src/config/paths.test.ts +++ b/src/config/paths.test.ts @@ -55,11 +55,12 @@ describe("state + config path candidates", () => { it("returns legacy filenames when state dir override is set", () => { const env = { OPENCLAW_STATE_DIR: "/custom/state" } as NodeJS.ProcessEnv; const candidates = resolveDefaultConfigCandidates(env, () => "/home/test"); + const base = path.resolve("/custom/state"); expect(candidates).toEqual([ - "/custom/state/openclaw.json", - "/custom/state/clawdbot.json", - "/custom/state/moltbot.json", - "/custom/state/moldbot.json", + path.join(base, "openclaw.json"), + path.join(base, "clawdbot.json"), + path.join(base, "moltbot.json"), + path.join(base, "moldbot.json"), ]); }); diff --git a/src/config/paths.ts b/src/config/paths.ts index 4299889c5..433e97c5c 100644 --- a/src/config/paths.ts +++ b/src/config/paths.ts @@ -164,7 +164,9 @@ export function resolveDefaultConfigCandidates( const resolved = resolveUserPath(openclawStateDir); return [ path.join(resolved, CONFIG_FILENAME), - ...LEGACY_CONFIG_FILENAMES.map((name) => path.join(resolved, name)), + path.join(resolved, "clawdbot.json"), + path.join(resolved, "moltbot.json"), + path.join(resolved, "moldbot.json"), ]; }