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

@@ -14,6 +14,10 @@ Docs: https://docs.openclaw.ai
- Agents: add pre-prompt context diagnostics (`messages`, `systemPromptChars`, `promptChars`, provider/model, session file) before embedded runner prompt calls to improve overflow debugging. (#8930) Thanks @Glucksberg.
- Onboarding/Providers: add first-class Hugging Face Inference provider support (provider wiring, onboarding auth choice/API key flow, and default-model selection), and preserve Hugging Face auth intent in auth-choice remapping (`tokenProvider=huggingface` with `authChoice=apiKey`) while skipping env-override prompts when an explicit token is provided. (#13472) Thanks @Josephrp.
### Breaking
- Config/State: removed legacy `.moltbot` auto-detection/migration and `moltbot.json` config candidates. If you still have state/config under `~/.moltbot`, move it to `~/.openclaw` (recommended) or set `OPENCLAW_STATE_DIR` / `OPENCLAW_CONFIG_PATH` explicitly.
### Fixes
- Gateway/Auth: add trusted-proxy mode hardening follow-ups by keeping `OPENCLAW_GATEWAY_*` env compatibility, auto-normalizing invalid setup combinations in interactive `gateway configure` (trusted-proxy forces `bind=lan` and disables Tailscale serve/funnel), and suppressing shared-secret/rate-limit audit findings that do not apply to trusted-proxy deployments. (#15940) Thanks @nickytonline.

View File

@@ -159,10 +159,6 @@ out to QMD for retrieval. Key points:
```bash
# Pick the same state dir OpenClaw uses
STATE_DIR="${OPENCLAW_STATE_DIR:-$HOME/.openclaw}"
if [ -d "$HOME/.moltbot" ] && [ ! -d "$HOME/.openclaw" ] \
&& [ -z "${OPENCLAW_STATE_DIR:-}" ]; then
STATE_DIR="$HOME/.moltbot"
fi
export XDG_CONFIG_HOME="$STATE_DIR/agents/main/qmd/xdg-config"
export XDG_CACHE_HOME="$STATE_DIR/agents/main/qmd/xdg-cache"

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);