chore!: remove moltbot legacy state/config support

This commit is contained in:
Peter Steinberger
2026-02-14 12:40:41 +01:00
parent e21a7aad54
commit 3b56a6252b
8 changed files with 15 additions and 28 deletions

View File

@@ -160,7 +160,6 @@ async function maybeMigrateLegacyConfig(): Promise<string[]> {
const legacyCandidates = [
path.join(home, ".clawdbot", "clawdbot.json"),
path.join(home, ".moltbot", "moltbot.json"),
path.join(home, ".moldbot", "moldbot.json"),
];

View File

@@ -19,7 +19,7 @@ describe("noteMacLaunchctlGatewayEnvOverrides", () => {
await noteMacLaunchctlGatewayEnvOverrides(cfg, { platform: "darwin", getenv, noteFn });
expect(noteFn).toHaveBeenCalledTimes(1);
expect(getenv).toHaveBeenCalledTimes(6);
expect(getenv).toHaveBeenCalledTimes(4);
const [message, title] = noteFn.mock.calls[0] ?? [];
expect(title).toBe("Gateway (macOS)");

View File

@@ -73,8 +73,6 @@ export async function noteMacLaunchctlGatewayEnvOverrides(
const getenv = deps?.getenv ?? launchctlGetenv;
const deprecatedLaunchctlEntries = [
["MOLTBOT_GATEWAY_TOKEN", await getenv("MOLTBOT_GATEWAY_TOKEN")],
["MOLTBOT_GATEWAY_PASSWORD", await getenv("MOLTBOT_GATEWAY_PASSWORD")],
["CLAWDBOT_GATEWAY_TOKEN", await getenv("CLAWDBOT_GATEWAY_TOKEN")],
["CLAWDBOT_GATEWAY_PASSWORD", await getenv("CLAWDBOT_GATEWAY_PASSWORD")],
].filter((entry): entry is [string, string] => Boolean(entry[1]?.trim()));
@@ -126,10 +124,7 @@ export function noteDeprecatedLegacyEnvVars(
deps?: { noteFn?: typeof note },
) {
const entries = Object.entries(env)
.filter(
([key, value]) =>
(key.startsWith("MOLTBOT_") || key.startsWith("CLAWDBOT_")) && value?.trim(),
)
.filter(([key, value]) => key.startsWith("CLAWDBOT_") && value?.trim())
.map(([key]) => key);
if (entries.length === 0) {
return;

View File

@@ -356,7 +356,7 @@ describe("doctor legacy state migrations", () => {
it("does not warn when legacy state dir is an already-migrated symlink mirror", async () => {
const root = await makeTempRoot();
const targetDir = path.join(root, ".openclaw");
const legacyDir = path.join(root, ".moltbot");
const legacyDir = path.join(root, ".clawdbot");
fs.mkdirSync(path.join(targetDir, "sessions"), { recursive: true });
fs.mkdirSync(path.join(targetDir, "agent"), { recursive: true });
fs.mkdirSync(legacyDir, { recursive: true });
@@ -377,7 +377,7 @@ describe("doctor legacy state migrations", () => {
it("warns when legacy state dir is empty and target already exists", async () => {
const root = await makeTempRoot();
const targetDir = path.join(root, ".openclaw");
const legacyDir = path.join(root, ".moltbot");
const legacyDir = path.join(root, ".clawdbot");
fs.mkdirSync(targetDir, { recursive: true });
fs.mkdirSync(legacyDir, { recursive: true });
@@ -395,7 +395,7 @@ describe("doctor legacy state migrations", () => {
it("warns when legacy state dir contains non-symlink entries and target already exists", async () => {
const root = await makeTempRoot();
const targetDir = path.join(root, ".openclaw");
const legacyDir = path.join(root, ".moltbot");
const legacyDir = path.join(root, ".clawdbot");
fs.mkdirSync(targetDir, { recursive: true });
fs.mkdirSync(legacyDir, { recursive: true });
fs.writeFileSync(path.join(legacyDir, "sessions.json"), "{}", "utf-8");
@@ -414,7 +414,7 @@ describe("doctor legacy state migrations", () => {
it("does not warn when legacy state dir contains nested symlink mirrors", async () => {
const root = await makeTempRoot();
const targetDir = path.join(root, ".openclaw");
const legacyDir = path.join(root, ".moltbot");
const legacyDir = path.join(root, ".clawdbot");
fs.mkdirSync(path.join(targetDir, "agents", "main"), { recursive: true });
fs.mkdirSync(legacyDir, { recursive: true });
fs.mkdirSync(path.join(legacyDir, "agents"), { recursive: true });
@@ -438,7 +438,7 @@ describe("doctor legacy state migrations", () => {
it("warns when legacy state dir symlink points outside the target tree", async () => {
const root = await makeTempRoot();
const targetDir = path.join(root, ".openclaw");
const legacyDir = path.join(root, ".moltbot");
const legacyDir = path.join(root, ".clawdbot");
const outsideDir = path.join(root, ".outside-state");
fs.mkdirSync(path.join(targetDir, "sessions"), { recursive: true });
fs.mkdirSync(legacyDir, { recursive: true });
@@ -461,7 +461,7 @@ describe("doctor legacy state migrations", () => {
it("warns when legacy state dir contains a broken symlink target", async () => {
const root = await makeTempRoot();
const targetDir = path.join(root, ".openclaw");
const legacyDir = path.join(root, ".moltbot");
const legacyDir = path.join(root, ".clawdbot");
fs.mkdirSync(path.join(targetDir, "sessions"), { recursive: true });
fs.mkdirSync(legacyDir, { recursive: true });
@@ -484,7 +484,7 @@ describe("doctor legacy state migrations", () => {
it("warns when legacy symlink escapes target tree through second-hop symlink", async () => {
const root = await makeTempRoot();
const targetDir = path.join(root, ".openclaw");
const legacyDir = path.join(root, ".moltbot");
const legacyDir = path.join(root, ".clawdbot");
const outsideDir = path.join(root, ".outside-state");
fs.mkdirSync(targetDir, { recursive: true });
fs.mkdirSync(legacyDir, { recursive: true });

View File

@@ -77,19 +77,12 @@ describe("state + config path candidates", () => {
const expected = [
path.join(resolvedHome, ".openclaw", "openclaw.json"),
path.join(resolvedHome, ".openclaw", "clawdbot.json"),
path.join(resolvedHome, ".openclaw", "moltbot.json"),
path.join(resolvedHome, ".openclaw", "moldbot.json"),
path.join(resolvedHome, ".clawdbot", "openclaw.json"),
path.join(resolvedHome, ".clawdbot", "clawdbot.json"),
path.join(resolvedHome, ".clawdbot", "moltbot.json"),
path.join(resolvedHome, ".clawdbot", "moldbot.json"),
path.join(resolvedHome, ".moltbot", "openclaw.json"),
path.join(resolvedHome, ".moltbot", "clawdbot.json"),
path.join(resolvedHome, ".moltbot", "moltbot.json"),
path.join(resolvedHome, ".moltbot", "moldbot.json"),
path.join(resolvedHome, ".moldbot", "openclaw.json"),
path.join(resolvedHome, ".moldbot", "clawdbot.json"),
path.join(resolvedHome, ".moldbot", "moltbot.json"),
path.join(resolvedHome, ".moldbot", "moldbot.json"),
];
expect(candidates).toEqual(expected);

View File

@@ -17,10 +17,10 @@ export function resolveIsNixMode(env: NodeJS.ProcessEnv = process.env): boolean
export const isNixMode = resolveIsNixMode();
const LEGACY_STATE_DIRNAMES = [".clawdbot", ".moltbot", ".moldbot"] as const;
const LEGACY_STATE_DIRNAMES = [".clawdbot", ".moldbot"] as const;
const NEW_STATE_DIRNAME = ".openclaw";
const CONFIG_FILENAME = "openclaw.json";
const LEGACY_CONFIG_FILENAMES = ["clawdbot.json", "moltbot.json", "moldbot.json"] as const;
const LEGACY_CONFIG_FILENAMES = ["clawdbot.json", "moldbot.json"] as const;
function resolveDefaultHomeDir(): string {
return resolveRequiredHomeDir(process.env, os.homedir);