Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.
Python ai-filmmakingai-videoai-video-generatorapple-siliconhailuoimage-to-videolip-synclocal-ailora-trainingltx-2ltx-2-5ltx-videomacosminimax-h3mlxmusic-generationoffline-aipinokiotext-to-videovideo-generation
v4.14.3 — songs that start, paths that paste
mrbizarro92e3033756ac
diff --git a/README.md b/README.mdindex 013cd51..02c8bf4 100644--- a/README.md+++ b/README.md@@ -19,7 +19,7 @@</p>-> **Current release: v4.14.2.** **Outputs and Recent have an Audio filter** next to Videos and Photos, so your songs are one click away (thanks @cocktailpeanut). **v4.14.1 — Compose is always in Audio**: install YuE2 from right there with one click (no more hunting in the Pinokio sidebar), and H3 renders that some community LoRAs turned black now work or fail with a clear message. **v4.14.0 — Songs, faces and sound**: **Audio → Compose** writes whole songs with vocals from your lyrics and a style (YuE2 by Multimodal Art Projection, MLX port by vanch007; about real time on an M4 Max, 11 GB). **Upscale & Face Fix** sharpens faces and doubles the size of any clip in one click, from the player, Outputs, the queue or the Editor. The Editor gets **sound tracks**: A3, A4 and more, a Sound pool, and clip sound on two lanes so neighbouring shots can crossfade. Full notes on the [releases page](https://github.com/mrbizarro/Phosphene/releases).+> **Current release: v4.14.3.** **Songs work on every install** — the music engine refused to start under Pinokio's environment, so the first song failed on most Macs; it writes songs now. **Pasted file paths just work**: a path copied out of Finder or dragged into Terminal (quotes, `Macintosh HD`, escaped spaces, `file://`) is accepted everywhere you can paste one. A render no longer dies on a stray character in a tool's output, and when the render helper can't start, the message names the cause and what to do. **v4.14.2 — Outputs and Recent have an Audio filter** next to Videos and Photos, so your songs are one click away (thanks @cocktailpeanut). **v4.14.1 — Compose is always in Audio**: install YuE2 from right there with one click (no more hunting in the Pinokio sidebar), and H3 renders that some community LoRAs turned black now work or fail with a clear message. **v4.14.0 — Songs, faces and sound**: **Audio → Compose** writes whole songs with vocals from your lyrics and a style (YuE2 by Multimodal Art Projection, MLX port by vanch007; about real time on an M4 Max, 11 GB). **Upscale & Face Fix** sharpens faces and doubles the size of any clip in one click, from the player, Outputs, the queue or the Editor. The Editor gets **sound tracks**: A3, A4 and more, a Sound pool, and clip sound on two lanes so neighbouring shots can crossfade. Full notes on the [releases page](https://github.com/mrbizarro/Phosphene/releases).## Overviewdiff --git a/VERSION b/VERSIONindex 0fb7a35..453b50f 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-4.14.2+4.14.3diff --git a/docs/STATE.md b/docs/STATE.mdindex 16f8dfb..4e633b5 100644--- a/docs/STATE.md+++ b/docs/STATE.md@@ -1,5 +1,39 @@# Phosphene — project state, history, open work+> **🩹 2026-09-17 — v4.14.3 released (public, tag `v4.14.3`): "songs that start, paths that paste".**+> A fleet read (PostHog, last 48 h) rather than a report: four real-user failures, fixed and shipped the same day.+> **1. YuE2 failed for nearly everyone.** Pinokio's shell exports `PYTORCH_ENABLE_MPS_FALLBACK=1` into every app it+> starts (pinokiod `kernel/shell.js init_env`), and the pinned engine refuses to construct with it set —+> `lyra/pipeline.py:119` checks that var and `PYTORCH_MPS_FAST_MATH` in `YuE2Pipeline.__init__` and raises+> "Unset …; fallback/fast-math is not a validated execution path". Fleet 4.14.0: 9 failures / 8 songs / 3 installs, and+> the shape was always failure → app_boot → songs, i.e. only the users who unset it themselves ever heard anything. Not+> mode-dependent: the guard is in the constructor. Panel now builds the child env itself (`music_child_env()`: both vars+> out, `MLX_ENABLE_TF32=0` stated) and the runner keeps its own `os.environ.pop` for a command-line launch (dev+> `fa23647` + `3bcffe6`). Tests: a stub runner enforcing the engine's real check, through `run_job_inner`, for+> full/melody/off × draft/final × instrumental (12).+> **2. Pasted paths.** `control video not found: "'Macintosh HD<path> Tinder 1.mp4'"` (4.14.0) — Finder's "Copy as+> pathname" adds the startup disk's name and quotes, a Terminal drag escapes spaces, a browser drag gives `file://`,+> shells give `~`. `normalize_pasted_path()` undoes all of it (the boot volume's real name is discovered from+> `/Volumes`), refuses to "fix" a path that already exists, and runs inside `make_job`'s own field reader for every+> field in `PASTED_PATH_FIELDS`, plus image refs, ingredient images and keyframes.+> **3. `'utf-8' codec can't decode byte 0xb0 in position 37`** (42 events, 3 installs): `text=True` with no `errors=`+> is a strict decode of another program's output. All 50 subprocess pipes in the shipped modules now use+> `errors="replace"`, and a test fails the build if a new one arrives without it. Same byte from the other side: macOS+> AppleDouble `._` twins on exFAT/SMB drives are binary and `pathlib.glob` matches them — the H3 runner's draft cache+> read one as JSON (UnicodeDecodeError is a ValueError, not a JSONDecodeError, so it escaped) and its loader offered one+> as a shard. Runner `codex/h3-engine-v2` pushed `d39879b` → `7919020` (users get it via **Update Hailuo H3 runner**).+> **4. The two messages that named nothing.** `helper failed to start: {'event': 'exit', 'reason':+> 'python_normal_exit'}` (85 events, 7 installs — the fleet's top failure) means "the helper printed a traceback and+> exited"; the panel now keeps its boot lines and reports the line that names the cause plus the remedy, keeping the+> `helper failed to start` prefix so the series and `_ANALYTICS_ERROR_CLASSES` still key on it. And+> `H3 render exited with code 1 — last line: Invoked with types: mlx.core.array, mlx.core.array` was a pybind argument+> dump under the real sentence: `failure_line()` prefers the exception line, with a tail deep enough (14) to hold it.+> **NOT fixed:** the H3 `Invoked with types` crash itself (one install, 4.13.0, 7 events) — the recorded line never+> carried the exception, which is exactly what this release fixes for the next occurrence.+> Also in: the owner's **LIVE · return to render** pill moved off the clip action row (dev `9bcb7f5`, CSS only).+> Built by cherry-pick on `b858d32` (Fast|Best switch, room tone, Editor round 2 and Face Fix placement stay+> unreleased). No Codex round (owner).+> **🎧 2026-09-17 — v4.14.2 released (public, tag `v4.14.2`): "an Audio filter in Outputs and Recent".**> Asked for by @cocktailpeanut on the 4.14 Pinokio post ("audio filter … along with video/photo"); owner: "he is right, ship and update".> Outputs and Recent get an **Audio** chip beside Videos / Photos (`outputKind(o) === 'audio'`; Recent = `params.engine === 'music'`;diff --git a/image_engine.py b/image_engine.pyindex 1cdbb16..203c864 100644--- a/image_engine.py+++ b/image_engine.py@@ -944,7 +944,7 @@ def _generate_mflux(prompt: str, n: int, width: int, height: int,except Exception: # noqa: BLE001passcap_res = subprocess.run(- cap_cmd, capture_output=True, text=True,+ cap_cmd, capture_output=True, text=True, errors="replace",env=_clean_subprocess_env(), timeout=180,)if cap_res.returncode != 0:@@ -1239,7 +1239,7 @@ def _generate_mflux(prompt: str, n: int, width: int, height: int,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,env=env,- text=True,+ text=True, errors="replace",bufsize=1,# Own process group so the Popen.terminate/kill below escalates# to the entire mflux+MLX subtree (mflux can spawn helper procs@@ -1878,7 +1878,7 @@ def _generate_hidream(prompt: str, n: int, width: int, height: int,cmd,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,- text=True,+ text=True, errors="replace",env=_clean_subprocess_env(),# Own process group so /stop's killpg cascades to any# child procs MLX/Metal might spawn under this generation.diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.pyindex 6b61e6b..2e06410 100644--- a/mlx_ltx_panel.py+++ b/mlx_ltx_panel.py@@ -13,6 +13,7 @@ Features:from __future__ import annotationsimport atexit+import functoolsimport hashlibimport htmlimport importlib.util@@ -2889,7 +2890,7 @@ def _train_install_dev_transformer(push_log) -> dict:f"the full-precision copy training requires).")proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,- text=True, bufsize=1, env=env, start_new_session=True)+ text=True, errors="replace", bufsize=1, env=env, start_new_session=True)with DOWNLOAD_LOCK:DOWNLOAD["proc"] = proctry:@@ -3051,7 +3052,7 @@ def _h3_turbo_fetch_embedder(target_dir, push_log, runner=None, *,target_dir.mkdir(parents=True, exist_ok=True)proc = (runner or subprocess.run)([str(python), str(fetcher), "--out", str(tmp)],- capture_output=True, text=True, env=env, timeout=1800)+ capture_output=True, text=True, errors="replace", env=env, timeout=1800)if proc.returncode != 0:raise RuntimeError((proc.stderr or proc.stdout or "")[-300:].strip()or f"exit {proc.returncode}")@@ -4580,7 +4581,7 @@ def _resolve_github_token() -> str:try:out = subprocess.run(["gh", "auth", "token"], check=True, capture_output=True,- timeout=5, text=True,+ timeout=5, text=True, errors="replace",)return (out.stdout or "").strip()except (FileNotFoundError, subprocess.SubprocessError):@@ -4614,7 +4615,7 @@ def _run_stats_fetch_once() -> None:try:cp = subprocess.run([sys.executable, str(STATS_FETCHER)],- capture_output=True, text=True, timeout=120, env=env,+ capture_output=True, text=True, errors="replace", timeout=120, env=env,)if cp.returncode != 0:# The stats dashboard is a maintainer-only nicety; a fetch failure@@ -6435,7 +6436,7 @@ def _download_thread(repo: dict) -> None:cmd,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,- text=True,+ text=True, errors="replace",bufsize=1,env=env,start_new_session=True,@@ -7420,7 +7421,7 @@ def find_comfy_pids(fresh: bool = False) -> list[int]:return pidstry:out = subprocess.run(["pgrep", "-f", COMFY_PATTERN],- capture_output=True, text=True, timeout=2).stdout+ capture_output=True, text=True, errors="replace", timeout=2).stdoutpids = [int(line) for line in out.splitlines() if line.strip().isdigit()]except Exception:pids = []@@ -7655,7 +7656,7 @@ def _detect_total_ram_gb() -> float:try:out = subprocess.run(["sysctl", "-n", "hw.memsize"],- capture_output=True, text=True, timeout=1,+ capture_output=True, text=True, errors="replace", timeout=1,).stdout.strip()return int(out) / 1024**3except Exception:@@ -8396,7 +8397,7 @@ def _hw_chip_family() -> str:fam = "unknown"try:brand = subprocess.run(["sysctl", "-n", "machdep.cpu.brand_string"],- capture_output=True, text=True, timeout=3).stdout.strip()+ capture_output=True, text=True, errors="replace", timeout=3).stdout.strip()m = re.search(r"Apple (M\d+)(?: (Pro|Max|Ultra))?", brand)if m:fam = m.group(1) + (f" {m.group(2)}" if m.group(2) else "")@@ -12450,6 +12451,8 @@ MUSIC_ROOT = ROOT / Path(os.environ.get("LTX_MUSIC_ROOT", "yue2-mlx")).expanduseMUSIC_MODELS = ROOT / Path(os.environ.get("LTX_MUSIC_MODELS", "mlx_models/yue2")).expanduser()MUSIC_RUNNER = ROOT / "scripts/music/yue2_run.py"MUSIC_ENGINE_PIN = (ROOT / "scripts/music/engine_pin.txt").read_text().strip()+# Env vars the music runner must NEVER inherit — see music_child_env().+MUSIC_ENV_STRIP = ("PYTORCH_ENABLE_MPS_FALLBACK", "PYTORCH_MPS_FAST_MATH")# Lock paths that command-line GPU jobs (the H3 lab's scripts) create while they# run. Music only READS them: inside Phosphene the queue already serialises GPU# work, so the panel never creates, deletes or reclaims a shared lock — which@@ -12788,6 +12791,28 @@ def music_argv(job: dict, paths: dict, output: Path) -> list[str]:return args+def music_child_env(base: dict | None = None) -> dict:+ """The env the YuE2 runner gets. Pinokio's shell exports+ `PYTORCH_ENABLE_MPS_FALLBACK=1` (and some setups `PYTORCH_MPS_FAST_MATH=1`)+ into every app it starts, and the pinned engine REFUSES to run with either+ set — `lyra/pipeline.py` raises "Unset PYTORCH_ENABLE_MPS_FALLBACK;+ fallback/fast-math is not a validated execution path" in its constructor,+ before a single note is written. It is an MLX runtime; those vars are for+ PyTorch and mean nothing here. Every song on a Pinokio-started panel died+ on it (fleet 4.14.0: nine failures, three installs) and the only users who+ ever got a song were the ones who unset the var themselves and restarted.++ So the panel decides the child's env instead of inheriting the accident:+ both vars come out, and TF32 is stated (the engine's own default) rather+ than left to whatever the shell had.+ """+ env = {k: v for k, v in (base if base is not None else os.environ).items()+ if k not in MUSIC_ENV_STRIP}+ env["PYTHONUNBUFFERED"] = "1"+ env["MLX_ENABLE_TF32"] = "0"+ return env++def music_progress(line: str, previous: dict | None = None) -> dict | None:"""Decode the runner's flushed protocol; percentages describe stages."""m = re.match(r"^\[music\] (stage|plan|song|synth|decode|done|error)\s*(.*)$", line.strip())@@ -12896,9 +12921,9 @@ def run_music_job_inner(job: dict) -> None:cmd = music_argv(job, paths, output)job["command"] = shlex.join(cmd)t0 = time.time()- proc = subprocess.Popen(cmd, cwd=str(MUSIC_ROOT), env={**os.environ, "PYTHONUNBUFFERED": "1"},- stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1,- start_new_session=True)+ proc = subprocess.Popen(cmd, cwd=str(MUSIC_ROOT), env=music_child_env(),+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True,+ errors="replace", bufsize=1, start_new_session=True)with LOCK:STATE["pid"] = proc.pidSTATE["music_pgid"] = proc.pid@@ -13488,7 +13513,7 @@ def _analytics_chip_family() -> str:try:brand = subprocess.run(["sysctl", "-n", "machdep.cpu.brand_string"],- capture_output=True, text=True, timeout=2,+ capture_output=True, text=True, errors="replace", timeout=2,).stdout.strip()m = _CHIP_FAMILY_RE.search(brand)if m:@@ -14811,9 +14836,9 @@ def get_memory() -> dict:info = {"total_gb": 0.0, "used_gb": 0.0, "pressure_pct": 0, "swap_gb": 0.0}try:total = int(subprocess.run(["sysctl", "-n", "hw.memsize"],- capture_output=True, text=True, timeout=1).stdout.strip())+ capture_output=True, text=True, errors="replace", timeout=1).stdout.strip())info["total_gb"] = total / 1024**3- vm = subprocess.run(["vm_stat"], capture_output=True, text=True, timeout=1).stdout+ vm = subprocess.run(["vm_stat"], capture_output=True, text=True, errors="replace", timeout=1).stdoutm = re.search(r"page size of (\d+)", vm)page_size = int(m.group(1)) if m else 16384@@ -14827,7 +14852,7 @@ def get_memory() -> dict:info["pressure_pct"] = round(used_bytes / total * 100) if total else 0swap = subprocess.run(["sysctl", "-n", "vm.swapusage"],- capture_output=True, text=True, timeout=1).stdout+ capture_output=True, text=True, errors="replace", timeout=1).stdoutm = re.search(r"used\s*=\s*([\d.]+)([KMG])", swap)if m:v = float(m.group(1))@@ -14963,7 +14988,7 @@ def _probe_video_dims(path: str) -> tuple[int, int]:out = subprocess.run([str(FFPROBE), "-v", "error", "-select_streams", "v:0","-show_entries", "stream=width,height", "-of", "csv=s=x:p=0", path],- capture_output=True, text=True, timeout=10,+ capture_output=True, text=True, errors="replace", timeout=10,).stdout.strip()if "x" in out:w, h = out.split("x", 1)@@ -14980,7 +15005,7 @@ def _probe_video_frames(path: str) -> int:[str(FFPROBE), "-v", "error", "-select_streams", "v:0","-count_packets", "-show_entries", "stream=nb_read_packets","-of", "csv=p=0", path],- capture_output=True, text=True, timeout=30,+ capture_output=True, text=True, errors="replace", timeout=30,).stdout.strip()return int(out.splitlines()[0]) if out else 0except Exception:@@ -14997,7 +15022,7 @@ def _probe_audio_state(path: str) -> str:r = subprocess.run([str(FFPROBE), "-v", "error", "-select_streams", "a","-show_entries", "stream=codec_type", "-of", "csv=p=0", path],- capture_output=True, text=True, timeout=30,+ capture_output=True, text=True, errors="replace", timeout=30,)except Exception: # noqa: BLE001return "unknown"@@ -15940,6 +15965,14 @@ class WarmHelper:self.gemma_max_length: int | None = Noneself._metal_timeout_seen = Falseself._past_prompt_encode = False+ # What the helper said on its way out. A helper that dies during+ # startup prints its traceback and exits, and the panel used to+ # report only the bookkeeping event — `helper failed to start:+ # {'event': 'exit', 'reason': 'python_normal_exit'}` — which is the+ # single most-reported failure in the fleet (85 events, 7 installs in+ # a week) and names no cause, no remedy and nothing to search for.+ # These are the lines that do.+ self._boot_tail: collections.deque = collections.deque(maxlen=14)def _ensure(self) -> None:with self.lock:@@ -16020,7 +16053,7 @@ class WarmHelper:[str(HELPER_PYTHON), str(HELPER_SCRIPT)],cwd=str(MLX), env=env,stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,- text=True, bufsize=1, start_new_session=True,+ text=True, errors="replace", bufsize=1, start_new_session=True,)# Crash guard: the helper is in its own session, so a SIGKILLed# panel would leave it resident holding the LTX weights while the@@ -16033,9 +16066,11 @@ class WarmHelper:# Fresh fd → drop any bytes carried over from a prior helper's pipe# so _read_until's line buffer starts clean for this process.self._read_carry = b""- ready = self._read_until(["ready", "error", "exit"], timeout=120)+ self._boot_tail.clear()+ ready = self._read_until(["ready", "error", "exit"], timeout=120,+ collect_tail=self._boot_tail)if not ready or ready.get("event") != "ready":- raise RuntimeError(f"helper failed to start: {ready}")+ raise RuntimeError(_helper_start_failure(ready, self._boot_tail))# v3.0.7 (P2): keep the version + model fields for /status.self.ready_info = {k: ready.get(k) for k in (@@ -16065,7 +16100,8 @@ class WarmHelper:def _read_until(self, target_events: list[str], timeout: float | None = None,log_hook: callable | None = None,- panic_check: callable | None = None) -> dict | None:+ panic_check: callable | None = None,+ collect_tail: collections.deque | None = None) -> dict | None:"""Read helper events until one of `target_events` arrives.``log_hook(line)`` is invoked for every log line the helper emits@@ -16140,6 +16176,8 @@ class WarmHelper:ev = json.loads(line)except json.JSONDecodeError:push(line)+ if collect_tail is not None:+ collect_tail.append(line)self._sniff_helper_line(line)if log_hook is not None:try: log_hook(line)@@ -16149,6 +16187,8 @@ class WarmHelper:if ev_type == "log":log_line = ev.get("line", "")push(log_line)+ if collect_tail is not None and log_line:+ collect_tail.append(log_line)self._sniff_helper_line(log_line)if log_hook is not None:try: log_hook(log_line)@@ -16665,7 +16705,7 @@ def _pid_cmdline(pid: int) -> str:enough here — this runs at most twice, at boot."""try:out = subprocess.run(["ps", "-o", "command=", "-p", str(pid)],- capture_output=True, text=True, timeout=5)+ capture_output=True, text=True, errors="replace", timeout=5)return (out.stdout or "").strip()except Exception: # noqa: BLE001return ""@@ -16803,7 +16843,7 @@ def _ffmpeg_has_filter(name: str) -> bool:ok = Falsetry:out = subprocess.run([str(FFMPEG), "-hide_banner", "-filters"],- capture_output=True, text=True, timeout=15)+ capture_output=True, text=True, errors="replace", timeout=15)ok = any(line.split()[1:2] == [name]for line in (out.stdout or "").splitlines() if line.strip())except Exception: # noqa: BLE001 — a probe must never break a render@@ -16991,7 +17031,7 @@ def _clear_job_pgid(key: str, pgid: int | None) -> None:def run_tracked_subprocess(cmd: list[str], *, pgid_key: str, label: str,job: dict | None = None, timeout: float | None = None,**popen_kw) -> subprocess.CompletedProcess:- """`subprocess.run(capture_output=True, text=True)`, but Stop can end it.+ """`subprocess.run(capture_output=True, text=True, errors="replace")`, but Stop can end it.Refuses to start after Stop, runs in its own process group registeredunder `pgid_key` (which `stop_current_job` kills), and kills the whole@@ -17002,8 +17042,11 @@ def run_tracked_subprocess(cmd: list[str], *, pgid_key: str, label: str,_raise_if_cancelled(job, label)popen_kw.pop("capture_output", None)popen_kw.pop("text", None)+ # Callers written as `subprocess.run(...)` pass the text-mode trio; this+ # function states all three itself, so none of them may arrive twice.+ popen_kw.pop("errors", None)proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,- text=True, start_new_session=True, **popen_kw)+ text=True, errors="replace", start_new_session=True, **popen_kw)# start_new_session: the child is its own group leader, pgid == pid (and# os.getpgid would race a child that has already exited).pgid = proc.pid@@ -17800,7 +17843,7 @@ def take_drift(path, duration: float | None = None) -> dict:if duration is None:try:duration = float(subprocess.run(["ffprobe", "-v", "error", "-show_entries", "format=duration",- "-of", "csv=p=0", str(path)], capture_output=True, text=True, timeout=30).stdout.strip())+ "-of", "csv=p=0", str(path)], capture_output=True, text=True, errors="replace", timeout=30).stdout.strip())except Exception: # noqa: BLE001duration = 0.0a = take_frame_light(path, TAKE_DRIFT_SAMPLE_SEC)@@ -19439,7 +19482,7 @@ def _sb_probe_clip(path) -> dict | None:[str(FFPROBE), "-v", "error", "-show_entries","stream=codec_type,width,height,sample_rate,duration:format=duration","-of", "json", str(p)],- capture_output=True, text=True, timeout=60,+ capture_output=True, text=True, errors="replace", timeout=60,)except (OSError, subprocess.SubprocessError):return None@@ -19504,7 +19547,7 @@ def _sb_probe_still(path) -> dict | None:out = subprocess.run([str(FFPROBE), "-v", "error", "-select_streams", "v:0","-show_entries", "stream=width,height", "-of", "json", str(p)],- capture_output=True, text=True, timeout=60)+ capture_output=True, text=True, errors="replace", timeout=60)except (OSError, subprocess.SubprocessError):return Noneif out.returncode != 0:@@ -19749,7 +19792,7 @@ def _sb_probe_audio_rate(path) -> int:[str(FFPROBE), "-v", "error", "-select_streams", "a:0","-show_entries", "stream=sample_rate", "-of","default=nw=1:nk=1", str(path)],- capture_output=True, text=True, timeout=60)+ capture_output=True, text=True, errors="replace", timeout=60)except (OSError, subprocess.SubprocessError):return 0try:@@ -21151,7 +21194,7 @@ def _sb_audio_peak(path) -> float | None:res = subprocess.run([FFMPEG, "-v", "info", "-nostdin", "-i", str(path),"-map", "0:a:0", "-af", "volumedetect", "-f", "null", "-"],- capture_output=True, text=True, timeout=120, check=False)+ capture_output=True, text=True, errors="replace", timeout=120, check=False)except (OSError, subprocess.SubprocessError):return Nonem = re.search(r"max_volume:\s*(-?\d+(?:\.\d+)?)\s*dB",@@ -22026,7 +22069,7 @@ def _sbe_probe_sound(path) -> dict | None:[str(FFPROBE), "-v", "error", "-show_entries","stream=codec_type,sample_rate,duration:format=duration","-of", "json", str(path)],- capture_output=True, text=True, timeout=60)+ capture_output=True, text=True, errors="replace", timeout=60)except (OSError, subprocess.SubprocessError):return Noneif out.returncode != 0:@@ -22575,13 +22618,167 @@ def _clamp_stage_steps_to_tables(job: dict) -> None:f"own schedule has {cap}; more would be padding, not quality.")[email protected]_cache(maxsize=1)+def _boot_volume_names() -> tuple[str, ...]:+ """Names that mean "/" when they appear at the front of a pasted path.++ Finder's path bar, its "Copy as pathname" on some systems, and every+ AppleScript-ish tool write the STARTUP DISK'S NAME in front of the path:+ `Macintosh HD/Users/me/clip.mp4`. macOS itself has no such path. The boot+ volume's own name is discovered (people rename their disk) and the factory+ default is always accepted, because the pasted string may well come from+ another Mac.+ """+ names = {"Macintosh HD"}+ try:+ for p in Path("/Volumes").iterdir():+ try:+ if os.path.realpath(p) == "/":+ names.add(p.name)+ except OSError:+ continue+ except OSError:+ pass+ return tuple(sorted(names, key=len, reverse=True))+++def normalize_pasted_path(value: str) -> str:+ """Turn what a human pasted into a path the filesystem answers to.++ Every field that takes a file accepts a pasted path, and what people paste+ is never the bare POSIX path: Finder's "Copy as pathname" wraps it in+ quotes and prefixes the startup disk's name, a drag into Terminal escapes+ every space with a backslash, a drag from a browser arrives as a `file://`+ URL, and shells hand out `~`. The fleet's own sentence for it is+ `control video not found: "'Macintosh HD<path> Tinder 1.mp4'"` — a real+ clip, a real user, and a render refused for punctuation.++ Conservative by construction: if the rewrite does not name an existing file+ and the raw string does, the raw string wins.+ """+ if not isinstance(value, str) or not value.strip():+ return value+ raw = value+ s = value.strip()+ if s.lower().startswith("file://"):+ parsed = urllib.parse.urlparse(s)+ if parsed.netloc in ("", "localhost"):+ s = urllib.parse.unquote(parsed.path)+ # Wrapping quotes, including the lopsided pair a half-selected copy leaves.+ for _ in range(2):+ s = s.strip()+ if len(s) >= 2 and s[0] == s[-1] and s[0] in "'\"":+ s = s[1:-1]+ else:+ s = s.strip("'\"")+ s = s.strip()+ # Terminal-style escapes: `Els\ Tinder\ 1.mp4`, `\(take\ 2\)`.+ if "\\" in s and not Path(s).exists():+ s = re.sub(r"\\(.)", r"\1", s)+ for name in _boot_volume_names():+ if s.startswith(f"/Volumes/{name}/"):+ s = s[len(f"/Volumes/{name}"):]+ break+ if s.startswith(f"{name}/"):+ s = s[len(name):]+ break+ if s.startswith(f"{name}:"):+ # HFS-style colon path (AppleScript, older "copy path" tools).+ s = "/" + s[len(name) + 1:].replace(":", "/")+ break+ if s.startswith("~"):+ s = os.path.expanduser(s)+ s = s.strip()+ if not s:+ return raw+ if s != raw:+ try:+ if not Path(s).exists() and Path(raw).exists():+ return raw+ except OSError:+ return raw+ return s+++_EXC_LINE_RX = re.compile(r"^[A-Za-z_][\w.]*(?:Error|Exception|Interrupt|Exit)\s*:\s*\S")+_NOISE_LINE_PREFIXES = ("step", "Window", "[", "Traceback", 'File "', "Invoked with",+ "The following argument types", "^^^", "~~~", "During handling",+ "The above exception")+++def failure_line(tail) -> str:+ """The line out of a dead subprocess's last lines that names the cause.++ "The last line" is not the same thing. A pybind11 type error ends with+ `Invoked with types: mlx.core.array, mlx.core.array` — three words of+ argument dump under the sentence that actually says what broke, and that+ dump is what the fleet recorded for a real H3 crash (4.13.0). So: prefer+ the line that names an exception, fall back to the last line that is not+ traceback scaffolding, and only then to the last line at all.+ """+ lines = [str(t).strip() for t in tail if str(t or "").strip()]+ if not lines:+ return ""+ for t in reversed(lines):+ if _EXC_LINE_RX.match(t):+ return t+ for t in reversed(lines):+ if not t.startswith(_NOISE_LINE_PREFIXES) and not t[0].isdigit():+ return t+ return lines[-1]+++def _helper_start_failure(ready: dict | None, tail) -> str:+ """The sentence the user gets when the render helper never comes up.++ Keeps the `helper failed to start` prefix (the fleet series and every+ support answer are keyed on it) and then says what the helper itself said+ plus what to do about it. Before this the whole message was the+ bookkeeping event, so the top failure in the fleet read+ `helper failed to start: {'event': 'exit', 'reason': 'python_normal_exit'}`+ — which means "it printed a traceback and exited" and told nobody that.+ """+ cause = failure_line(tail)+ event = (ready or {}).get("event") if isinstance(ready, dict) else None+ if ready is None:+ what = "it never reported ready"+ elif event == "exit":+ what = "it quit while loading"+ elif event == "error":+ what = "it reported an error while loading"+ else:+ what = f"it sent {event or ready}"+ msg = f"helper failed to start: {what}"+ if cause:+ msg += f" — last line: {cause[:220]}"+ msg += (". This is nearly always the install, not the render: click Update "+ "in Pinokio (or reinstall Phosphene) so the ltx-2-mlx folder and "+ "its Python environment are rebuilt. The whole trace is in Logs.")+ return msg+++# Form fields whose value is a path a human may have pasted. Anything added to+# make_job that names a file belongs here — the alternative is another+# "<thing> not found: '<quoted path>'" in the fleet.+PASTED_PATH_FIELDS = (+ "image", "audio", "video_path", "restore_video_path", "upscale_source_path",+ "control_video_path", "start_image", "end_image", "ingredient_char_lora",+)++def make_job(form: dict[str, list[str]] | dict[str, str], *,override_prompt: str | None = None) -> dict:def f(name: str, default: str = "") -> str:val = form.get(name, default)if isinstance(val, list):val = val[0] if val else default- return (val or "").strip() or default+ val = (val or "").strip() or default+ # Every field that names a file goes through the paste cleaner, once,+ # here — so the quoted, volume-prefixed, backslash-escaped path a user+ # pasted is a path by the time any gate looks at it.+ if name in PASTED_PATH_FIELDS and isinstance(val, str):+ val = normalize_pasted_path(val)+ return val# ---- mode == "image" branch ----# Image jobs use a different params shape (engine_override, aspect, n,@@ -22822,6 +23019,7 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,refs = json.loads(refs_raw)if not isinstance(refs, list):refs = []+ refs = [normalize_pasted_path(r) if isinstance(r, str) else r for r in refs]except (json.JSONDecodeError, ValueError):refs = []return {@@ -24109,6 +24307,7 @@ def run_image_job_inner(job: dict) -> None:for r in refs_in:if not isinstance(r, str) or not r.strip():raise RuntimeError("each ref must be a non-empty path string")+ r = normalize_pasted_path(r)rp = Path(r)rp = (rp if rp.is_absolute() else (UPLOADS / r)).resolve()# The character sheets are a legitimate reference too: the Storyboard's@@ -24642,7 +24841,7 @@ def run_train_job_inner(job: dict) -> None:cmd,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,- text=True,+ text=True, errors="replace",bufsize=1,env=_train_env,# Own process group so /stop can take down the entire trainer@@ -25035,7 +25234,7 @@ def run_train_job_inner(job: dict) -> None:audio_cmd,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,- text=True,+ text=True, errors="replace",bufsize=1,env={**os.environ},# Same reasoning as the face trainer above — own pgid so@@ -25244,7 +25443,7 @@ def _h3_clip_is_complete(path: Path, started_at: float,[ffprobe, "-v", "error", "-select_streams", "v:0","-show_entries", "stream=codec_type,nb_frames:format=duration","-of", "json", str(path)],- capture_output=True, text=True, timeout=20)+ capture_output=True, text=True, errors="replace", timeout=20)if out.returncode != 0:return Falseinfo = json.loads(out.stdout or "{}")@@ -26194,7 +26393,7 @@ def run_h3_job_inner(job: dict) -> None:env=env,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,- text=True,+ text=True, errors="replace",bufsize=1,# Own process group so /stop can take down caffeinate + python +# the ffmpeg it pipes into with one killpg.@@ -26251,7 +26450,9 @@ def run_h3_job_inner(job: dict) -> None:# (fleet 2026-09-03: 20 H3 failures on one release all read# "exited with code 1 — see the log above", which analytics cannot# see and users rarely paste). Traceback tails are what we want.- _h3_tail: collections.deque = collections.deque(maxlen=4)+ # Deep enough to hold a whole Python traceback's tail: the line that+ # names the exception can sit several lines above the last one.+ _h3_tail: collections.deque = collections.deque(maxlen=14)for raw in _h3_lines():line = raw.rstrip("\n")if not line.strip():@@ -26397,8 +26598,7 @@ def run_h3_job_inner(job: dict) -> None:raise RuntimeError(f"H3 helper exited from {_sig} ({_hint}) — see the log "f"above (metrics at {metrics_path}).")- _last = next((t for t in reversed(_h3_tail)- if t and not t.startswith(('step', 'Window', '['))), '')+ _last = failure_line(_h3_tail)raise RuntimeError(f"H3 render exited with code {rc}"+ (f" — last line: {_last[:220]}" if _last else "")@@ -27011,7 +27211,7 @@ def run_take_job_inner(job: dict) -> None:cut, end = ptstry:dur = float(subprocess.run(["ffprobe", "-v", "error", "-show_entries", "format=duration",- "-of", "csv=p=0", out], capture_output=True, text=True, timeout=30).stdout.strip())+ "-of", "csv=p=0", out], capture_output=True, text=True, errors="replace", timeout=30).stdout.strip())except Exception: # noqa: BLE001dur = 0.0if dur and 0.5 < cut < end <= dur:@@ -27615,7 +27815,7 @@ def run_job_inner(job: dict) -> None:_r = subprocess.run([str(FFPROBE), "-v", "error", "-select_streams", "v:0","-show_entries", "stream=r_frame_rate", "-of", "csv=p=0", src],- capture_output=True, text=True, timeout=30).stdout.strip()+ capture_output=True, text=True, errors="replace", timeout=30).stdout.strip()_n, _d = _r.split("/") if "/" in _r else (_r, "1")if float(_d) > 0 and 1.0 <= float(_n) / float(_d) <= 120.0:src_fps = round(float(_n) / float(_d), 3)@@ -27845,7 +28045,7 @@ def run_job_inner(job: dict) -> None:image_paths = []except (ValueError, TypeError):image_paths = []- image_paths = [str(x) for x in image_paths if x]+ image_paths = [normalize_pasted_path(str(x)) for x in image_paths if x]if len(image_paths) < 2:raise RuntimeError(f"Ingredients needs 2-8 reference images (got {len(image_paths)}). "@@ -28099,7 +28299,7 @@ def run_job_inner(job: dict) -> None:raise RuntimeError("keyframes_json must be a list with >=2 items")last_idx = -1for kf in parsed:- img = (kf.get("image_path") or "").strip()+ img = normalize_pasted_path((kf.get("image_path") or "").strip())idx = int(kf.get("frame_index", 0))if not img or not Path(img).exists():raise RuntimeError(f"keyframe image not found: {img}")diff --git a/mlx_warm_helper.py b/mlx_warm_helper.pyindex da5bdab..3b55bc0 100644--- a/mlx_warm_helper.py+++ b/mlx_warm_helper.py@@ -126,8 +126,8 @@ def _log_memory_pressure() -> None:try:import subprocess, retotal = int(subprocess.run(["sysctl", "-n", "hw.memsize"],- capture_output=True, text=True, timeout=1).stdout.strip())- vm = subprocess.run(["vm_stat"], capture_output=True, text=True, timeout=1).stdout+ capture_output=True, text=True, errors="replace", timeout=1).stdout.strip())+ vm = subprocess.run(["vm_stat"], capture_output=True, text=True, errors="replace", timeout=1).stdoutm = re.search(r"page size of (\d+)", vm)page_size = int(m.group(1)) if m else 16384def pages(name: str) -> int:@@ -1413,7 +1413,7 @@ def _a2v_pad_audio_to(audio_path: str, need_s: float,from ltx_core_mlx.utils.ffmpeg import find_ffmpeg, find_ffprobeout = _sp.run([find_ffprobe(), "-v", "error", "-show_entries", "format=duration","-of", "csv=p=0", audio_path],- capture_output=True, text=True, timeout=30).stdout.strip()+ capture_output=True, text=True, errors="replace", timeout=30).stdout.strip()have = float(out.splitlines()[0].strip(",")) - max(0.0, float(start_s))except Exception: # noqa: BLE001return audio_path, False@@ -2824,7 +2824,7 @@ def _detect_runtime_env() -> dict:try:import subprocess as _sp_chip = _sp.run(["sysctl", "-n", "machdep.cpu.brand_string"],- capture_output=True, text=True, timeout=3).stdout.strip()+ capture_output=True, text=True, errors="replace", timeout=3).stdout.strip()env["chip"] = _chip or Noneexcept Exception:pass@@ -2916,7 +2916,7 @@ def _physical_ram_bytes() -> int:try:import subprocess as _spout = _sp.run(["sysctl", "-n", "hw.memsize"],- capture_output=True, text=True, timeout=3).stdout.strip()+ capture_output=True, text=True, errors="replace", timeout=3).stdout.strip()return int(out)except Exception:return 0diff --git a/panel/routes_image.py b/panel/routes_image.pyindex b628002..f86cafa 100644--- a/panel/routes_image.py+++ b/panel/routes_image.py@@ -729,6 +729,7 @@ def post_image_generate(h, path, qs, ctype) -> None:for r in refs_in:if not isinstance(r, str) or not r.strip():h._json({"error": "each ref must be a non-empty path"}, 400); return+ r = P.normalize_pasted_path(r)rp = P.Path(r)if not rp.is_absolute():rp = (P.UPLOADS / r).resolve()diff --git a/panel/routes_meta.py b/panel/routes_meta.pyindex fd5687b..05a780e 100644--- a/panel/routes_meta.py+++ b/panel/routes_meta.py@@ -149,7 +149,7 @@ def get_panel_bug_context(h, parsed) -> None:try:mac_ver = P.subprocess.run(["sw_vers", "-productVersion"],- capture_output=True, text=True, timeout=2,+ capture_output=True, text=True, errors="replace", timeout=2,).stdout.strip()except Exception: # noqa: BLE001pass@@ -157,7 +157,7 @@ def get_panel_bug_context(h, parsed) -> None:try:hw_model = P.subprocess.run(["sysctl", "-n", "hw.model"],- capture_output=True, text=True, timeout=2,+ capture_output=True, text=True, errors="replace", timeout=2,).stdout.strip()except Exception: # noqa: BLE001passdiff --git a/panel/routes_train.py b/panel/routes_train.pyindex 87d3e92..b9bead4 100644--- a/panel/routes_train.py+++ b/panel/routes_train.py@@ -537,7 +537,7 @@ def post_train_auto_caption(h, path, qs, ctype) -> None:cmd,stdout=P.subprocess.PIPE,stderr=P.subprocess.STDOUT,- text=True,+ text=True, errors="replace",bufsize=1,# Own process group so /stop's killpg can take down# the captioner + any child it spawned.@@ -1071,7 +1071,7 @@ def post_train_upload_voice(h, path, qs, ctype) -> None:"-show_entries", "format=duration","-of", "default=noprint_wrappers=1:nokey=1",str(dest)],- capture_output=True, text=True, timeout=10,+ capture_output=True, text=True, errors="replace", timeout=10,)if out.returncode == 0 and out.stdout.strip():duration_s = float(out.stdout.strip())diff --git a/scripts/check_output_codec.py b/scripts/check_output_codec.pyindex 55cd6a3..fe98c4b 100644--- a/scripts/check_output_codec.py+++ b/scripts/check_output_codec.py@@ -117,7 +117,7 @@ def probe_pix_fmt(path: Path, ffprobe: Path) -> str:proc = subprocess.run([str(ffprobe), "-v", "error", "-select_streams", "v:0","-show_entries", "stream=pix_fmt", "-of", "csv=p=0", str(path)],- capture_output=True, text=True, timeout=60,+ capture_output=True, text=True, errors="replace", timeout=60,)out = (proc.stdout or "").strip()if proc.returncode != 0 or not out:diff --git a/scripts/join_smooth.py b/scripts/join_smooth.pyindex 824dfff..76bc3b1 100644--- a/scripts/join_smooth.py+++ b/scripts/join_smooth.py@@ -29,7 +29,7 @@ FP = os.path.join(os.path.dirname(FF), "ffprobe") if os.path.dirname(FF) else "fdef probe(p):j = json.loads(subprocess.run([FP, "-v", "error", "-select_streams", "v:0", "-show_entries","stream=width,height,r_frame_rate", "-of", "json", p],- capture_output=True, text=True, check=True).stdout)["streams"][0]+ capture_output=True, text=True, errors="replace", check=True).stdout)["streams"][0]num, den = j["r_frame_rate"].split("/"); return int(j["width"]), int(j["height"]), float(num) / float(den)def frames(p, w, h):@@ -118,7 +118,7 @@ def main():subprocess.run([FF, "-v", "error", "-y", "-i", parts[0], "-vn", "-c:a", "aac", "-b:a", "192k", aud], check=True)else:durs = [float(subprocess.run([FP, "-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", q],- capture_output=True, text=True).stdout.strip()) for q in parts]+ capture_output=True, text=True, errors="replace").stdout.strip()) for q in parts]for i, d in enumerate(durs):fin = f"afade=t=in:st=0:d=0.015," if i > 0 else ""fout = f"afade=t=out:st={max(0.0, d - 0.015):.3f}:d=0.015" if i < len(parts) - 1 else "anull"diff --git a/scripts/music/yue2_run.py b/scripts/music/yue2_run.pyindex 4d615ae..999d299 100644--- a/scripts/music/yue2_run.py+++ b/scripts/music/yue2_run.py@@ -165,6 +165,10 @@ def main(argv=None):signal.signal(signal.SIGINT, on_signal)os.environ.setdefault("MLX_ENABLE_TF32", "0")+ # lyra/pipeline.py rejects these PyTorch MPS vars (it's an MLX runtime; fallback+ # paths are not validated). Strip them if the parent env (e.g. Pinokio) set them.+ os.environ.pop("PYTORCH_ENABLE_MPS_FALLBACK", None)+ os.environ.pop("PYTORCH_MPS_FAST_MATH", None)say("stage", "loading")import mlx.core as mxfrom yue2.protocol import GenerationConfigdiff --git a/scripts/publish_pack_release.py b/scripts/publish_pack_release.pyindex 4199692..98226ac 100644--- a/scripts/publish_pack_release.py+++ b/scripts/publish_pack_release.py@@ -206,7 +206,7 @@ def asset_name(prefix: str, filename: str, shard_idx: int | None) -> str:# --------------------------------------------------------------------------- #def gh(*args: str, check: bool = True, capture: bool = True) -> subprocess.CompletedProcess:return subprocess.run(["gh", *args], check=check,- capture_output=capture, text=True)+ capture_output=capture, text=True, errors="replace")def release_assets(release_repo: str, tag: str) -> dict[str, int]:diff --git a/storyboard_edit.py b/storyboard_edit.pyindex 411d65c..37b2cc5 100644--- a/storyboard_edit.py+++ b/storyboard_edit.py@@ -197,7 +197,7 @@ def probe_media(path) -> dict | None:[str(FFPROBE), "-v", "error", "-show_entries","stream=codec_type,width,height,sample_rate,duration,avg_frame_rate"":format=duration", "-of", "json", str(p)],- capture_output=True, text=True, timeout=120)+ capture_output=True, text=True, errors="replace", timeout=120)except (OSError, subprocess.SubprocessError):return Noneif out.returncode != 0:diff --git a/storyboard_planner.py b/storyboard_planner.pyindex 756d270..e4f6ccc 100644--- a/storyboard_planner.py+++ b/storyboard_planner.py@@ -2566,7 +2566,7 @@ class PlannerSession(object):self.proc = subprocess.Popen([str(self.python_exe), str(Path(__file__).resolve()), "--serve"],stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,- env=env, cwd=str(ROOT), text=True, bufsize=1,+ env=env, cwd=str(ROOT), text=True, errors="replace", bufsize=1,)self.stats["released"] = Falsediff --git a/test_music_engine.py b/test_music_engine.pyindex fe95ef0..7ac6e14 100644--- a/test_music_engine.py+++ b/test_music_engine.py@@ -857,3 +857,96 @@ def test_install_refusals(pack, monkeypatch, http_server):monkeypatch.setattr(P, "SYSTEM_RAM_GB", 64.0)monkeypatch.setitem(P.STATE, "current", {"params": {"engine": "music"}})assert P.music_install_start()[0] == 409+++# ---- the Pinokio env trap (v4.14.3) ------------------------------------------+# Pinokio's shell exports PYTORCH_ENABLE_MPS_FALLBACK=1 into every app it+# starts. `lyra/pipeline.py` refuses to construct with it set ("Unset+# PYTORCH_ENABLE_MPS_FALLBACK; fallback/fast-math is not a validated execution+# path"), so on 4.14.0 every song on a Pinokio-started panel died before the+# first note: nine failures across three installs in the fleet, and the only+# successes came from users who unset the var and restarted the panel.++# What the pinned engine actually does, copied from+# yue2-mlx/src/lyra/pipeline.py:118 — a stub runner that enforces it, so this+# suite fails the moment the panel stops scrubbing the env.+GUARD_STUB = '''import os, sys, json, pathlib+for name in ("PYTORCH_ENABLE_MPS_FALLBACK", "PYTORCH_MPS_FAST_MATH"):+ if os.environ.get(name) == "1":+ print("[music] error RuntimeError: Unset %s; fallback/fast-math is not a "+ "validated execution path" % name, flush=True)+ sys.exit(1)+if os.environ.get("MLX_ENABLE_TF32") != "0":+ print("[music] error TF32 was left on", flush=True)+ sys.exit(1)+args = sys.argv+out = pathlib.Path(args[args.index("--output") + 1])+print("[music] stage loading", flush=True)+print("[music] song 25/25", flush=True)+out.write_bytes(b"fixture WAV")+pathlib.Path(str(out) + ".json").write_text(json.dumps({+ "argv": args[1:], "mode": args[args.index("--mode") + 1],+ "steps": args[args.index("--steps") + 1],+ "instrumental": "--instrumental" in args}))+print("[music] done 5 " + str(out), flush=True)+'''+++def test_music_child_env_drops_the_pinokio_torch_vars():+ env = P.music_child_env({"PATH": "/bin", "HF_HOME": "/hf",+ "PYTORCH_ENABLE_MPS_FALLBACK": "1",+ "PYTORCH_MPS_FAST_MATH": "1"})+ assert "PYTORCH_ENABLE_MPS_FALLBACK" not in env+ assert "PYTORCH_MPS_FAST_MATH" not in env+ assert env["HF_HOME"] == "/hf" and env["PATH"] == "/bin"+ assert env["MLX_ENABLE_TF32"] == "0" and env["PYTHONUNBUFFERED"] == "1"+++def test_music_child_env_reads_the_live_environment_by_default(monkeypatch):+ monkeypatch.setenv("PYTORCH_ENABLE_MPS_FALLBACK", "1")+ monkeypatch.setenv("PYTORCH_MPS_FAST_MATH", "1")+ assert "PYTORCH_ENABLE_MPS_FALLBACK" not in P.music_child_env()+ assert "PYTORCH_MPS_FAST_MATH" not in P.music_child_env()++[email protected]("mode", ["full", "melody", "off"])[email protected]("quality", ["draft", "final"])[email protected]("instrumental", [False, True])+def test_every_music_mode_survives_a_pinokio_environment(+ pack, monkeypatch, tmp_path, mode, quality, instrumental):+ """Every mode the form can ask for, spawned under Pinokio's own env."""+ monkeypatch.setenv("PYTORCH_ENABLE_MPS_FALLBACK", "1")+ monkeypatch.setenv("PYTORCH_MPS_FAST_MATH", "1")+ monkeypatch.delenv("MLX_ENABLE_TF32", raising=False)+ stub = tmp_path / f"guard_runner_{mode}_{quality}_{int(instrumental)}.py"+ stub.write_text(GUARD_STUB)+ monkeypatch.setattr(P, "MUSIC_RUNNER", stub)+ monkeypatch.setattr(P.HELPER, "kill", lambda: None)+ form = {"mode": "music", "music_style": "warm analogue synth",+ "music_lyrics": "[Verse]\nlow sun on the ring road",+ "music_mode": mode, "music_quality": quality}+ if instrumental:+ form["music_instrumental"] = "1"+ job = P.make_job(form)+ P.STATE["current"] = job+ P.run_job_inner(job)+ assert job["error"] is None, job["error"]+ assert Path(job["output_path"]).is_file()+ seen = json.loads(Path(job["output_path"] + ".json").read_text())+ assert seen["mode"] == mode+ assert seen["steps"] == str(P.MUSIC_QUALITY_STEPS[quality])+ assert seen["instrumental"] is instrumental+++def test_the_runner_itself_strips_the_vars_before_importing_the_engine():+ src = (ROOT / "scripts/music/yue2_run.py").read_text()+ for name in ("PYTORCH_ENABLE_MPS_FALLBACK", "PYTORCH_MPS_FAST_MATH"):+ popped = src.index(f'os.environ.pop("{name}", None)')+ assert popped < src.index("from lyra.pipeline import YuE2Pipeline")+++def test_the_panel_spawns_music_through_the_scrubbed_env():+ src = Path(P.__file__).read_text()+ body = src[src.index("def run_music_job_inner"):src.index("ENGINE_DEFAULT = ")]+ assert "env=music_child_env()" in body+ assert "env={**os.environ" not in bodydiff --git a/test_pasted_paths.py b/test_pasted_paths.pynew file mode 100644index 0000000..43d91d2--- /dev/null+++ b/test_pasted_paths.py@@ -0,0 +1,192 @@+"""Pasted paths, tolerant decoding and useful failure lines (v4.14.3).++Three fleet failures share one shape — the panel refused work over punctuation+or died on a byte, and told the user something that named no cause:++ * `control video not found: "'Macintosh HD<path> Tinder 1.mp4'"` — a Finder+ "Copy as pathname" (quotes + startup-disk name) and a Terminal drag+ (backslash-escaped spaces), pasted into the Control video field.+ * `'utf-8' codec can't decode byte 0xb0 in position 37` — a subprocess line+ that was not UTF-8, decoded strictly, killing the render that spawned it.+ * `helper failed to start: {'event': 'exit', 'reason': 'python_normal_exit'}`+ — the top failure in the fleet, whose text is bookkeeping: the helper+ printed a traceback and exited, and the message mentioned neither.++CPU only, no renders.+"""+from __future__ import annotations++import os+from pathlib import Path+import re+import tempfile++import pytest++ROOT = Path(__file__).resolve().parent+os.environ.setdefault("LTX_STATE_DIR", tempfile.mkdtemp(prefix="paste-test-state-"))+os.environ["PHOSPHENE_ANALYTICS_DISABLED"] = "1"+os.environ["PHOSPHENE_DISABLE_VERSION_CHECK"] = "1"+import mlx_ltx_panel as P+++# ---- what people paste -------------------------------------------------------+[email protected]("pasted,expect", [+ ("'/Users/me/clips/Tinder 1.mp4'", "/Users/me/clips/Tinder 1.mp4"),+ ('"/Users/me/clips/Tinder 1.mp4"', "/Users/me/clips/Tinder 1.mp4"),+ ("Macintosh HD/Users/me/clips/Tinder 1.mp4", "/Users/me/clips/Tinder 1.mp4"),+ ("'Macintosh HD/Users/me/Els Rechts/Tinder 1.mp4'", "/Users/me/Els Rechts/Tinder 1.mp4"),+ ("/Volumes/Macintosh HD/Users/me/a.mp4", "/Users/me/a.mp4"),+ ("Macintosh HD:Users:me:a.mp4", "/Users/me/a.mp4"),+ ("/Users/me/Els\\ Rechts/Tinder\\ 1.mp4", "/Users/me/Els Rechts/Tinder 1.mp4"),+ ("file:///Users/me/clips/Tinder%201.mp4", "/Users/me/clips/Tinder 1.mp4"),+ ("file://localhost/Users/me/a.mp4", "/Users/me/a.mp4"),+ (" /Users/me/a.mp4\n", "/Users/me/a.mp4"),+ ("/Users/me/a.mp4'", "/Users/me/a.mp4"),+ ("'Macintosh HD/Users/me/Els\\ Rechts/Tinder\\ 1.mp4'", "/Users/me/Els Rechts/Tinder 1.mp4"),+])+def test_normalize_pasted_path(pasted, expect):+ assert P.normalize_pasted_path(pasted) == expect+++def test_tilde_becomes_the_home_directory():+ assert P.normalize_pasted_path("~/a.mp4") == str(Path.home() / "a.mp4")+++def test_empty_and_plain_values_are_untouched():+ assert P.normalize_pasted_path("") == ""+ assert P.normalize_pasted_path(" ") == " "+ assert P.normalize_pasted_path("/Users/me/a.mp4") == "/Users/me/a.mp4"+ assert P.normalize_pasted_path("panel_uploads/ref.png") == "panel_uploads/ref.png"+ assert P.normalize_pasted_path(None) is None+++def test_a_real_file_always_wins_over_the_rewrite(tmp_path):+ """A file whose NAME contains a backslash is not an escaped space."""+ odd = tmp_path / "take\\ 2.mp4"+ odd.write_bytes(b"x")+ assert P.normalize_pasted_path(str(odd)) == str(odd)+++def test_the_boot_volume_is_discovered_not_only_guessed():+ names = P._boot_volume_names()+ assert "Macintosh HD" in names+ for name in names:+ assert os.path.realpath(f"/Volumes/{name}") == "/" or name == "Macintosh HD"+++# ---- and where it reaches the job -------------------------------------------++def test_make_job_cleans_every_path_field():+ job = P.make_job({+ "mode": "control",+ "prompt": "a hand turning a page",+ "control_video_path": "'Macintosh HD/Users/me/Els Rechts/Tinder 1.mp4'",+ "image": '"Macintosh HD/Users/me/ref.png"',+ "audio": "file:///Users/me/song%20one.wav",+ "video_path": "/Users/me/Els\\ Rechts/source.mp4",+ "upscale_source_path": "Macintosh HD/Users/me/clip.mp4",+ "restore_video_path": "~/bw.mp4",+ "start_image": "'/Users/me/a.png'",+ "end_image": "'/Users/me/b.png'",+ })+ p = job["params"]+ assert p["control_video_path"] == "/Users/me/Els Rechts/Tinder 1.mp4"+ assert p["image"] == "/Users/me/ref.png"+ assert p["audio"] == "/Users/me/song one.wav"+ assert p["video_path"] == "/Users/me/Els Rechts/source.mp4"+ assert p["upscale_source_path"] == "/Users/me/clip.mp4"+ assert p["restore_video_path"] == str(Path.home() / "bw.mp4")+ assert p["start_image"] == "/Users/me/a.png" and p["end_image"] == "/Users/me/b.png"+++def test_make_job_cleans_image_refs():+ job = P.make_job({"mode": "image", "prompt": "a ring road at dusk",+ "refs": '["Macintosh HD/Users/me/ref.png", "\'/Users/me/two.png\'"]'})+ assert job["params"]["refs"] == ["/Users/me/ref.png", "/Users/me/two.png"]+++def test_every_path_field_make_job_reads_is_declared():+ """A path field added to make_job without joining PASTED_PATH_FIELDS is+ the same silent no-op as the allowlist trap it lives next to."""+ src = Path(P.__file__).read_text()+ body = src[src.index("def make_job("):src.index("def _queue_snapshot")+ if "def _queue_snapshot" in src else src.index("def make_job(") + 60000]+ named = set(re.findall(r'"([a-z0-9_]*(?:image|audio|video_path|source_path))": f\(', body))+ missing = {n for n in named if n not in P.PASTED_PATH_FIELDS} - {+ "ingredient_images_json", "stage2_image_conditioning"}+ assert not missing, f"path-ish make_job fields outside PASTED_PATH_FIELDS: {missing}"+++# ---- the line that names the cause ------------------------------------------++def test_failure_line_prefers_the_exception_over_pybind_argument_dump():+ tail = [+ " File \"/x/minimax_h3_mlx/denoise.py\", line 91, in step",+ " out = mx.matmul(a, b)",+ "TypeError: matmul(): incompatible function arguments. The following argument types are supported:",+ " 1. (a: array, b: array, *, stream: Stream | Device | None = None) -> array",+ "Invoked with types: mlx.core.array, mlx.core.array",+ ]+ assert P.failure_line(tail).startswith("TypeError: matmul()")+++def test_failure_line_falls_back_to_the_last_real_line():+ assert P.failure_line(["step 3/8", "[h3] window 1", "killed by the sandbox"]) == "killed by the sandbox"+ assert P.failure_line(["step 3/8", "Window 2/2"]) == "Window 2/2"+ assert P.failure_line([]) == "" and P.failure_line(["", " "]) == ""+++def test_h3_failure_uses_it_and_keeps_a_deep_tail():+ src = Path(P.__file__).read_text()+ assert "_last = failure_line(_h3_tail)" in src+ assert "collections.deque(maxlen=14)" in src[src.index("_h3_tail: collections.deque"):+ src.index("_h3_tail: collections.deque") + 120]+++def test_helper_start_failure_says_what_happened_and_what_to_do():+ msg = P._helper_start_failure(+ {"event": "exit", "reason": "python_normal_exit"},+ ["Traceback (most recent call last):",+ ' File "/x/mlx_warm_helper.py", line 1, in <module>',+ "ModuleNotFoundError: No module named 'ltx_core_mlx'"])+ assert msg.startswith("helper failed to start:") # the fleet series+ assert "quit while loading" in msg+ assert "ModuleNotFoundError: No module named 'ltx_core_mlx'" in msg+ assert "Update" in msg and "Logs" in msg+ assert "python_normal_exit" not in msg+ timeout = P._helper_start_failure(None, [])+ assert timeout.startswith("helper failed to start:") and "never reported ready" in timeout+++def test_helper_start_failure_is_classified_as_a_start_failure():+ msg = P._helper_start_failure({"event": "exit"}, ["ImportError: bad venv"])+ assert P._analytics_error_class(msg) == "helper_start_timeout"+++# ---- no strict decode of somebody else's bytes -------------------------------++SHIPPED = [+ "mlx_ltx_panel.py", "mlx_warm_helper.py", "image_engine.py", "storyboard_edit.py",+ "storyboard_planner.py", "panel/routes_meta.py", "panel/routes_train.py",+ "scripts/check_output_codec.py", "scripts/join_smooth.py", "scripts/publish_pack_release.py",+]+++def test_no_subprocess_pipe_decodes_strict_utf8():+ """`text=True` without `errors=` is a strict UTF-8 decode of another+ program's output. One non-UTF-8 byte from ffmpeg, a trainer or a runner+ then ends the render — the fleet's `'utf-8' codec can't decode byte 0xb0+ in position 37` (42 events, three installs), which no user could act on.+ """+ offenders = []+ for name in SHIPPED:+ lines = (ROOT / name).read_text().split("\n")+ for i, line in enumerate(lines):+ if "text=True" not in line:+ continue+ window = " ".join(lines[max(0, i - 2):i + 3])+ if "errors=" not in window:+ offenders.append(f"{name}:{i + 1}")+ assert not offenders, f"strict-utf8 subprocess pipes: {offenders}"diff --git a/webapp/style/panel.css b/webapp/style/panel.cssindex 4cd0eff..41a4218 100644--- a/webapp/style/panel.css+++ b/webapp/style/panel.css@@ -6778,10 +6778,14 @@border-color: rgba(255,117,109,.55);}.live-stage-stop:disabled { opacity:.55; cursor:wait; }+ /* Owner 2026-09-17: it used to sit top-centre, straight over the clip+ action row (Params / Extend / Upscale & Face Fix / To film), so you+ could not re-use params while a take was forming. It lives at the+ bottom-left now, clear of the action row AND of the native controls. */.live-return-chip {- position: absolute; top: 12px; left: 50%; z-index: 5;- transform: translateX(-50%);+ position: absolute; bottom: 54px; left: 12px; z-index: 5;display: inline-flex; align-items: center; gap: 7px;+ width: fit-content; max-width: calc(100% - 24px); align-self: flex-start;min-height: 29px; padding: 0 11px;border-radius: var(--r-pill);border: 1px solid rgba(88,166,255,.42);