Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
unsloth start openclaw: stop writing the legacy exec-approvals.json that OpenClaw 2026.8.1+ refuses to run with (#14343)
Daniel Hanacc10af9d65e
diff --git a/unsloth_cli/commands/start.py b/unsloth_cli/commands/start.pyindex c6a0c4c8084..aec7ab3315e 100644--- a/unsloth_cli/commands/start.py+++ b/unsloth_cli/commands/start.py@@ -5138,18 +5138,11 @@ def write_openclaw_config(gateway.setdefault("mode", "local")_subdict(gateway, "auth").setdefault("mode", "none")if yolo:- # OpenClaw has no --yolo flag, and it gates tool execution on BOTH the tools.exec config AND a host-local approvals file (the stricter wins), so setting only the config still lets the agent prompt or deny. Set both, mirroring `openclaw exec-policy preset yolo`.+ # OpenClaw has no --yolo flag. Its host approvals document (SQLite since 2026.8.1) falls back to tools.exec for omitted fields, so the config side is enough.exec_policy = _subdict(_subdict(config, "tools"), "exec")exec_policy["host"] = "gateway"exec_policy["security"] = "full"exec_policy["ask"] = "off"- # Approvals file in OPENCLAW_STATE_DIR (the same as this config's dir). ask=off means nothing is ever prompted, so the runtime socket block is unnecessary here.- approvals = path.parent / "exec-approvals.json"- _write_private_json(- approvals,- {"version": 1, "defaults": {"security": "full", "ask": "off", "askFallback": "full"}},- )- typer.echo(f"Updated {approvals}")else:# The no-launch config dir is reused across runs, so a previous --yolo run may have left auto-approval state behind. OpenClaw treats an omitted exec policy as security=full, ask=off on the gateway host, so deleting the keys would keep auto-approval on: a non-yolo run must WRITE a prompting policy. Only a permissive/yolo policy is replaced; a stricter one set by hand survives.tools = config.get("tools")@@ -5167,30 +5160,39 @@ def write_openclaw_config(exec_policy.pop("host", None) # routing only; defaults to the gateway hostexec_policy["security"] = "allowlist" # only allowlisted commands skip approvalexec_policy["ask"] = "on-miss" # prompt on every non-allowlisted command- # Drop the yolo defaults from the host approvals file (a stricter default set by the user or OpenClaw is kept). With a prompting tools.exec the stricter of the two layers wins, so an omitted approvals default still prompts.- approvals = path.parent / "exec-approvals.json"- if approvals.exists():- state = _read_json_object(approvals)- if state is not None:- defaults = state.get("defaults")- # Strip the defaults only when they are exactly the yolo fingerprint; a user-managed mixed policy that merely shares a field (askFallback=full, whose omitted default is deny) must be kept intact.- yolo_defaults = (("security", "full"), ("ask", "off"), ("askFallback", "full"))- is_yolo = isinstance(defaults, dict) and all(- defaults.get(k) == v for k, v in yolo_defaults- )- if is_yolo:- for k, _ in yolo_defaults:- del defaults[k]- if not defaults:- del state["defaults"]- if set(state) <= {"version"}:- # Nothing left but our own yolo payload: remove it.- approvals.unlink()- typer.echo(f"Removed {approvals}")- else:- # Keep approvals OpenClaw itself recorded; only the yolo defaults go.- _write_private_json(approvals, state)- typer.echo(f"Updated {approvals}")+ # Older Unsloth wrote --yolo defaults here; OpenClaw 2026.8.1+ refuses every run while this legacy file exists, so drop ours in both modes and keep any other policy.+ approvals = path.parent / "exec-approvals.json"+ if approvals.exists():+ state = _read_json_object(approvals)+ if state is not None:+ defaults = state.get("defaults")+ # Exact yolo fingerprint only: a user policy merely sharing askFallback=full must survive.+ yolo_defaults = (("security", "full"), ("ask", "off"), ("askFallback", "full"))+ is_yolo = isinstance(defaults, dict) and all(+ defaults.get(k) == v for k, v in yolo_defaults+ )+ if is_yolo:+ for k, _ in yolo_defaults:+ del defaults[k]+ if not defaults:+ del state["defaults"]+ # Socket metadata and an empty agents map carry no policy (doctor retires such a stub too).+ if all(+ k in ("version", "socket") or (k == "agents" and not v)+ for k, v in state.items()+ ):+ approvals.unlink()+ typer.echo(f"Removed {approvals}")+ else:+ _write_private_json(approvals, state)+ typer.echo(f"Updated {approvals}")+ if approvals.exists():+ # The rest is user policy; importing it is OpenClaw's migration, not ours.+ typer.echo(+ f"Note: {approvals} is a legacy exec approvals file, which OpenClaw 2026.8.1+ refuses to run with. "+ f"Import it with: {_openclaw_doctor_command(path, windows = os.name == 'nt')}",+ err = True,+ )if json.dumps(config, sort_keys = True) != before:_write_private_json(path, config)typer.echo(f"Updated {path}")diff --git a/unsloth_cli/tests/test_start.py b/unsloth_cli/tests/test_start.pyindex 517676a363e..e701893625d 100644--- a/unsloth_cli/tests/test_start.py+++ b/unsloth_cli/tests/test_start.py@@ -8108,8 +8108,7 @@ def test_yolo_openclaw_writes_exec_policy(fake_studio, tmp_path):state = tmp_path / "agents" / "openclaw"config = json.loads((state / "openclaw.json").read_text())assert config["tools"]["exec"] == {"host": "gateway", "security": "full", "ask": "off"}- approvals = json.loads((state / "exec-approvals.json").read_text())- assert approvals["defaults"] == {"security": "full", "ask": "off", "askFallback": "full"}+ assert not (state / "exec-approvals.json").exists()def test_no_yolo_openclaw_leaves_fresh_config_untouched(fake_studio, tmp_path):@@ -8138,11 +8137,46 @@ def test_write_openclaw_config_yolo_unit(tmp_path):start.write_openclaw_config(BASE, "sk-unsloth-abc", MODEL, path, yolo = True)config = json.loads(path.read_text())assert config["tools"]["exec"] == {"host": "gateway", "security": "full", "ask": "off"}- approvals = json.loads((path.parent / "exec-approvals.json").read_text())- assert approvals == {+ assert not (path.parent / "exec-approvals.json").exists()+++# What older `unsloth start openclaw --yolo` wrote.+LEGACY_OPENCLAW_YOLO_APPROVALS = {+ "version": 1,+ "defaults": {"security": "full", "ask": "off", "askFallback": "full"},+}++[email protected]("yolo", [True, False])+ "extra",+ [{}, {"socket": {"path": "/tmp/exec-approvals.sock", "token": "t"}, "agents": {}}],+)+def test_write_openclaw_config_retires_legacy_yolo_approvals(tmp_path, capsys, yolo, extra):+ path = tmp_path / "openclaw.json"+ approvals = path.parent / "exec-approvals.json"+ approvals.write_text(json.dumps({**LEGACY_OPENCLAW_YOLO_APPROVALS, **extra}))+ start.write_openclaw_config(BASE, "sk-unsloth-abc", MODEL, path, yolo = yolo)+ assert not approvals.exists()+ assert "legacy exec approvals" not in capsys.readouterr().err++[email protected]("yolo", [True, False])+def test_write_openclaw_config_points_user_legacy_approvals_at_openclaw_doctor(+ tmp_path, capsys, yolo+):+ path = tmp_path / "openclaw.json"+ approvals = path.parent / "exec-approvals.json"+ legacy = {**LEGACY_OPENCLAW_YOLO_APPROVALS, "agents": {"main": {"allowlist": ["git status"]}}}+ approvals.write_text(json.dumps(legacy))+ start.write_openclaw_config(BASE, "sk-unsloth-abc", MODEL, path, yolo = yolo)+ assert json.loads(approvals.read_text()) == {"version": 1,- "defaults": {"security": "full", "ask": "off", "askFallback": "full"},+ "agents": {"main": {"allowlist": ["git status"]}},}+ err = capsys.readouterr().err+ assert "legacy exec approvals file" in err+ assert "openclaw doctor --fix" in errdef test_no_launch_rerun_clears_stale_opencode_yolo_permissions(fake_studio, tmp_path):@@ -8166,7 +8200,7 @@ def test_no_launch_rerun_clears_stale_openclaw_yolo_state(fake_studio, tmp_path)yolo = CliRunner().invoke(start.start_app, ["openclaw", "--yolo", "--no-launch"])assert yolo.exit_code == 0, yolo.outputstate = tmp_path / "agents" / "openclaw"- assert (state / "exec-approvals.json").exists()+ (state / "exec-approvals.json").write_text(json.dumps(LEGACY_OPENCLAW_YOLO_APPROVALS))plain = CliRunner().invoke(start.start_app, ["openclaw", "--no-launch"])assert plain.exit_code == 0, plain.outputconfig = json.loads((state / "openclaw.json").read_text())@@ -8201,8 +8235,7 @@ def test_openclaw_non_yolo_keeps_runtime_approvals(tmp_path):path = tmp_path / "openclaw.json"start.write_openclaw_config(BASE, "sk-unsloth-abc", MODEL, path, yolo = True)approvals = path.parent / "exec-approvals.json"- state = json.loads(approvals.read_text())- state["agents"] = {"main": {"allowlist": ["git status"]}}+ state = {**LEGACY_OPENCLAW_YOLO_APPROVALS, "agents": {"main": {"allowlist": ["git status"]}}}approvals.write_text(json.dumps(state))start.write_openclaw_config(BASE, "sk-unsloth-abc", MODEL, path, yolo = False)remaining = json.loads(approvals.read_text())