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: hard-link only auth.json into the Codex parent overlay (follow-up to #14591) (#14635)
Michael Han2cc6b8ecd52a
diff --git a/unsloth_cli/commands/start.py b/unsloth_cli/commands/start.pyindex 54b6707bb68..666ca7a6d6c 100644--- a/unsloth_cli/commands/start.py+++ b/unsloth_cli/commands/start.py@@ -3628,10 +3628,13 @@ def write_codex_parent_overlay(overlay: Path, auto_route: bool = False) -> Path:entries.append(source.name)except OSError:if source.is_file():- # Hard link, not copy: Codex rewrites auth.json in place, and a copy strands a rotated refresh token.- try:- os.link(source, target)- except OSError:+ # Only auth.json: Codex rewrites it in place, but a SQLite db under a second name keeps its own WAL and corrupts (sqlite.org/howtocorrupt.html 2.6).+ linked = False+ if source.name == "auth.json":+ with contextlib.suppress(OSError):+ os.link(source, target)+ linked = True+ if not linked:shutil.copy2(source, target)entries.append(source.name)elif source.is_dir():diff --git a/unsloth_cli/tests/test_start.py b/unsloth_cli/tests/test_start.pyindex 56d7b238f30..0d83b3a8de7 100644--- a/unsloth_cli/tests/test_start.py+++ b/unsloth_cli/tests/test_start.py@@ -1126,6 +1126,23 @@ def test_write_codex_parent_overlay_shares_a_token_refresh_without_symlinks(tmp_assert (source / "auth.json").read_text() == '{"refresh_token": "rt-2"}'+def test_write_codex_parent_overlay_copies_state_dbs_without_symlinks(tmp_path, monkeypatch):+ source = tmp_path / "user-codex"+ source.mkdir()+ for name in ("state_5.sqlite", "state_5.sqlite-wal", "history.jsonl"):+ (source / name).write_bytes(b"data")+ monkeypatch.setenv("CODEX_HOME", str(source))++ def deny_symlink(*args, **kwargs):+ raise OSError(1314, "A required privilege is not held by the client")++ monkeypatch.setattr(Path, "symlink_to", deny_symlink)+ overlay = start.write_codex_parent_overlay(tmp_path / "session" / "parent")+ for name in ("state_5.sqlite", "state_5.sqlite-wal", "history.jsonl"):+ assert (overlay / name).read_bytes() == b"data"+ assert not os.path.samefile(overlay / name, source / name)++@pytest.mark.skipif(os.name == "nt", reason = "needs symlink privilege")@pytest.mark.parametrize("home_exists", [False, True])def test_write_codex_parent_overlay_keeps_a_first_login(tmp_path, monkeypatch, home_exists):