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
Don't disarm Ctrl+C in agents launched by unsloth start (#7630)
Nilaya31a8ff35206
diff --git a/unsloth_cli/commands/start.py b/unsloth_cli/commands/start.pyindex d932df10a29..dfb2ee678d1 100644--- a/unsloth_cli/commands/start.py+++ b/unsloth_cli/commands/start.py@@ -2717,8 +2717,9 @@ def _launch(# subprocess cwd was changed by the caller. Some Node CLIs use PWD for# project-root discovery instead of process.cwd().child_env["PWD"] = os.getcwd()- # Ctrl+C cancels a turn inside the agent; don't let it kill this wrapper.- previous = signal.signal(signal.SIGINT, signal.SIG_IGN)+ # Ctrl+C cancels a turn inside the agent; don't let it kill this wrapper. A no-op+ # handler, not SIG_IGN: exec preserves an ignored signal but resets a caught one.+ previous = signal.signal(signal.SIGINT, lambda *_: None)try:code = subprocess.run([executable, *command[1:]], env = child_env).returncodefinally:diff --git a/unsloth_cli/tests/test_start.py b/unsloth_cli/tests/test_start.pyindex 3d57232ba39..30ac2c8181b 100644--- a/unsloth_cli/tests/test_start.py+++ b/unsloth_cli/tests/test_start.py@@ -9,6 +9,7 @@ import jsonimport osimport reimport shlex+import signalimport sysimport timeimport urllib.error@@ -1461,6 +1462,25 @@ def test_launch_native_posix_child_gets_current_pwd(fake_studio, monkeypatch, tmassert captured["env"]["PWD"] == os.getcwd()[email protected](os.name == "nt", reason = "POSIX exec signal semantics")+def test_launch_leaves_child_able_to_handle_sigint(monkeypatch, tmp_path):+ # SIG_IGN here reached the agent too, so hermes could never be interrupted.+ probe = tmp_path / "probe.py"+ probe.write_text(+ "import signal, sys\n"+ "sys.exit(17 if signal.getsignal(signal.SIGINT) == signal.SIG_IGN else 0)\n",+ encoding = "utf-8",+ )+ monkeypatch.setattr(start.shutil, "which", lambda _: sys.executable)+ monkeypatch.setattr(start, "_augment_path_with_install_dirs", lambda: None)+ before = signal.getsignal(signal.SIGINT)++ code = start._launch([sys.executable, str(probe)], {}, install_hint = "n/a")++ assert code == 0, "child saw SIG_IGN and could never be interrupted"+ assert signal.getsignal(signal.SIGINT) is before++def test_connect_claude_launch_scrubs_conflicting_auth_env(fake_studio, monkeypatch):captured = {}monkeypatch.setenv("ANTHROPIC_API_KEY", "sk-anthropic-stale")