Skip to content

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.

release(v4.19.17): fewer crashes when a video starts, clear messages instead of dead-end errors, a one-time star card

mrbizarroda0c895849d6
diff --git a/README.md b/README.md
index d048c51..981f617 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ It runs **LTX-2.5** and **MiniMax H3 (Hailuo H3)** for text-to-video and image-t
and is built on Apple's MLX: no CUDA, no cloud GPU, no API key, no credits and no watermark.
Your prompts, pictures and videos never leave your Mac.
-**Current release: v4.19.16.** Made by Mr Bizarro.
+**Current release: v4.19.17.** Made by Mr Bizarro.
## Why Phosphene
diff --git a/VERSION b/VERSION
index 5d79012..7693a42 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.19.16
+4.19.17
diff --git a/docs/ANALYTICS.md b/docs/ANALYTICS.md
index 124d746..d3ab70f 100644
--- a/docs/ANALYTICS.md
+++ b/docs/ANALYTICS.md
@@ -245,7 +245,8 @@ Same as `render_completed` (minus `first_render`), plus:
| `error_signature` | string | `"RuntimeError: helper exited before first frame"` | **The only free-text field the panel sends**, see the scrubbing rules below. Kept for ONE transition release alongside `error_class`, then removed |
| `crash_line` | string | `"gpu_timeout"` | 4.19.2 — only when the LTX render helper died from a signal (SIGABRT, SIGSEGV, …): the **class** of the last native error line it printed, never the line. **Closed vocabulary**: `gpu_timeout`, `gpu_interactivity` (the two GPU-watchdog names), `gpu_hang`, `gpu_page_fault`, `gpu_oom`, `gpu_victim`, `gpu_internal`, `gpu_submissions_ignored`, `gpu_invalid_resource`, `gpu_not_permitted`, `gpu_device_removed` (4.19.4 - the remaining IOGPU/Metal command-buffer error names, split out of `gpu_other`), `gpu_other` (any other Metal command-buffer error), `resource_limit`, `cxx_exception`, `assertion`, `none` (no such line reached the panel). Why: until 4.19.2 the generic SIGABRT sentence quoted the watchdog line as an example, so every unexplained abort was counted as `metal_watchdog` (24 of 4.19.1's 37); those now count as `native_crash`, and this says what they were |
| `crash_phase` | string | `"start"` | 4.19.2 — same condition as `crash_line`: how far the helper got, from its own step lines. **Closed vocabulary**: `encode`, `load`, `denoise`, `decode` (as `watchdog_phase`), `start` (before its first step line) |
-| `train_error` | string | `"oom"` | 4.19.1 — only on a failed **training** job (`mode: train`): why it stopped. **Closed vocabulary**: `oom` (MLX/Metal could not allocate, or macOS killed the trainer with SIGKILL), `missing_file` (incl. the LTX-2.3 training weights not downloaded: the trainer now checks them first and stops within seconds), `caption_check` (the captions carry another trigger), `disk_full`, `import_error` (the venv is missing a package), `nan_loss` (the loss stopped being a number for 10 steps in a row; the trainer now stops there), `other`. The trainer classifies its own exception by TYPE first and then by MLX's fixed allocation-failure fragments (`lora_lab/failure.py`), sends the word in its `error` event, and the panel forwards it only if it is on this list. Never a path, caption, trigger or message: those stay in the Logs tab and `<dataset>/train.log`. Before 4.19.1 every one of these reached the fleet as `helper_exit` + "training exited with code 1"; that sentence and its `error_class` are unchanged, so the old series continues and `train_error` splits it |
+| `train_error` | string | `"oom"` | 4.19.1 — only on a failed **training** job (`mode: train`): why it stopped. **Closed vocabulary**: `oom` (MLX/Metal could not allocate, or macOS killed the trainer with SIGKILL), `missing_file` (incl. the LTX-2.3 training weights not downloaded: the trainer now checks them first and stops within seconds), `caption_check` (the captions carry another trigger), `disk_full`, `import_error` (the venv is missing a package), `nan_loss` (the loss stopped being a number for 10 steps in a row; the trainer now stops there), `other`. The trainer classifies its own exception by TYPE first and then by MLX's fixed allocation-failure fragments (`lora_lab/failure.py`), sends the word in its `error` event, and the panel forwards it only if it is on this list. Never a path, caption, trigger or message: those stay in the Logs tab and `<dataset>/train.log`. Before 4.19.1 every one of these reached the fleet as `helper_exit` + "training exited with code 1"; that sentence and its `error_class` stayed until 4.19.17, when the card started showing the trainer's own sentence (so `error_class` for a training failure now follows that sentence, and `error_signature` is the fixed line described under `train_stage`). Read training failures by `train_error` + `train_stage`, not `error_class` |
+| `train_stage` | string | `"preprocess"` | 4.19.17 — only on a failed **training** job, next to `train_error`: where the trainer stopped. **Closed vocabulary** (`lora_lab/failure.py` `TRAIN_STAGES`): `models`, `caption`, `config`, `ingest`, `crop`, `preprocess`, `train`, `publish`, `sidecar`, `validate`, `verify`, `unknown` (the trainer died before it said; then `train_error` is read from the last traceback line's exception TYPE). From 4.19.17 a training failure's `error_signature` is the fixed line `training stopped: <train_error> (stage <train_stage>)` built from these two words, because the card now shows the trainer's own sentence (which can quote a trigger or file name) and that text never leaves the Mac. A run that died with no word and no traceback still sends "training exited with code N" |
Cancelled jobs are **not** reported — a user cancelling is not a signal about
the software.
@@ -294,7 +295,7 @@ The surfaces render events cannot see. One event per action, no free text.
| prop | type | example | why |
|---|---|---|---|
-| `feature` | string | `"storyboard_plan"` | **Closed vocabulary**: `storyboard_plan`, `storyboard_export`, `editor_open`, `editor_export`, `civitai_download`, `sample_character`, `train_start`, `enhance_prompt`, `train_refused`, `enhance_prompt` is sent by the server when an Enhance succeeds, with the mode (`t2v`, `i2v`, `a2v`) as `detail` (from 2026-10-19; before that nothing sent it, so earlier zeros mean unmeasured, not unused). `share` (the clip toolbar's Share: a caption with the Phosphene link copied and the file selected in Finder; only that the button was used is sent, never which clip). Unknown names are dropped locally, never sent. `train_start` fires only past `/train/start`'s RAM refusal (SYS-41) — a refused click counts as `train_refused` with `detail: "ram"` instead |
+| `feature` | string | `"storyboard_plan"` | **Closed vocabulary**: `storyboard_plan`, `storyboard_export`, `editor_open`, `editor_export`, `civitai_download`, `sample_character`, `train_start`, `enhance_prompt`, `train_refused`, `enhance_prompt` is sent by the server when an Enhance succeeds, with the mode (`t2v`, `i2v`, `a2v`) as `detail` (from 2026-10-19; before that nothing sent it, so earlier zeros mean unmeasured, not unused). `share` (the clip toolbar's Share: a caption with the Phosphene link copied and the file selected in Finder; only that the button was used is sent, never which clip). Unknown names are dropped locally, never sent. `train_start` fires only past `/train/start`'s RAM refusal (SYS-41) — a refused click counts as `train_refused` with `detail: "ram"` instead, or (4.19.17+) `detail: "models"` when the LTX-2.3 training weights are not downloaded |
| `detail` | string | `"nle"` | Optional, lowercase `[a-z0-9_.-]` only, ≤32 chars — a sub-choice within the feature |
| `version` | string | `"4.9.7"` | As on `app_boot` |
@@ -425,7 +426,7 @@ Once per job the panel **declined on purpose**. Same fields as
| Field | Type | Example | Notes |
|---|---|---|---|
-| `refusal` | string | `"ingredients_generation"` | **A closed vocabulary** — `ingredients_generation`, `hardware_tier`, `h3_ram`, `h3_mode`, `h3_lora_slots`, `stale_engine` (v4.9+: a 2.5 render refused because the vendored engine predates the Gemma 4 tower — remedy is a second Update click). `image_ram` (v4.9.3+: the Image Studio memory guard — the engine holds more weights than this Mac can hold, or too little is free right now). `pack_missing` (v4.9.3+: High / Keyframes / Extend chosen on a Mac that has not downloaded the Q8 add-on — remedy is Settings → Models). `vocal_separator` (4.17.x+: Lip-sync with "Listen to the voice only" on an install whose vocal separation is missing — remedy is the form's own Install button). `licence_required` (4.19.8+: a model whose licence asks for an "I accept" - Hailuo H3, Ideogram 4, YuE2, FLUX.1 Krea [dev], Bria FIBO - before it was accepted on this Mac; remedy is the licence screen, once). `pack_incomplete` (4.19.16+: an LTX render on a pack that is not completely on disk and is not downloading, named file by file; remedy is Repair. Before 4.19.16 these were `render_failed`; a pack that is still downloading now waits instead). `memory_low` (4.19.16+: a Mac with 24 GB or less whose prompt encoding macOS stopped in the last 30 minutes, still short of memory after a 90 s wait; remedy is quitting other apps). Which guard said no. No free text, no fingerprint: the message is our own copy, so there is nothing to scrub and nothing unknown to count |
+| `refusal` | string | `"ingredients_generation"` | **A closed vocabulary** — `ingredients_generation`, `hardware_tier`, `h3_ram`, `h3_mode`, `h3_lora_slots`, `stale_engine` (v4.9+: a 2.5 render refused because the vendored engine predates the Gemma 4 tower — remedy is a second Update click). `image_ram` (v4.9.3+: the Image Studio memory guard — the engine holds more weights than this Mac can hold, or too little is free right now). `pack_missing` (v4.9.3+: High / Keyframes / Extend chosen on a Mac that has not downloaded the Q8 add-on — remedy is Settings → Models). `vocal_separator` (4.17.x+: Lip-sync with "Listen to the voice only" on an install whose vocal separation is missing — remedy is the form's own Install button). `licence_required` (4.19.8+: a model whose licence asks for an "I accept" - Hailuo H3, Ideogram 4, YuE2, FLUX.1 Krea [dev], Bria FIBO - before it was accepted on this Mac; remedy is the licence screen, once). `pack_incomplete` (4.19.16+: an LTX render on a pack that is not completely on disk and is not downloading, named file by file; remedy is Repair. Before 4.19.16 these were `render_failed`; a pack that is still downloading now waits instead). `memory_low` (4.19.16+: a Mac with 24 GB or less whose prompt encoding macOS stopped in the last 30 minutes, still short of memory after a 90 s wait; remedy is quitting other apps). `train_models` (4.19.17+: a training run whose LTX-2.3 weights - the base pack or the full-precision dev transformer - are not on this Mac; refused at Start, at Retry and before the trainer spawns, with the Train tab's Download all. Before 4.19.17 these were `render_failed` with `train_error: missing_file`, one Mac 22 times in an hour). `lora_mismatch` (4.19.17+: an Image render with a FLUX.2 LoRA made for another FLUX.2 size - a [klein] 9B or [dev] adapter on the [klein] 4B that Auto and Klein-Edit run - stopped before the engine starts; remedy is un-picking it. Before 4.19.17 these were `render_failed` with mflux's `[matmul] Last dimension of first input`). `image_refs` (4.19.17+: an Image render with more reference images than its engine takes - 3, FLUX 3 10 - reaching the worker; /queue/add refuses it first. Before 4.19.17 these were `render_failed`, "This engine supports at most 3 reference images."). `image_disk` (4.19.17+: an Image engine whose first download does not fit on the disk that holds the image models - the model's real download size, less what an interrupted download left, plus 2 GB; remedy is freeing space. Before 4.19.17 these were `render_failed`, "pre-flight: only N GB free on the HF cache volume", against a flat 10 GB). Which guard said no. No free text, no fingerprint: the message is our own copy, so there is nothing to scrub and nothing unknown to count |
#### The rule — a refusal is not a failure
@@ -523,10 +524,14 @@ ignored or dismissed.
| Field | Type | Example |
|---|---|---|
-| `via` | string | `"link"` — one of `link` (opened the repo) or `already` (said they had already starred) |
-
-A closed two-value vocabulary, coerced in the handler: anything else becomes
-`link`. No account, no username, no repo state — the panel cannot see whether
+| `via` | string | `"link"` — one of `link` (opened the repo) or `already` (said they had already starred) from the update banner and the header star; or, from the one-time card after the fifth finished render (2 Nov 2026), `card_shown`, `card_star`, `card_waitlist` (the quiet Pro waitlist link, 5.0 line only) or `card_not_now` (Not now, the close button or Escape) |
+
+The banner's two values are coerced in their handler: anything else becomes
+`link`. The card's values come from `POST /star-prompt`, which refuses
+anything else with 400 and sends each at most once per install: `card_shown`
+when the card goes up, then one answer. The card is the one exception to
+"nothing fires when the ask is ignored": `card_shown` is what makes its
+answer rate measurable. No account, no username, no repo state — the panel cannot see whether
a star was actually given, and does not ask GitHub. `via` exists only to keep
"a click we caused" separate from "a click that told us we did not need to
ask", which is the whole question the ask was added to answer.
diff --git a/docs/CHANGELOG_4.19.17.md b/docs/CHANGELOG_4.19.17.md
new file mode 100644
index 0000000..b2e2773
--- /dev/null
+++ b/docs/CHANGELOG_4.19.17.md
@@ -0,0 +1,17 @@
+# Phosphene 4.19.17
+
+**A bug-fix release: fewer crashes when a video starts, and clear messages instead of errors you could not act on.** Free for everyone.
+
+- **Fixed: "the graphics chip took too long" crashes at the start of a video.** On some Macs, mostly 16 GB ones and Macs with the models on a slower or busy disk, an LTX render could crash while it was reading your prompt, and trying again often crashed the same way. Phosphene now loads that part of the model before the graphics chip needs it, so the chip is never left waiting on the disk. Your clips look exactly the same and take no longer.
+- **Fixed: training stopped with "exited with code 1" and no reason.** Most of these were runs started before the training model files had finished downloading. Now Start and Retry tell you what is missing and bring back the Download all button, instead of queueing a run that cannot work. If a training run does fail, its card shows the trainer's own reason.
+- **Fixed: image renders with a LoRA that is no longer on your Mac.** If a LoRA you had picked was deleted or renamed, every render failed with "LoRA file not found". Phosphene now drops it from the picker and, if one still slips through, names the file and asks you to un-pick it.
+- **Fixed: FLUX.2 LoRAs made for a different FLUX.2 size.** A LoRA made for FLUX.2 [klein] 9B or [dev] cannot load on the [klein] 4B that Auto and Klein-Edit use. It used to fail halfway with a "matmul" error; now Phosphene tells you before the render starts which model the LoRA was made for.
+- **Clearer: too many reference images.** The image engines take at most 3 reference images (FLUX 3 takes 10). Generate now says so before you start, instead of the render failing.
+- **Clearer: not enough disk space for an image model.** The space check now uses the real download size of the model you picked (for example 4.6 GB for FLUX.2 [klein] 4B, 57.7 GB for Reference Edit) and tells you how much more to free, in plain words.
+- **New: a one-time "help keep the lights on" card.** After your fifth finished render, a small card in the corner asks once whether you would star Phosphene on GitHub. Whatever you click, it never comes back. It never covers your clip, and if you already starred Phosphene from inside the app it never shows.
+
+Thanks to everyone whose error reports pointed at these.
+
+All of this is free for everyone, and it is also in Phosphene 5.0.
+
+In Pinokio, press Update, then restart Phosphene.
diff --git a/image_engine.py b/image_engine.py
index 33439b0..c0b96bd 100644
--- a/image_engine.py
+++ b/image_engine.py
@@ -845,6 +845,184 @@ def mflux_env_fault(bin_path) -> str:
return ""
+# ---- LoRAs: what reaches mflux, and what must stop before it ----------------
+def mflux_lora_stack(config: ImageEngineConfig, fam: str | None = None,
+ on_log=None) -> tuple[list[str], list[float]]:
+ """The LoRA paths + scales the mflux CLI will really be handed.
+
+ One function for the command builder AND the pre-launch check, so the
+ two can never disagree about which adapters ride along.
+
+ 2026-05-31 review fix (C2): the default config ships the Qwen-Edit
+ Lightning LoRA (qwen_edit is the UI default). If the engine is switched
+ to a FLUX family (e.g. via engine_override="auto") while that LoRA is
+ still in the config, mflux would load a Qwen-architecture LoRA onto a
+ FLUX transformer — a ~50s model load followed by a no-op or crash. A
+ Qwen LoRA cannot apply to a non-Qwen model, so drop cross-family LoRAs
+ (and their paired scales, kept index-aligned) up front and log it."""
+ fam = fam or _resolve_mflux_family(config)
+ paths = list(config.mflux_lora_paths or [])
+ scales = list(config.mflux_lora_scales or [])
+
+ def _log(msg: str) -> None:
+ if on_log is not None:
+ try: on_log(msg)
+ except Exception: # noqa: BLE001
+ pass
+
+ if fam == "ideogram" and paths:
+ # Ideogram 4 CANNOT consume external LoRAs: its transformer key
+ # names share zero overlap with Qwen/FLUX LoRA keys, so mflux's
+ # loader matches 0/2304 keys yet prints "applied successfully" — a
+ # silent no-LoRA render that makes users blame Ideogram for ignoring
+ # their character. Drop ALL user LoRAs (not just Qwen ones) and log
+ # honestly. This one chokepoint covers every entry path: the picker,
+ # a selection carried over from an engine switch, and /image/agent.
+ for lp in paths:
+ _log(f"[lora] Ideogram cannot use external LoRAs — ignoring: {lp}")
+ return [], []
+ if fam != "qwen_edit" and paths:
+ kept_p: list = []
+ kept_s: list = []
+ for i, lp in enumerate(paths):
+ if "qwen" in str(lp).lower():
+ _log(f"[lora] skipping Qwen LoRA on {fam} family (incompatible): {lp}")
+ continue
+ kept_p.append(lp)
+ if i < len(scales):
+ kept_s.append(scales[i])
+ paths, scales = kept_p, kept_s
+ return paths, scales
+
+
+def _mflux_lora_resolvable(path: str) -> bool:
+ """Would mflux's own LoRA resolver find `path`? Mirrors the rule table of
+ mflux 0.18 (models/common/resolution/lora_resolution.py) minus the
+ in-process registry, which no Phosphene caller fills: a file on disk; a
+ `repo:file` / `hf:` collection; an `org/repo` id. Anything else — above
+ all an absolute path whose file has gone — is
+ `error: LoRA file not found`, raised by the CLI's argparse (exit 2)."""
+ s = str(path or "").strip()
+ if not s:
+ return False
+ try:
+ if Path(s).expanduser().exists():
+ return True
+ except (OSError, ValueError):
+ return False
+ if s.startswith(("/", "~", "./", "../")):
+ return False # a filesystem path, and it is not there
+ if s.startswith("hf:"):
+ rest = s[3:]
+ return (":" in rest and "/" in rest) or rest.count("/") == 2
+ if ":" in s and "/" in s:
+ return True # repo:filename collection
+ return s.count("/") == 1 # org/repo
+
+
+#: How wide the FLUX.2 transformers are (attention heads x 128), from mflux
+#: 0.18 model_config.py `transformer_overrides`: [klein] 4B 24 heads, [klein]
+#: 9B 32 heads; FLUX.2 [dev] 48 heads.
+FLUX2_WIDTH_NAMES = {3072: "FLUX.2 [klein] 4B", 4096: "FLUX.2 [klein] 9B",
+ 6144: "FLUX.2 [dev]"}
+
+
+def flux2_transformer_width(config: ImageEngineConfig) -> int | None:
+ """The width of the FLUX.2 transformer this config runs, or None when it
+ is not a FLUX.2 config or the variant cannot be told from its names."""
+ fam = _resolve_mflux_family(config)
+ if fam not in ("flux2", "flux2_edit"):
+ return None
+ base = (config.mflux_base_model
+ or MFLUX_FAMILY_DEFAULTS.get(fam, {}).get("base_model") or "")
+ for name in (str(config.mflux_model or ""), str(base)):
+ s = name.lower()
+ if "9b" in s:
+ return 4096
+ if "4b" in s or "klein" in s:
+ return 3072
+ if "flux.2-dev" in s or "flux2-dev" in s:
+ return 6144
+ return None
+
+
+def lora_input_width(path) -> int | None:
+ """The width a LoRA was trained on: the most common input size of its
+ down/A matrices (attention q/k/v/out and the MLP input all read the
+ model's hidden width, so it dominates any full or attention-only
+ adapter). Reads the safetensors header only. None when the file has no
+ plain lora_A/lora_down pairs (LoKr, LoHa) or no width clearly leads."""
+ import lora_compat
+ header = lora_compat.read_tensor_header(path)
+ counts: dict[int, int] = {}
+ for key, meta in header.items():
+ if not key.endswith((".lora_A.weight", ".lora_down.weight")):
+ continue
+ shape = meta.get("shape") if isinstance(meta, dict) else None
+ if isinstance(shape, list) and len(shape) == 2:
+ try:
+ w = int(shape[1])
+ except (TypeError, ValueError):
+ continue
+ counts[w] = counts.get(w, 0) + 1
+ if not counts:
+ return None
+ width, hits = max(counts.items(), key=lambda kv: kv[1])
+ return width if hits * 5 >= sum(counts.values()) * 2 else None # >= 40 %
+
+
+def mflux_lora_problem(config: ImageEngineConfig) -> tuple[str, str] | None:
+ """Why the LoRAs on this config would make mflux fail, or None.
+
+ Returns (kind, message); kind is "missing", "damaged" or "mismatch".
+ Checked BEFORE the engine starts, because each of these failed after it
+ had (fleet 4.19.16):
+
+ - "missing": an absolute LoRA path whose file has gone (a chip restored
+ from a draft or Load Params after the LoRA was deleted or renamed).
+ mflux-generate-qwen-edit / run_mflux_with_teacache.py exited 2 with
+ "error: LoRA file not found" — 13 renders on one Mac in two days.
+ - "damaged": a download cut short (the header says more bytes follow).
+ - "mismatch": a FLUX.2 LoRA trained on a different FLUX.2 size. mflux
+ attaches it by key name without comparing shapes, then the first
+ denoise step dies with "ValueError: [matmul] Last dimension of first
+ input ..." (a [klein] 9B or [dev] adapter, 4096/6144 wide, on the
+ 3072-wide [klein] 4B that Auto and Klein-Edit run).
+ """
+ if config.kind != "mflux":
+ return None
+ paths, _ = mflux_lora_stack(config)
+ want = flux2_transformer_width(config)
+ for lp in paths:
+ s = str(lp or "").strip()
+ name = Path(s).name or s
+ if not _mflux_lora_resolvable(s):
+ return ("missing",
+ f"The LoRA {name} is no longer on disk ({s}). It was moved, "
+ "renamed or deleted after it was picked - un-pick it in the "
+ "LoRA list (or pick it again), then generate again.")
+ p = Path(s).expanduser()
+ if not (p.is_file() and p.suffix.lower() == ".safetensors"):
+ continue
+ try:
+ have = lora_input_width(p)
+ except Exception as exc: # noqa: BLE001
+ if type(exc).__name__ == "LoraCompatibilityError":
+ return ("damaged", str(exc))
+ continue
+ if want and have and have != want:
+ made_for = FLUX2_WIDTH_NAMES.get(have)
+ runs = FLUX2_WIDTH_NAMES[want]
+ made = (f"was made for {made_for}" if made_for else
+ f"was made for a different model (its layers are {have} "
+ f"wide, {runs}'s are {want})")
+ return ("mismatch",
+ f"The LoRA {name} {made} and cannot load on {runs}, the "
+ f"model this image engine runs. Un-pick it in the LoRA "
+ f"list, or pick a LoRA made for {runs}.")
+ return None
+
+
# ---- Backends ---------------------------------------------------------------
def _generate_mock(prompt: str, n: int, width: int, height: int,
output_dir: Path, base_seed: int | None,
@@ -1202,43 +1380,16 @@ def _generate_mflux(prompt: str, n: int, width: int, height: int,
# with "Could not find LoRA file ... in downloaded files". Paths that
# look like real files or that don't contain a colon are passed
# through untouched.
- # 2026-05-31 review fix (C2): the default config ships the Qwen-Edit
- # Lightning LoRA (qwen_edit is the UI default). If the engine is switched
- # to a FLUX family (e.g. via engine_override="auto") while that LoRA is
- # still in the config, mflux would load a Qwen-architecture LoRA onto a
- # FLUX transformer — a ~50s model load followed by a no-op or crash. A
- # Qwen LoRA cannot apply to a non-Qwen model, so drop cross-family LoRAs
- # (and their paired scales, kept index-aligned) up front and log it.
- _lora_paths_in = list(config.mflux_lora_paths or [])
- _lora_scales_in = list(config.mflux_lora_scales or [])
- if fam == "ideogram" and _lora_paths_in:
- # Ideogram 4 CANNOT consume external LoRAs: its transformer key
- # names share zero overlap with Qwen/FLUX LoRA keys, so mflux's
- # loader matches 0/2304 keys yet prints "applied successfully" — a
- # silent no-LoRA render that makes users blame Ideogram for ignoring
- # their character. Drop ALL user LoRAs (not just Qwen ones) and log
- # honestly. This one chokepoint covers every entry path: the picker,
- # a selection carried over from an engine switch, and /image/agent.
- for _lp in _lora_paths_in:
- if on_log is not None:
- try: on_log(f"[lora] Ideogram cannot use external LoRAs — ignoring: {_lp}")
- except Exception: # noqa: BLE001
- pass
- _lora_paths_in, _lora_scales_in = [], []
- elif fam != "qwen_edit" and _lora_paths_in:
- _kept_p: list = []
- _kept_s: list = []
- for _i, _lp in enumerate(_lora_paths_in):
- if "qwen" in str(_lp).lower():
- if on_log is not None:
- try: on_log(f"[lora] skipping Qwen LoRA on {fam} family (incompatible): {_lp}")
- except Exception: # noqa: BLE001
- pass
- continue
- _kept_p.append(_lp)
- if _i < len(_lora_scales_in):
- _kept_s.append(_lora_scales_in[_i])
- _lora_paths_in, _lora_scales_in = _kept_p, _kept_s
+ # Which adapters ride along (cross-family drops) is mflux_lora_stack's
+ # call, shared with the pre-launch check below so the two cannot drift.
+ _lora_paths_in, _lora_scales_in = mflux_lora_stack(config, fam, on_log)
+ # 4.19.17 (fleet 4.19.16): a LoRA that cannot load stops HERE, before the
+ # engine spends a model load on it - see mflux_lora_problem. The panel's
+ # queue worker asks the same question first and answers as a refusal; this
+ # is the backstop for every other caller (/image/generate, agents).
+ _lora_problem = mflux_lora_problem(config)
+ if _lora_problem:
+ raise ValueError(_lora_problem[1])
if _lora_paths_in:
resolved_paths: list[str] = []
for lp in _lora_paths_in:
diff --git a/lora_lab/failure.py b/lora_lab/failure.py
index c910e3d..16b2d68 100644
--- a/lora_lab/failure.py
+++ b/lora_lab/failure.py
@@ -15,6 +15,7 @@ from __future__ import annotations
import errno
import math
+from pathlib import Path
#: The closed vocabulary. docs/ANALYTICS.md, `render_failed.train_error`.
TRAIN_ERROR_CLASSES = ("oom", "missing_file", "caption_check", "disk_full",
@@ -96,3 +97,49 @@ def is_finite_loss(value) -> bool:
return math.isfinite(float(value))
except (TypeError, ValueError):
return False
+
+
+#: Minimum size of the full-precision LTX-2.3 dev transformer. Anything smaller
+#: is the Q4 repo's quantized copy, which trains a near-zero LoRA (#35).
+FULL_DEV_MIN_BYTES = 15 * 1000**3
+
+#: The stages the trainers report an `error` event from (train_character,
+#: train_audio). Closed, like TRAIN_ERROR_CLASSES: the panel forwards the
+#: stage word to analytics, never anything outside this list.
+TRAIN_STAGES = ("models", "caption", "config", "ingest", "crop", "preprocess",
+ "train", "publish", "sidecar", "validate", "verify", "unknown")
+
+
+def dev_transformer_candidates(model_dir: str | Path) -> tuple[Path, Path]:
+ """The two places the trainer loads the dev transformer from, in order.
+ The trainer reads nothing else (lora_lab.train's loader override), so a
+ check that accepts any other place (a Hugging Face cache) says "ready"
+ for a run that cannot start."""
+ model_dir = Path(model_dir)
+ return (model_dir / "transformer-dev.safetensors",
+ model_dir.parent / "ltx-2.3-mlx-q8" / "transformer-dev.safetensors")
+
+
+def training_weights_problem(model_dir: str | Path) -> str | None:
+ """What is missing for a training run, in one sentence, or None (4.19.1).
+
+ Checked before the crop and the caption encode. Without it a missing
+ LTX-2.3 base pack died ~10 s in inside the preprocessor's Hugging Face
+ lookup ("Repo id must be in the form 'repo_name'..."), and a missing
+ full-precision dev transformer died only after minutes of caption and
+ image encoding - both as a bare "exited with code 1". The Train tab shows
+ a download banner for these, but Start was never blocked by it.
+ Same locations and size floor as lora_lab.train's loader override; the
+ panel asks this before it queues a run (train_support.train_weights_refusal)."""
+ model_dir = Path(model_dir)
+ if not model_dir.is_dir():
+ return (f"the LTX-2.3 base pack is not downloaded (no {model_dir.name}/ in the models "
+ "folder). Open the Train tab and click Download all, then start again.")
+ for cand in dev_transformer_candidates(model_dir):
+ try:
+ if cand.is_file() and cand.stat().st_size >= FULL_DEV_MIN_BYTES:
+ return None
+ except OSError:
+ continue
+ return ("the full-precision LTX-2.3 dev transformer (~21 GB) is not downloaded, or "
+ "only partly. Open the Train tab and click Download all, then start again.")
diff --git a/lora_lab/train.py b/lora_lab/train.py
index e89576c..28e0be9 100644
--- a/lora_lab/train.py
+++ b/lora_lab/train.py
@@ -160,30 +160,11 @@ def _patch_loader_prefer_dev_transformer() -> None:
ml_module.load_transformer = patched
-def training_weights_problem(model_dir: str | Path) -> str | None:
- """What is missing for a training run, in one sentence, or None (4.19.1).
-
- Checked before the crop and the caption encode. Without it a missing
- LTX-2.3 base pack died ~10 s in inside the preprocessor's Hugging Face
- lookup ("Repo id must be in the form 'repo_name'..."), and a missing
- full-precision dev transformer died only after minutes of caption and
- image encoding - both as a bare "exited with code 1". The Train tab shows
- a download banner for these, but Start was never blocked by it.
- Same locations and size floor as the loader patch above."""
- model_dir = Path(model_dir)
- if not model_dir.is_dir():
- return (f"the LTX-2.3 base pack is not downloaded (no {model_dir.name}/ in the models "
- "folder). Open the Train tab and click Download all, then start again.")
- full_dev_min = 15 * 1000**3
- for cand in (model_dir / "transformer-dev.safetensors",
- model_dir.parent / "ltx-2.3-mlx-q8" / "transformer-dev.safetensors"):
- try:
- if cand.is_file() and cand.stat().st_size >= full_dev_min:
- return None
- except OSError:
- continue
- return ("the full-precision LTX-2.3 dev transformer (~21 GB) is not downloaded, or "
- "only partly. Open the Train tab and click Download all, then start again.")
+# Moved to lora_lab.failure (light imports) so the panel can ask the SAME
+# question before it queues a run: the Train tab's own check used to accept
+# Hugging Face cache copies the trainer never loads, and Start was not gated
+# by it at all (fleet 2 Nov 2026: one Mac failed 22 runs in an hour on it).
+from lora_lab.failure import training_weights_problem # noqa: E402,F401 (re-exported)
def _patch_compute_video_positions_fps_kwarg() -> None:
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index 2b34d51..31e5049 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -3376,6 +3376,7 @@ def _new_train_job_id() -> str:
# even while it is still importing.
import train_support as _train_support
from train_support import ( # noqa: F401 (re-exported on purpose)
+ _big_enough,
_train_caption_map_path,
_train_dataset_dir,
_train_encode_retry_wanted,
@@ -3393,8 +3394,14 @@ from train_support import ( # noqa: F401 (re-exported on purpose)
_train_weak_advice,
_train_wipe_caption_conditions,
_train_write_caption_map,
+ TRAIN_WEIGHTS_REFUSAL_PREFIX,
+ train_class_from_exception_name,
train_error_for_exit,
train_error_from_event,
+ train_exception_from_tail,
+ train_failure_message,
+ train_stage_word,
+ train_weights_refusal,
)
_train_support.P = sys.modules[__name__]
@@ -20045,6 +20052,109 @@ def _analytics_feature(feature: str, detail: str = "") -> None:
_analytics_capture("feature_used", props)
+# ---- "Star us on GitHub" ask (owner, 2 Nov 2026) ----------------------------
+# One small card, once per Mac, after the fifth finished render. Kept in the
+# panel's own settings file so it survives restarts and updates; it is not
+# per session and it is independent of analytics being on. States:
+# (no key) never counted yet
+# counting fewer than five finished renders
+# due the card should show (set by a finished render)
+# shown the card was put on screen; it will not be put up again
+# done the person answered (star, waitlist, not now or close)
+# Existing users with five or more renders already in their history are
+# seeded from it the first time, so they see it once after their next render.
+# Someone who already starred from the header icon or the update banner
+# (star_prompt_done) never sees the card.
+STAR_PROMPT_THRESHOLD = 5
+STAR_PROMPT_URL = "https://github.com/mrbizarro/Phosphene"
+STAR_PROMPT_ACTIONS = ("shown", "star", "waitlist", "not_now")
+_STAR_PROMPT_LOCK = threading.Lock()
+
+
+def _star_prompt_counts(job: dict) -> bool:
+ """A finished render from any engine or mode. Training is not a render,
+ and failed, stopped or cancelled jobs produced nothing."""
+ if not isinstance(job, dict) or job.get("status") != "done":
+ return False
+ return ((job.get("params") or {}).get("mode") or "") != "train"
+
+
+def _star_prompt_next(settings: dict, job: dict, history: list) -> dict:
+ """Pure: the settings delta a finished job causes (empty = nothing)."""
+ if not _star_prompt_counts(job):
+ return {}
+ state = settings.get("star_prompt_state") or ""
+ if state in ("due", "shown", "done"):
+ return {}
+ try:
+ n = int(settings["star_prompt_renders"])
+ except (KeyError, TypeError, ValueError):
+ # First count on this Mac: start from the renders it already made.
+ n = sum(1 for j in (history or []) if _star_prompt_counts(j)
+ and j.get("id") != job.get("id"))
+ n += 1
+ return {"star_prompt_renders": n,
+ "star_prompt_state": "due" if n >= STAR_PROMPT_THRESHOLD else "counting"}
+
+
+def _star_prompt_after_job(job: dict) -> None:
+ """worker_loop's finally. Never raises: it must not touch a render."""
+ try:
+ with _STAR_PROMPT_LOCK:
+ with LOCK:
+ hist = list(STATE.get("history") or [])
+ delta = _star_prompt_next(get_settings(), job, hist)
+ if delta:
+ _settings_set_internal(**delta)
+ except Exception:
+ pass
+
+
+def star_prompt_due() -> bool:
+ """Whether the page should put the card up now. Someone who already
+ starred from the header icon or the update banner (star_prompt_done) is
+ never asked again here."""
+ try:
+ s = get_settings()
+ return s.get("star_prompt_state") == "due" and not s.get("star_prompt_done")
+ except Exception:
+ return False
+
+
+def _star_prompt_transition(state: str, action: str) -> str | None:
+ """Pure: the new state for an action, or None when it changes nothing
+ (a second answer, or `shown` once it was already shown)."""
+ if action == "shown":
+ return "shown" if state == "due" else None
+ if action in ("star", "waitlist", "not_now"):
+ return "done" if state in ("due", "shown") else None
+ return None
+
+
+def star_prompt_answer(action: str) -> bool:
+ """Record what the page did with the card. Returns whether it changed
+ anything; the anonymous count goes out only on a real change, so a
+ double click cannot count twice."""
+ if action not in STAR_PROMPT_ACTIONS:
+ raise ValueError("unknown action")
+ with _STAR_PROMPT_LOCK:
+ new = _star_prompt_transition(
+ get_settings().get("star_prompt_state") or "", action)
+ if new is None:
+ return False
+ delta = {"star_prompt_state": new}
+ if new == "done":
+ delta["star_prompt_choice"] = action
+ # Any answer also retires the update banner's star row: one ask.
+ delta["star_prompt_done"] = True
+ _settings_set_internal(**delta)
+ # The same anonymous `star_prompt` event as the banner and the header
+ # icon (via link / already), with the card's own closed values.
+ _analytics_capture("star_prompt", {"via": "card_" + action})
+ return True
+
+
+
def _analytics_canvas_class(width: int, height: int) -> str:
"""Coarse canvas grouping by megapixels — the percentile dimension."""
try:
@@ -20134,6 +20244,28 @@ _ANALYTICS_REFUSAL_REASONS = (
# #206: a small Mac whose prompt encoding macOS stopped minutes ago, still
# short of memory after a wait (ltx_encode_memory_hold).
("memory_low", ("not enough free memory to read the prompt",)),
+ # A training run whose LTX-2.3 weights are not on this Mac (fleet 2 Nov
+ # 2026: 25 of 31 failed runs in a day, one Mac 22 times in an hour). The
+ # message names the download and the Train tab offers it. Prefix:
+ # train_support.TRAIN_WEIGHTS_REFUSAL_PREFIX.
+ ("train_models", ("training can't start yet:",)),
+ # 4.19.17: an Image render with a FLUX.2 LoRA made for another FLUX.2 size
+ # (a [klein] 9B / [dev] adapter on the [klein] 4B), refused before the
+ # engine starts. It used to die mid-denoise with mflux's "[matmul] Last
+ # dimension of first input" (render_failed). Remedy: un-pick the LoRA.
+ # The needle is the sentence's own join ("... and cannot load on FLUX.2 ...");
+ # a bare "cannot load on" would file an unrelated engine error as a refusal.
+ ("lora_mismatch", ("and cannot load on flux.2",)),
+ # 4.19.17: an Image render with more reference images than its engine
+ # takes (3; FLUX 3 10). The second needle is the old wording, raised as a
+ # render_failed until 4.19.17, so replayed usage logs still classify.
+ ("image_refs", ("image engine takes at most",
+ "this engine supports at most")),
+ # 4.19.17: an Image engine whose first download does not fit on the disk.
+ # The second needle is the old "pre-flight: only N GB free on the HF cache
+ # volume" wording (a render_failed until 4.19.17), for replayed logs.
+ ("image_disk", ("not enough disk space for",
+ "free on the hf cache volume")),
)
_ANALYTICS_REFUSAL_SLUGS = tuple(s for s, _ in _ANALYTICS_REFUSAL_REASONS)
@@ -20577,6 +20709,20 @@ def _analytics_render_event(job: dict) -> None:
# own exception (lora_lab.failure) — never its text.
te = str(job.get("train_error") or "")
props["train_error"] = te if te in TRAIN_ERROR_CLASSES else "other"
+ # Fleet 2 Nov 2026: the card now carries the trainer's own
+ # sentence, which may quote the user's trigger or file
+ # names. The fleet gets a fixed line built from the two
+ # closed words instead, so "code 1" stops hiding the cause
+ # and no typed text can ride along.
+ ts = str(job.get("train_stage") or "unknown")
+ props["train_stage"] = ts if ts in _TRAIN_STAGES else "unknown"
+ if not str(job.get("error") or "").startswith("training exited with code"):
+ props["error_signature"] = (
+ f"training stopped: {props['train_error']} "
+ f"(stage {props['train_stage']})")
+ if props["error_class"] == "other":
+ props["error_fingerprint"] = _analytics_error_fingerprint(
+ props["error_signature"])
_analytics_capture(event, props)
except Exception:
pass
@@ -23819,6 +23965,15 @@ def _kill_train_proc() -> None:
pgid = None
if not pgid:
return
+ # The panel quitting is not the training run failing: mark it like a Stop
+ # so the worker files it as cancelled. Fleet 2 Nov 2026: "training exited
+ # with code -15" was counted as a failed render three times on one Mac.
+ try:
+ cur = STATE.get("current")
+ if cur is not None:
+ cur["cancel_requested"] = True
+ except Exception:
+ pass
try:
os.killpg(pgid, signal.SIGTERM)
except (OSError, ProcessLookupError):
@@ -32965,6 +33120,62 @@ def _raise_if_licence_missing(key: str | None) -> None:
raise RenderRefused("licence_required", ref["error"])
+#: Reference images an Image engine takes: Qwen Reference Edit / FLUX.2
+#: Klein-Edit take up to 3 (mflux --image-paths; the Studio has 3 slots),
+#: FLUX 3 up to 10 (docs/FLUX3.md; API only).
+IMAGE_MAX_REFS = 3
+IMAGE_MAX_REFS_FLUX3 = 10
+
+
+def image_max_refs(engine_override) -> int:
+ """How many reference images `engine_override` takes. One answer for the
+ queue worker, /queue/add, /image/generate and the Studio (engine_status)."""
+ import flux3_engine
+ eng = str(engine_override or "auto").strip().lower()
+ return IMAGE_MAX_REFS_FLUX3 if eng in flux3_engine.PRESETS else IMAGE_MAX_REFS
+
+
+def image_refs_refusal(engine_override, refs) -> str | None:
+ """The too-many-references sentence, or None. Its opening phrase is the
+ `image_refs` refusal needle - keep them together."""
+ n = len(refs or [])
+ cap = image_max_refs(engine_override)
+ if n <= cap:
+ return None
+ return (f"This image engine takes at most {cap} reference images, and this "
+ f"render has {n}. Remove {n - cap} of them, then generate again.")
+
+
+def image_job_input_refusal(p: dict) -> str | None:
+ """job_input_refusal for an Image job: what can only fail, said before it
+ is queued.
+
+ 4.19.17 (fleet 4.19.16): a picked LoRA whose file had gone reached the
+ engine, which exited 2 with "error: LoRA file not found" - 13 failed
+ renders on one Mac over two days, each retry the same. The chip came back
+ from a draft / Load Params after the LoRA was deleted or renamed. The
+ worker asks the same question again (image_engine.mflux_lora_problem) for
+ a file that goes away while the job waits.
+
+ Also (fleet 4.19.16, an Image job with more than 3 references): too many
+ reference images for the engine - the worker used to discover it after
+ the job's turn and file it as a failed render."""
+ refs = p.get("refs") or []
+ if isinstance(refs, list):
+ why = image_refs_refusal(p.get("engine_override"), refs)
+ if why:
+ return why
+ for entry in (p.get("loras") or []):
+ lp = str((entry or {}).get("path") or "").strip() if isinstance(entry, dict) else ""
+ if not lp or not lp.startswith(("/", "~")):
+ continue # a Hugging Face id: the engine fetches it
+ if not Path(lp).expanduser().is_file():
+ return (f"The LoRA {Path(lp).name} is no longer on disk ({lp}). It was "
+ "moved, renamed or deleted after it was picked - un-pick it in "
+ "the LoRA list (or pick it again), then generate again.")
+ return None
+
+
def job_input_refusal(params: dict) -> str | None:
"""Why this job can only fail for want of an input, or None.
@@ -32974,7 +33185,9 @@ def job_input_refusal(params: dict) -> str | None:
whose file goes away while they wait)."""
p = params or {}
m = str(p.get("mode") or "t2v").strip().lower()
- if m in ("music", "image", "train"):
+ if m == "image":
+ return image_job_input_refusal(p)
+ if m in ("music", "train"):
return None
if m not in QUEUEABLE_VIDEO_MODES:
return (f"Unknown render mode {m!r} - nothing was queued. Pick a mode "
@@ -34745,6 +34958,65 @@ def _preflight_disk_free_gb(path: Path) -> float:
return 0.0
+#: What an Image engine's first render downloads, per Hugging Face repo: the
+#: files mflux 0.18 fetches (each family's get_download_patterns()), from the
+#: Hub's file sizes on 2026-11-02. The disk pre-flight and the Studio's
+#: "one-time download" line both read it. A repo not listed keeps the old
+#: 10 GB floor.
+IMAGE_REPO_DOWNLOAD = {
+ KLEIN_4B_Q4_MODEL: ("FLUX.2 [klein] 4B", 4.6),
+ "Qwen/Qwen-Image-Edit-2511": ("Reference Edit (Qwen-Image-Edit)", 57.7),
+ IDEOGRAM_REPO_UNGATED: ("Ideogram 4", 27.6),
+ "filipstrand/Z-Image-Turbo-mflux-4bit": ("Z-Image Turbo", 5.9),
+}
+#: Left free after the download, for swap and the render's own output.
+IMAGE_DISK_HEADROOM_GB = 2.0
+IMAGE_DISK_UNKNOWN_FLOOR_GB = 10.0
+
+
+def image_repo_download_gb(repo_id, default=None):
+ row = IMAGE_REPO_DOWNLOAD.get(str(repo_id or ""))
+ return row[1] if row else default
+
+
+def image_disk_refusal(cfg, engine_override: str, free_gb: float,
+ where) -> str | None:
+ """The disk pre-flight for an engine whose weights are not on disk yet,
+ or None when they fit. Its opening phrase is the `image_disk` needle.
+
+ 4.19.17 (fleet 4.19.16, three in a row on one Mac): it said "only 5.9 GB
+ free on the HF cache volume ... isn't cached yet. Free at least 10 GB or
+ set PHOSPHENE_SKIP_PREFLIGHT=1" - jargon, a developer switch, and a flat
+ 10 GB that was wrong both ways: FLUX.2 [klein] 4B (Auto) is a 4.6 GB
+ download, Reference Edit 57.7 GB. Now the real size of THIS model, less
+ what an interrupted download already left, plus 2 GB to spare."""
+ repo = str(getattr(cfg, "mflux_model", "") or "")
+ row = IMAGE_REPO_DOWNLOAD.get(repo)
+ if row is None:
+ need = IMAGE_DISK_UNKNOWN_FLOOR_GB
+ name = _IMAGE_ENGINE_LABELS.get(engine_override, engine_override)
+ dl_txt = "its model has to be downloaded first"
+ else:
+ name, size = row
+ left = size
+ try:
+ part = agent_image_engine.hf_repo_partial_download(repo)
+ if part:
+ left = max(0.0, size - float(part.get("on_disk_gb") or 0.0))
+ except Exception: # noqa: BLE001
+ pass
+ need = left + IMAGE_DISK_HEADROOM_GB
+ dl_txt = (f"it still has {left:.1f} GB of model files to download"
+ if left < size else
+ f"its first render downloads {size:.1f} GB of model files (once)")
+ if free_gb >= need:
+ return None
+ return (f"Not enough disk space for {name}: {dl_txt}, and "
+ f"the disk that holds the image models has {free_gb:.1f} GB free "
+ f"({where}). Free at least {need - free_gb:.1f} GB more - empty the "
+ f"Trash or delete renders you no longer need - then try again.")
+
+
def _preflight_model_cached(cfg) -> bool:
"""True if the model's HF cache snapshot already exists on disk.
@@ -34817,7 +35089,7 @@ def _preflight_image_job(cfg, *, engine_override: str = "auto") -> None:
Checks (in order):
1. Free RAM (vm_stat) ≥ per-engine need.
- 2. Free disk on HF cache volume ≥ 10 GB if model isn't cached.
+ 2. Free disk for the model's first download (image_disk_refusal).
Bypass with `PHOSPHENE_SKIP_PREFLIGHT=1`. We log every preflight result
(pass or skip) so post-mortems can tell the difference between "preflight
@@ -34904,12 +35176,12 @@ def _preflight_image_job(cfg, *, engine_override: str = "auto") -> None:
cache_root.mkdir(parents=True, exist_ok=True)
free_disk_gb = _preflight_disk_free_gb(cache_root)
cached = _preflight_model_cached(cfg)
- if not cached and free_disk_gb < 10.0:
- raise RuntimeError(
- f"pre-flight: only {free_disk_gb:.1f} GB free on the HF cache volume "
- f"({cache_root}) and this engine ({engine_override}) isn't cached yet. "
- f"Free at least 10 GB or set PHOSPHENE_SKIP_PREFLIGHT=1 to override."
- )
+ if not cached:
+ # A deliberate stop before any download or GPU work: a refusal
+ # (`image_disk`), not a failed render (fleet 4.19.16 counted 3).
+ _no_room = image_disk_refusal(cfg, engine_override, free_disk_gb, cache_root)
+ if _no_room:
+ raise RenderRefused("image_disk", _no_room)
push(
f"[preflight] OK · engine={engine_override} need~{need_gb:.0f}G "
@@ -34958,9 +35230,11 @@ def run_image_job_inner(job: dict) -> None:
if not isinstance(refs_in, list):
raise RuntimeError(f"refs must be a list, got {type(refs_in).__name__}")
import flux3_engine
- max_refs = 10 if engine_override in flux3_engine.PRESETS else 3
- if len(refs_in) > max_refs:
- raise RuntimeError(f"This engine supports at most {max_refs} reference images.")
+ # A deliberate stop, not a fault (fleet 4.19.16: it was a render_failed):
+ # nothing ran. /queue/add refuses it first (image_job_input_refusal).
+ _too_many = image_refs_refusal(engine_override, refs_in)
+ if _too_many:
+ raise RenderRefused("image_refs", _too_many)
refs_resolved: list[str] = []
for r in refs_in:
if not isinstance(r, str) or not r.strip():
@@ -35036,6 +35310,18 @@ def run_image_job_inner(job: dict) -> None:
"mflux_lora_scales": preset_scales}
)
+ # A LoRA that cannot load stops before the engine starts (4.19.17, fleet
+ # 4.19.16) - image_job_input_refusal said it at /queue/add; this catches a
+ # file that went away while the job waited, and every preset LoRA too.
+ # A FLUX.2 LoRA made for another FLUX.2 size ("mismatch": the matmul
+ # ValueError mid-denoise, fleet 4.19.16) is a refusal - nothing ran, and
+ # the way out is a different pick, not a retry.
+ _lora_problem = agent_image_engine.mflux_lora_problem(cfg)
+ if _lora_problem:
+ if _lora_problem[0] == "mismatch":
+ raise RenderRefused("lora_mismatch", _lora_problem[1])
+ raise RuntimeError(_lora_problem[1])
+
# Pre-flight: refuse the job up-front when we can predict it will OOM
# mid-Metal-render (commit bc818a5 covers the post-mortem; this short-
# circuits before the subprocess even spawns). Bypass with
@@ -35210,6 +35496,10 @@ _TRAIN_ABORT_RX = re.compile(
#: into; the panel never forwards a word outside this list.
TRAIN_ERROR_CLASSES = ("oom", "missing_file", "caption_check", "disk_full",
"import_error", "nan_loss", "other")
+#: Where the trainer stopped (docs/ANALYTICS.md `train_stage`); mirrors
+#: lora_lab.failure.TRAIN_STAGES.
+_TRAIN_STAGES = ("models", "caption", "config", "ingest", "crop", "preprocess",
+ "train", "publish", "sidecar", "validate", "verify", "unknown")
@@ -35264,7 +35554,7 @@ def run_train_job_inner(job: dict) -> None:
images_dir = dataset_dir / "images"
captions_dir = dataset_dir / "captions"
if not images_dir.is_dir():
- job["train_error"] = "missing_file"
+ job["train_error"], job["train_stage"] = "missing_file", "ingest"
raise RuntimeError(
f"dataset images not found: {images_dir} — "
"/train/upload should have created this. Re-upload your dataset.")
@@ -35385,7 +35675,7 @@ def run_train_job_inner(job: dict) -> None:
f"({other[1]}/{len(mismatched)} mismatched files)"
if other else "")
if len(mismatched) == len(user_cap_files):
- job["train_error"] = "caption_check"
+ job["train_error"], job["train_stage"] = "caption_check", "caption"
raise RuntimeError(
f"none of the {len(user_cap_files)} existing caption files "
f"contain the trigger {trigger!r} this job was submitted "
@@ -35476,15 +35766,26 @@ def run_train_job_inner(job: dict) -> None:
except OSError as e:
job["train_error"] = ("disk_full" if e.errno in (errno.ENOSPC, errno.EDQUOT)
else "other")
+ job["train_stage"] = "config"
raise RuntimeError(f"could not write spec.json: {e}")
if not LORA_LAB_RUN_SH.exists():
- job["train_error"] = "missing_file"
+ job["train_error"], job["train_stage"] = "missing_file", "models"
raise RuntimeError(
f"lora-lab shim not found at {LORA_LAB_RUN_SH}. "
"Train Character depends on the sibling lab at "
f"{LORA_LAB_ROOT}. Make sure it's checked out.")
+ # Fleet 2 Nov 2026: a run whose weights are not on disk is refused here,
+ # before the training lock is taken, the render engine is released or a trainer spawned - the same
+ # check the trainer makes first, so a queued run whose download vanished
+ # (or was never made) is a refusal with the fix, not "exited with code 1".
+ _weights = train_weights_refusal()
+ if _weights:
+ job["train_error"] = "missing_file"
+ job["train_stage"] = "models"
+ raise RenderRefused("train_models", _weights)
+
# Serialise training runs against each other. We use a non-blocking
# acquire here because the queue worker already serialises jobs; this
# is just a safety net for the case where a future change lets two
@@ -35518,6 +35819,8 @@ def run_train_job_inner(job: dict) -> None:
_train_env = trainer_child_env()
_encode_retried = False
_trainer_error: dict | None = None
+ # The trainer's last plain lines, for a crash before its own `error` event.
+ _train_tail: collections.deque = collections.deque(maxlen=40)
# A warm render helper keeps an LTX model resident (up to tens of GB) for
# HELPER_IDLE_TIMEOUT after the last render. The trainer needs that memory
# for the dev transformer and its activations; give it back first.
@@ -35668,6 +35971,7 @@ def run_train_job_inner(job: dict) -> None:
push(f"[train] {line}")
else:
push(f"[train] {line}")
+ _train_tail.append(line)
# The trainer dies by SIGABRT when macOS kills its GPU command
# buffer, and `code -6` on its own tells the user nothing. Watch
# the same signatures the render helper watches (#61).
@@ -35718,7 +36022,8 @@ def run_train_job_inner(job: dict) -> None:
continue
break
if rc != 0:
- job["train_error"] = train_error_for_exit(rc, _trainer_error)
+ job["train_error"] = train_error_for_exit(rc, _trainer_error, _train_tail)
+ job["train_stage"] = train_stage_word(_trainer_error)
# -6 is SIGABRT. With a watchdog signature in the log it is macOS
# killing the GPU command buffer, not our code faulting — and the
# lever is the canvas, not the preset. Reported in #61: 576x576
@@ -35743,8 +36048,11 @@ def run_train_job_inner(job: dict) -> None:
f"training aborted (SIGABRT, code {rc}). No Metal-watchdog "
"signature was logged, so this is a crash rather than a "
"GPU timeout — please attach the Logs tail to an issue.")
- raise RuntimeError(
- f"training exited with code {rc} — see Logs for stack trace")
+ # The trainer's own sentence (or the crash's last traceback line),
+ # never a bare exit code: fleet 2 Nov 2026, 31 runs failed as
+ # "code 1" while the trainer had said "the dev transformer is not
+ # downloaded" every time.
+ raise RuntimeError(train_failure_message(rc, _trainer_error, _train_tail))
finally:
if proc is not None:
try:
@@ -35763,7 +36071,7 @@ def run_train_job_inner(job: dict) -> None:
elapsed = round(time.time() - t0, 2)
if not final_lora_path.is_file():
- job["train_error"] = "missing_file"
+ job["train_error"], job["train_stage"] = "missing_file", "publish"
raise RuntimeError(
f"training finished but output .safetensors missing at {final_lora_path}")
@@ -42355,6 +42663,9 @@ def worker_loop() -> None:
# analytics section's contract; it must never be able to turn
# a finished render into a failed one.
_analytics_render_event(job)
+ # The one-time "star us on GitHub" card counts finished renders
+ # here for the same reason. Local only, never raises.
+ _star_prompt_after_job(job)
# Per-install self-calibration (VC-01 / H3-03) — local only,
# independent of analytics being on. Same never-raise contract.
_record_eta_calibration_from_job(job)
diff --git a/mlx_warm_helper.py b/mlx_warm_helper.py
index 15df874..d16f65c 100644
--- a/mlx_warm_helper.py
+++ b/mlx_warm_helper.py
@@ -1378,9 +1378,61 @@ def _install_split_prompt_encode_patch() -> None:
self._text_encoder.load(self.gemma_model_id)
_blocks.aggressive_cleanup()
+ def _read_connector_now(fx):
+ """4.19.17 - read the connector's weights into memory BEFORE the GPU
+ needs them (the fleet's #1 failure, the GPU watchdog in prompt
+ encoding).
+
+ Symptom: SIGABRT, kIOGPUCommandBufferCallbackErrorTimeout /
+ ImpactingInteractivity, always in phase "encode" (196 of 203 known
+ phases in 30 days; 37 of 37 on 4.19.15/16), at any size down to
+ 128x128 x41, already on one-op command buffers, and a 256-token
+ Gemma encode dies the same way (#44).
+
+ Cause: the engine loads the Gemma tower and the DiT eagerly, but the
+ connector (6.3 GB BF16 on LTX-2.5) only LAZILY - load_weights builds
+ Load nodes and nothing reads the file. MLX runs Load on the CPU
+ stream only, so the first GPU op of the feature extractor (the
+ video_aggregate_embed projection, ONE 1,541 MB tensor; then 771 MB
+ for audio) sits in a committed Metal command buffer waiting on an
+ event until the CPU has read that tensor from disk. A command buffer
+ that waits that long is what macOS's watchdog kills: a slow or busy
+ disk (external drive, cold cache, a 16 GB Mac re-reading the file
+ under memory pressure) turns a 0.5 s read into 6+ s. No other lazy
+ weight comes close (largest: VAE decoder 226 MB, upscaler 76 MB,
+ VAE encoder 57 MB), which is why only this phase dies.
+
+ Fix: evaluate the connector's parameters right after load_weights.
+ Those are Load nodes only, so the reads run on the CPU stream with
+ no GPU work queued behind them - there is nothing for the watchdog
+ to time. Same bytes, same values (bit-identical embeddings), same
+ peak (the encode needed them resident anyway); only the moment of
+ the read moves."""
+ if fx is None or getattr(fx, "_phos_weights_resident", False):
+ return
+ params = getattr(fx, "parameters", None)
+ if not callable(params):
+ return
+ import sys as _sys
+ import time as _time
+ import mlx.core as _mx
+ from mlx.utils import tree_flatten as _flatten
+ arrays = [v for _k, v in _flatten(params()) if isinstance(v, _mx.array)]
+ t0 = _time.monotonic()
+ getattr(_mx, "eval")(arrays) # MLX graph evaluation, not Python eval
+ dt = _time.monotonic() - t0
+ fx._phos_weights_resident = True
+ mb = sum(int(a.nbytes) for a in arrays) / 1e6
+ # Never a phase or crash word here: the panel reads every raw line.
+ print(f"[text-connector] {mb:.0f} MB of connector weights read in "
+ f"{dt:.1f} s ({mb / max(dt, 1e-3):.0f} MB/s) before the prompt "
+ f"is encoded", file=_sys.stderr, flush=True)
+
def load(self):
if not split_prompt_encode_wanted():
- return _orig_load(self)
+ _orig_load(self)
+ _read_connector_now(getattr(self, "_feature_extractor", None))
+ return None
# Text model only: the connector loads after it is gone (encode).
# Callers that read the tokenizer (Prompt Relay) still find it here.
_load_text_model(self)
@@ -1402,6 +1454,7 @@ def _install_split_prompt_encode_patch() -> None:
prefix="connector.")
fx.connector.load_weights(list(weights.items()))
del weights
+ _read_connector_now(fx) # read now, not inside fx()
_blocks.aggressive_cleanup()
self._feature_extractor = fx
video, audio = fx(hidden, attention_mask=mask)
diff --git a/panel/routes_image.py b/panel/routes_image.py
index aff6ccd..35dccff 100644
--- a/panel/routes_image.py
+++ b/panel/routes_image.py
@@ -366,8 +366,12 @@ def get_image_engine_status(h, parsed) -> None:
except Exception: # noqa: BLE001
_need = 8.0
_fits, _mac_gb = P._image_engine_fit(_need)
+ # The one download-size table (IMAGE_REPO_DOWNLOAD) wins over the
+ # row's literal: Reference Edit read "24 GB" for a 57.7 GB fetch.
+ dl_gb = P.image_repo_download_gb(repo, dl_gb)
out.append({
"engine": engine,
+ "max_refs": P.image_max_refs(engine),
"repo_id": repo or "",
"cached": cached,
"ram_need_gb": round(float(_need), 1),
@@ -388,7 +392,8 @@ def get_image_engine_status(h, parsed) -> None:
if (repo and engine == "ideogram4_inline") else None,
})
import flux3_engine
- out.extend(flux3_engine.status(key, float(P.SYSTEM_RAM_GB or 0))
+ out.extend({**flux3_engine.status(key, float(P.SYSTEM_RAM_GB or 0)),
+ "max_refs": P.image_max_refs(key)}
for key in flux3_engine.PRESETS)
h._json({"engines": out,
"host_ram_gb": int(round(float(P.SYSTEM_RAM_GB or 0)))})
@@ -783,9 +788,9 @@ def post_image_generate(h, path, qs, ctype) -> None:
if not isinstance(refs_in, list):
h._json({"error": "refs must be a list of paths"}, 400); return
import flux3_engine
- max_refs = 10 if str(payload.get("engine_override") or "").lower() in flux3_engine.PRESETS else 3
- if len(refs_in) > max_refs:
- h._json({"error": f"This engine supports at most {max_refs} reference images."}, 400); return
+ _too_many = P.image_refs_refusal(payload.get("engine_override"), refs_in)
+ if _too_many:
+ h._json({"error": _too_many, "code": "image_refs"}, 400); return
refs_resolved: list[str] = []
for r in refs_in:
if not isinstance(r, str) or not r.strip():
diff --git a/panel/routes_meta.py b/panel/routes_meta.py
index fcbfa20..785854e 100644
--- a/panel/routes_meta.py
+++ b/panel/routes_meta.py
@@ -583,6 +583,27 @@ def post_analytics_ui(h, path, qs, ctype) -> None:
h._json({"ok": True})
+@post("/star-prompt")
+def post_star_prompt(h, path, qs, ctype) -> None:
+ """The one-time "star us on GitHub" card (owner, 2 Nov 2026). The page
+ says `shown` when it puts the card up, then what the person chose:
+ `star`, `waitlist` or `not_now` (closing it is `not_now`). Any choice
+ ends it for good on this Mac. Opening the link is the page's job,
+ through /external/open; nothing here touches the network except the
+ anonymous count, and only when analytics is on."""
+ _rb = h._read_form_body()
+ if _rb is None:
+ return
+ body, form = _rb
+ v = form.get("action", [""])
+ action = str((v[0] if isinstance(v, list) else v) or "").strip()
+ try:
+ changed = P.star_prompt_answer(action)
+ except ValueError:
+ h._json({"ok": False, "error": "unknown action"}, 400); return
+ h._json({"ok": True, "changed": changed, "due": P.star_prompt_due()})
+
+
@post("/version/pull")
def post_version_pull(h, path, qs, ctype) -> None:
# The "magic button" path — when the pill is in the behind
diff --git a/panel/routes_queue.py b/panel/routes_queue.py
index 0f02845..feedb4d 100644
--- a/panel/routes_queue.py
+++ b/panel/routes_queue.py
@@ -48,6 +48,9 @@ def get_status(h, parsed) -> None:
payload["outputs"] = _outs
payload["outputs_total"] = _outs_total
payload["hidden_count"] = hidden_count
+ # The one-time "star us on GitHub" card (owner, 2 Nov 2026): true only
+ # between the fifth finished render and the page putting the card up.
+ payload["star_prompt_due"] = P.star_prompt_due()
# Storyboards — one line per board. Three jobs, all of them cheap:
# the `S03/12` badge on a queue card needs the denominator, the tab
# count during an overnight run needs `running`, and `To film` in
@@ -492,6 +495,12 @@ def post_queue_retry(h, path, qs, ctype) -> None:
refusal = P.job_input_refusal(new_job["params"])
if refusal:
h._json({"error": refusal, "code": "input_missing"}, 400); return
+ # Fleet 2 Nov 2026: Retry on a failed training run re-queued the same run
+ # the trainer had just refused for want of its weights. Say it here.
+ if str(new_job["params"].get("mode") or "") == "train":
+ _weights = P.train_weights_refusal()
+ if _weights:
+ h._json({"error": _weights, "code": "train_models"}, 409); return
_lic = P.job_licence_refusal(new_job["params"])
if _lic:
h._json(_lic, 451); return
diff --git a/panel/routes_train.py b/panel/routes_train.py
index a0b5fdd..eac8d5f 100644
--- a/panel/routes_train.py
+++ b/panel/routes_train.py
@@ -187,6 +187,14 @@ def post_train_start(h, path, qs, ctype) -> None:
h._json({"error": f"Training needs at least {P.TRAIN_MIN_RAM_GB} GB of memory; this Mac has "
f"{float(P.SYSTEM_RAM_GB):.0f} GB. On this machine the trainer runs out of memory "
f"before it finishes."}, 409); return
+ # Fleet 2 Nov 2026: Start was never gated on the training weights, so a
+ # Mac without them queued run after run that the trainer stopped in under
+ # a second (22 in an hour on one Mac). Same check the trainer makes first;
+ # the code tells the Train tab to show its Download all banner.
+ _weights = P.train_weights_refusal()
+ if _weights:
+ P._analytics_feature("train_refused", "models")
+ h._json({"error": _weights, "code": "train_models"}, 409); return
P._analytics_feature("train_start")
try:
train_job_id = P._safe_job_id(train_job_id)
diff --git a/train_support.py b/train_support.py
index 6e7f946..2b77b34 100644
--- a/train_support.py
+++ b/train_support.py
@@ -20,6 +20,7 @@ from __future__ import annotations
from pathlib import Path
import json
import os
+import re
import threading
import time
@@ -275,6 +276,13 @@ def _train_weak_advice(verdict: str, preset: str = "", is_style: bool = False) -
)
+def _big_enough(path: Path, min_bytes: int) -> bool:
+ try:
+ return path.exists() and path.stat().st_size >= min_bytes
+ except OSError:
+ return False
+
+
def _train_required_models() -> list[dict]:
"""Return the list of model files Train Character needs and whether each
is present locally. Surfaces missing models to the UI so the user can
@@ -300,7 +308,8 @@ def _train_required_models() -> list[dict]:
def _file_present(local_dir: Path, repo_id: str, filename: str,
*, extra_dirs: list[Path] | None = None,
- min_bytes: int = P._MIN_FILE_BYTES) -> bool:
+ min_bytes: int = P._MIN_FILE_BYTES,
+ caches: bool = True) -> bool:
"""Check known locations for a model file in this order:
1. The primary local_dir (where the helper expects it by default).
@@ -320,6 +329,8 @@ def _train_required_models() -> list[dict]:
candidates: list[Path] = [local_dir / filename]
for d in (extra_dirs or []):
candidates.append(d / filename)
+ if not caches: # the file must be where its loader reads it
+ return any(_big_enough(c, min_bytes) for c in candidates)
cache_dir = P._repo_hf_cache_dir(repo_id)
if cache_dir is not None:
candidates.append(cache_dir / filename)
@@ -344,7 +355,7 @@ def _train_required_models() -> list[dict]:
continue
return False
- # Mirror of lora_lab/train.py FULL_DEV_MIN_BYTES: anything smaller is a
+ # Mirror of lora_lab.failure.FULL_DEV_MIN_BYTES: anything smaller is a
# quantized transformer-dev, which the trainer refuses. The preflight
# must not show green on a file the trainer will reject (#35).
_FULL_DEV_MIN_BYTES = 15 * 1000**3
@@ -368,8 +379,12 @@ def _train_required_models() -> list[dict]:
"filename": "vae_decoder.safetensors",
"local_dir": str(q4_local_dir),
"size_gb": 20.48,
+ # Local folder only: the trainer loads 2.3 from
+ # mlx_models/ltx-2.3-mlx-q4 and nowhere else (lora_lab.failure.
+ # training_weights_problem). A Hugging Face cache copy used to
+ # read "ready" here while every Start died in a second.
"ready": _file_present(q4_local_dir, "dgrauet/ltx-2.3-mlx-q4",
- "vae_decoder.safetensors"),
+ "vae_decoder.safetensors", caches=False),
},
{
"key": "ltx_dev_transformer",
@@ -390,10 +405,15 @@ def _train_required_models() -> list[dict]:
# Size-gated: an 11 GB quantized dev (the old preflight's Q4
# download, still on many disks) must show NOT-ready, because
# the trainer refuses it and the LoRA comes out dead (#35).
+ # The trainer's own two places, never a Hugging Face cache: fleet
+ # 2 Nov 2026, a Train tab that read "ready" (or a Start that was
+ # never gated) let one Mac fail 22 runs in an hour, each in under
+ # a second, on "the dev transformer is not downloaded".
"ready": _file_present(q8_local_dir, "dgrauet/ltx-2.3-mlx-q8",
"transformer-dev.safetensors",
extra_dirs=[q4_local_dir],
- min_bytes=_FULL_DEV_MIN_BYTES),
+ min_bytes=_FULL_DEV_MIN_BYTES,
+ caches=False),
},
{
"key": "gemma_text_encoder",
@@ -575,17 +595,127 @@ def train_error_from_event(payload: dict) -> dict:
}
-def train_error_for_exit(rc: int, trainer_error: dict | None) -> str:
+def train_error_for_exit(rc: int, trainer_error: dict | None, tail=None) -> str:
"""The class of a trainer that exited non-zero. The trainer's own word
wins; a process killed by SIGKILL without one is macOS reclaiming memory
- (jetsam), the one signal death that has a single cause."""
+ (jetsam), the one signal death that has a single cause. A trainer that
+ crashed before it could send its word is classed from its last traceback
+ line (an ImportError at startup is `import_error`, not `other`)."""
if trainer_error and trainer_error.get("error_class") in P.TRAIN_ERROR_CLASSES:
return trainer_error["error_class"]
if rc == -9:
return "oom"
+ exc = train_exception_from_tail(tail)
+ if exc:
+ return train_class_from_exception_name(*exc)
return "other"
+def train_stage_word(trainer_error: dict | None) -> str:
+ """The stage the trainer stopped in, from lora_lab.failure.TRAIN_STAGES
+ only (it rides on analytics as `train_stage`); "unknown" without one."""
+ from lora_lab.failure import TRAIN_STAGES
+ st = str((trainer_error or {}).get("stage") or "unknown")
+ return st if st in TRAIN_STAGES else "unknown"
+
+
+#: Opens every "can't start" refusal for a training run. The analytics
+#: refusal table matches on it (slug `train_models`), so it must not change
+#: without that table.
+TRAIN_WEIGHTS_REFUSAL_PREFIX = "Training can't start yet: "
+
+
+def train_weights_refusal() -> str | None:
+ """Why a training run cannot start on this Mac, or None (fleet 2 Nov 2026).
+
+ The SAME question the trainer asks first (lora_lab.failure.
+ training_weights_problem), asked before a run is queued, retried or
+ spawned. Until now only the trainer asked it: the run was queued, the
+ trainer stopped in under a second, the card said "training exited with
+ code 1", and the same Start (or Retry) did it again - 22 times in an hour
+ on one Mac, 31 failed runs from 3 people in a day."""
+ from lora_lab.failure import training_weights_problem
+ problem = training_weights_problem(P.MODELS_DIR / "ltx-2.3-mlx-q4")
+ if not problem:
+ return None
+ return TRAIN_WEIGHTS_REFUSAL_PREFIX + problem[0].upper() + problem[1:]
+
+
+_TRAIN_STAGE_WORDS = {
+ "models": "before it started",
+ "caption": "while preparing the captions",
+ "config": "while reading the settings",
+ "ingest": "while reading the photos",
+ "crop": "while cropping the photos",
+ "preprocess": "while encoding the photos and captions",
+ "train": "while training",
+ "publish": "while saving the result",
+ "sidecar": "while saving the result",
+ "validate": "while checking the voice clip",
+ "verify": "while checking the result",
+}
+
+# The last exception line of a Python traceback: "SomeError: text" or
+# "pkg.mod.SomeError: text", at the start of the line.
+_EXC_LINE = re.compile(r"^((?:[A-Za-z_][\w]*\.)*[A-Za-z_]\w*(?:Error|Exception|Exit|Interrupt))(?::\s*(.*))?$")
+
+
+def train_exception_from_tail(lines) -> tuple[str, str] | None:
+ """(type name, message) of the last traceback line in the trainer's plain
+ output, or None. For a trainer that died before it could send its own
+ `error` event (an import that failed, a crash in setup)."""
+ for line in reversed(list(lines or [])):
+ m = _EXC_LINE.match(str(line).strip())
+ if m:
+ return m.group(1).rsplit(".", 1)[-1], (m.group(2) or "").strip()
+ return None
+
+
+def train_class_from_exception_name(name: str, message: str = "") -> str:
+ """lora_lab.failure's closed class from a bare exception type name and its
+ text - the same reading classify_exception makes of a live exception."""
+ from lora_lab.failure import _DISK_FRAGMENTS, _OOM_FRAGMENTS
+ text = (message or "").lower()
+ if name == "MemoryError" or any(f in text for f in _OOM_FRAGMENTS):
+ return "oom"
+ if any(f in text for f in _DISK_FRAGMENTS):
+ return "disk_full"
+ if name in ("ImportError", "ModuleNotFoundError"):
+ return "import_error"
+ if name == "FileNotFoundError":
+ return "missing_file"
+ return "other"
+
+
+def train_failure_message(rc: int, trainer_error: dict | None, tail=None) -> str:
+ """What the failed training card says (fleet 2 Nov 2026).
+
+ The trainer already says why it stopped, in a sentence written for the
+ user; the panel used to drop that and show "training exited with code 1 -
+ see Logs for stack trace", the only text the user and the fleet ever saw.
+ The message stays on this Mac like every job error: analytics sends the
+ closed class and stage (train_error, train_stage), never this text."""
+ # A message of only spaces falls through to the exit-code paths below
+ # (msg[0] on an empty string would turn the card into "string index out of range").
+ if trainer_error and str(trainer_error.get("message") or "").strip():
+ where = _TRAIN_STAGE_WORDS.get(str(trainer_error.get("stage") or ""), "")
+ msg = str(trainer_error["message"]).strip()
+ msg = msg[0].upper() + msg[1:]
+ if trainer_error.get("stage") == "models":
+ return TRAIN_WEIGHTS_REFUSAL_PREFIX + msg
+ return f"Training stopped{(' ' + where) if where else ''}: {msg}"
+ if rc == -15:
+ return ("Training was stopped from outside the app (SIGTERM): Phosphene "
+ "or the Mac was shutting down, or another program ended it. "
+ "Nothing is wrong with your photos; start it again.")
+ exc = train_exception_from_tail(tail)
+ if exc:
+ name, text = exc
+ return (f"Training stopped (code {rc}): {name}"
+ f"{(': ' + text) if text else ''}. The full trace is in Logs.")
+ return f"training exited with code {rc} — see Logs for stack trace"
+
+
def _train_release_render_memory() -> None:
"""Stop the warm render helper before a training run (4.19.1)."""
try:
diff --git a/webapp/index.html b/webapp/index.html
index ef7c89c..387a6ac 100644
--- a/webapp/index.html
+++ b/webapp/index.html
@@ -6513,6 +6513,47 @@ The last line"></textarea>
<!-- Per-model licence screen (4.19.8). Filled by webapp/js/licences.js from
GET /licences; opened when the server answers 451 licence_required, from
the H3 install card, and from the H3 credit line. -->
+<!-- STAR_CARD_START: the one-time "star us on GitHub" card (owner, 2 Nov
+ 2026). A sibling of the Pro lamp card ("Help us keep the lights on"): the
+ same lamp, header and palette. Not modal and never over the clip: it sits
+ in the corner beside the result after the fifth finished render, once per
+ Mac, and any answer ends it for good. Driven by starCardPoll (health.js). -->
+<aside id="starCard" class="star-card" role="dialog" aria-modal="false" aria-labelledby="starCardTitle" hidden>
+ <button type="button" class="star-card-close" aria-label="Close" title="Close" onclick="starCardAnswer('not_now')">&times;</button>
+ <section class="lights-on-header star-card-head">
+ <div class="lights-on-wash" aria-hidden="true"></div>
+ <svg class="lights-on-lamp star-card-lamp" viewBox="0 0 140 156" width="112" height="125" fill="none" aria-hidden="true">
+ <ellipse class="lamp-pool" cx="75" cy="141" rx="54" ry="8" fill="#ffd391"/>
+ <path d="M28 135h69M42 131c0-7 6-11 16-11h17c10 0 16 4 16 11" stroke="#8e8e96" stroke-width="2" stroke-linecap="round"/>
+ <path d="M63 120 36 82 66 43M70 120 43 82 72 46" stroke="#b14aff" stroke-opacity=".72" stroke-width="2" stroke-linejoin="round"/>
+ <path d="m44 87 10-3m-5 10 10-3m-5 10 10-3" stroke="#8e8e96" stroke-width="1.4" stroke-linecap="round"/>
+ <circle cx="39" cy="82" r="6" fill="#121214" stroke="#5eeaff" stroke-opacity=".75" stroke-width="2"/>
+ <circle cx="67" cy="123" r="4" fill="#121214" stroke="#8e8e96" stroke-width="2"/>
+ <path d="M91 134c20 0 6 14 26 14h9" stroke="#8e8e96" stroke-width="1.5" stroke-linecap="round"/>
+ <g class="lamp-head">
+ <path class="lamp-beam" d="m83 62-20 69 75-15-27-65Z" fill="#ffd391"/>
+ <path d="m68 43 14-7" stroke="#5eeaff" stroke-opacity=".75" stroke-width="2"/>
+ <path d="M78 28c8-5 17-3 22 5l14 20c-9 8-21 12-34 10l-3-25c-1-4-1-7 1-10Z" fill="#121214" stroke="#b4b4bb" stroke-width="2" stroke-linejoin="round"/>
+ <path d="M81 32c5-3 10-2 13 3" stroke="#5eeaff" stroke-opacity=".7" stroke-width="1.5" stroke-linecap="round"/>
+ <path class="lamp-rim" d="M80 63c12 1 25-3 34-10" stroke="#ffd391" stroke-width="2" stroke-linecap="round"/>
+ <path class="lamp-bulb" d="M91 63c1 7 12 5 12-3" fill="#ffe5b4" stroke="#ffe5b4" stroke-width="2"/>
+ <path class="lamp-chain" d="m108 59 3 19" stroke="#b4b4bb" stroke-width="1.4" stroke-linecap="round"/>
+ <circle class="lamp-chain" cx="111" cy="81" r="2.5" fill="#b4b4bb"/>
+ </g>
+ </svg>
+ <div class="lights-on-copy">
+ <p class="lights-on-eyebrow">FREE AND OPEN SOURCE</p>
+ <h2 id="starCardTitle">Help keep<br>the lights on</h2>
+ <p class="lights-on-lead">I'm Mr Bizarro, the one person behind Phosphene. A star on GitHub costs nothing and helps the next person find it.</p>
+ </div>
+ </section>
+ <div class="star-card-actions">
+ <button type="button" class="star-card-primary" onclick="starCardAnswer('star')"><svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true"><path d="M8 1.2l2.1 4.3 4.7.7-3.4 3.3.8 4.7L8 12l-4.2 2.2.8-4.7L1.2 6.2l4.7-.7z" fill="currentColor"/></svg>Star Phosphene on GitHub</button>
+ <button type="button" class="star-card-later" onclick="starCardAnswer('not_now')">Not now</button>
+ </div>
+</aside>
+<!-- STAR_CARD_END -->
+
<div id="licenceModal" class="models-modal" style="display:none"
role="dialog" aria-modal="true" aria-labelledby="licenceTitle">
<div class="models-card licence-card">
diff --git a/webapp/js/characters.js b/webapp/js/characters.js
index f50a590..828dce8 100644
--- a/webapp/js/characters.js
+++ b/webapp/js/characters.js
@@ -3662,7 +3662,15 @@ async function trainStart() {
const r = await fetch('/train/start', { method: 'POST', body: fd });
const j = await r.json();
if (!r.ok || !j.ok) {
- if (status) status.textContent = 'Failed to enqueue: ' + (j.error || r.status);
+ // Fleet 2 Nov 2026: the training weights are not downloaded. The
+ // server's sentence already says what to do; bring the Download all
+ // banner back up so the fix is one click away, not another Start.
+ if (j && j.code === 'train_models') {
+ if (status) status.textContent = j.error;
+ trainCheckPreflight();
+ } else if (status) {
+ status.textContent = 'Failed to enqueue: ' + (j.error || r.status);
+ }
if (btn) { btn.disabled = false; restoreLabel(); }
return;
}
diff --git a/webapp/js/health.js b/webapp/js/health.js
index c6fb32d..ad19992 100644
--- a/webapp/js/health.js
+++ b/webapp/js/health.js
@@ -1021,3 +1021,52 @@ Object.assign(globalThis, {
// Stop's confirm-with-cost (queue.js) reuses this rather than inventing one.
_phModalShow, _phModalClose,
});
+
+// ---- The one-time "star us on GitHub" card (owner, 2 Nov 2026) -------------
+// After the fifth finished render the server sets `star_prompt_due` on
+// /status (see _star_prompt_after_job). The card goes up once, only while
+// the page is actually visible, and tells the server `shown` so it is never
+// put up again on this Mac. Any answer (star, waitlist, Not now, the close
+// button or Escape) ends it for good. No counters on screen; the only
+// network call is opening the link the person chose.
+const STAR_CARD_URL = 'https://github.com/mrbizarro/Phosphene';
+let _starCardUp = false;
+function _starCardPost(action) {
+ try {
+ return fetch('/star-prompt', {method: 'POST', body: new URLSearchParams({action}),
+ keepalive: true}).catch(() => {});
+ } catch (_) { return Promise.resolve(); }
+}
+function starCardPoll(s) {
+ if (_starCardUp || !s || !s.star_prompt_due) return;
+ if (document.hidden) return; // wait until someone can see it
+ const el = document.getElementById('starCard');
+ if (!el) return;
+ _starCardUp = true;
+ el.hidden = false;
+ _starCardPost('shown');
+}
+function starCardAnswer(action) {
+ const el = document.getElementById('starCard');
+ if (el) el.hidden = true;
+ if (!_starCardUp) return;
+ _starCardUp = false;
+ if (action === 'star') {
+ document.getElementById('starLink')?.classList.remove('is-calling');
+ if (typeof openExternal === 'function') openExternal(STAR_CARD_URL);
+ else window.open(STAR_CARD_URL, '_blank', 'noopener');
+ } else if (action === 'waitlist') {
+ const url = 'https://phosphene.video/pricing/';
+ if (typeof openExternal === 'function') openExternal(url);
+ else window.open(url, '_blank', 'noopener');
+ } else {
+ action = 'not_now';
+ }
+ _starCardPost(action);
+}
+document.addEventListener('keydown', (e) => {
+ if (e.key !== 'Escape' || !_starCardUp) return;
+ const el = document.getElementById('starCard');
+ if (el && el.contains(document.activeElement)) starCardAnswer('not_now');
+});
+Object.assign(globalThis, { starCardPoll, starCardAnswer });
diff --git a/webapp/js/loras.js b/webapp/js/loras.js
index b21f5c9..1b7b73f 100644
--- a/webapp/js/loras.js
+++ b/webapp/js/loras.js
@@ -320,6 +320,28 @@ function _serializeLoras() {
if (typeof renderH3LoraSlot === 'function') { try { renderH3LoraSlot(); } catch (_) {} }
}
+// The LoRAs an Image Studio render posts: the active ones the image picker
+// shows for the chosen engine (_loraRowMatchesMode), never the rest of
+// _activeLoras. That list survives every mode switch on purpose, so it can
+// hold LTX / H3 video adapters and chips hidden for another image family;
+// the Studio submit used to post all of it (4.19.16), handing mflux files it
+// could never load. FLUX 3 takes no LoRAs at all.
+function imageLorasForSubmit() {
+ const tag = _currentLoraModeFilter();
+ if (tag === 'image:flux3') return [];
+ const known = Array.isArray(_knownUserLoras) ? _knownUserLoras : [];
+ return (Array.isArray(_activeLoras) ? _activeLoras : []).filter(l => {
+ if (!l || !l.path) return false;
+ const u = known.find(x => x.path === l.path) || {};
+ return _loraRowMatchesMode({
+ path: l.path, name: l.name, filename: u.filename,
+ kind: !u.path ? 'remote' : (u.kind === 'train_character' ? 'trained' : 'user'),
+ lane: u.lane || l.lane || 'ltx',
+ compatible_modes: u.compatible_modes || l.compatible_modes || ['unknown'],
+ }, tag);
+ }).map(l => ({ path: l.path, strength: l.strength }));
+}
+
function updateQualityChipsForLora() {
const trained = Array.isArray(_activeLoras) && _activeLoras.some(a => {
const meta = Array.isArray(_knownUserLoras)
@@ -572,9 +594,19 @@ async function refreshLoras() {
}
// If a row was previously active but the file is gone (deleted on
// disk), drop it from the active set so we don't submit a stale path.
+ // 4.19.17 (fleet 4.19.16): the old test kept every path containing '/' -
+ // meant to spare Hugging Face ids ("org/repo"), it spared every absolute
+ // path too, so a deleted LoRA restored from a draft or Load Params stayed
+ // picked forever and every Image render failed "LoRA file not found". A
+ // filesystem path (leading / or ~) must be in the library; an id is kept.
+ // Only on a real listing: an error body without `user` must not unpick all.
const knownPaths = new Set(_knownUserLoras.map(l => l.path));
- _activeLoras = _activeLoras.filter(l =>
- knownPaths.has(l.path) || l.path.includes('/')); // keep HF ids (no dir slash)
+ if (Array.isArray(data.user)) {
+ _activeLoras = _activeLoras.filter(l => {
+ const p = String((l && l.path) || '');
+ return knownPaths.has(p) || !(p.startsWith('/') || p.startsWith('~'));
+ });
+ }
renderLorasList();
_serializeLoras();
// The picker's own visibility depends on the H3 gate we just refreshed.
@@ -592,6 +624,52 @@ function _loraGenerationCompatible(row, modeTag) {
return !(modeTag === 'video' && row && row.ltx_compatible === false);
}
+// Does a picker row belong to the active (mode + engine) lane? The ONE rule,
+// shared by the picker's filter (renderLorasList) and the Image Studio submit
+// (imageLorasForSubmit), so what the picker shows and what is posted agree.
+function _loraRowMatchesMode(r, modeTag) {
+ if (!modeTag) return true;
+ // Heuristic: trained character bundles (e.g. bizarrotrn_v2.safetensors,
+ // .audio.safetensors, .voice.wav) are video-only conditioning even
+ // when their sidecar tagged them ['unknown']. Without this rule, the
+ // 'unknown' branch below would surface them in image-mode pickers —
+ // exactly the LTX-LoRA-leakage Mr Bizarro complained about:
+ // "they show the LTX LoRA's. You need to separate both galleries."
+ const _looksVideoOnly = (r) => {
+ if (r.kind === 'trained') return true;
+ const path = (r.path || r.filename || r.name || '').toLowerCase();
+ if (/_v2\.safetensors$/.test(path)) return true; // character convention
+ if (/\.audio\.safetensors$/.test(path)) return true; // character audio companion
+ if (/\.voice\./.test(path)) return true; // character voice clip
+ if (/\.style\.safetensors$/.test(path)) return true; // style LoRA convention
+ return false;
+ };
+ const tags = r.compatible_modes || ['unknown'];
+ const isImageMode = (modeTag === 'image' || modeTag.startsWith('image:'));
+ if (isImageMode) {
+ // Image modes only accept LoRAs whose sidecar declared an
+ // image:* family. The 'unknown' branch is still permissive
+ // (sidecar-less drops should still surface) but EXCLUDES
+ // anything that looks like a character/style video bundle.
+ if (tags.some(t => typeof t === 'string' && t.startsWith('image:'))) return true;
+ if (tags.includes('unknown') && !_looksVideoOnly(r)) return true;
+ return false;
+ }
+ // ---- Video lanes: LTX and Hailuo H3, by DIRECTORY -----------------
+ // 2026-08-09: the video side stopped being one family the moment H3
+ // learned to take LoRAs, and the two are not interchangeable in
+ // either direction — an LTX adapter handed to H3's loader matches
+ // zero modules (silent no-op), an H3 one handed to LTX fails inside
+ // the fuser. The 'unknown' escape hatch above is what makes this a
+ // lane check rather than a tag check: a sidecar-less .safetensors
+ // dropped into mlx_models/loras/ classifies as 'unknown' and would
+ // otherwise surface in the H3 picker, which is the exact
+ // cross-gallery leakage the image split was built to stop.
+ if (modeTag === 'video:h3') return r.lane === 'h3';
+ if (r.lane === 'h3') return false;
+ return tags.includes(modeTag) || tags.includes('unknown');
+}
+
function renderLorasList() {
const wrap = document.getElementById('lorasList');
const empty = document.getElementById('lorasEmpty');
@@ -690,47 +768,7 @@ function renderLorasList() {
let hiddenCount = 0;
const showOtherModes = !!window._loraShowOtherModes;
if (modeTag) {
- // Heuristic: trained character bundles (e.g. bizarrotrn_v2.safetensors,
- // .audio.safetensors, .voice.wav) are video-only conditioning even
- // when their sidecar tagged them ['unknown']. Without this rule, the
- // 'unknown' branch below would surface them in image-mode pickers —
- // exactly the LTX-LoRA-leakage Mr Bizarro complained about:
- // "they show the LTX LoRA's. You need to separate both galleries."
- const _looksVideoOnly = (r) => {
- if (r.kind === 'trained') return true;
- const path = (r.path || r.filename || r.name || '').toLowerCase();
- if (/_v2\.safetensors$/.test(path)) return true; // character convention
- if (/\.audio\.safetensors$/.test(path)) return true; // character audio companion
- if (/\.voice\./.test(path)) return true; // character voice clip
- if (/\.style\.safetensors$/.test(path)) return true; // style LoRA convention
- return false;
- };
- const _matches = (r) => {
- const tags = r.compatible_modes || ['unknown'];
- const isImageMode = (modeTag === 'image' || modeTag.startsWith('image:'));
- if (isImageMode) {
- // Image modes only accept LoRAs whose sidecar declared an
- // image:* family. The 'unknown' branch is still permissive
- // (sidecar-less drops should still surface) but EXCLUDES
- // anything that looks like a character/style video bundle.
- if (tags.some(t => typeof t === 'string' && t.startsWith('image:'))) return true;
- if (tags.includes('unknown') && !_looksVideoOnly(r)) return true;
- return false;
- }
- // ---- Video lanes: LTX and Hailuo H3, by DIRECTORY -----------------
- // 2026-08-09: the video side stopped being one family the moment H3
- // learned to take LoRAs, and the two are not interchangeable in
- // either direction — an LTX adapter handed to H3's loader matches
- // zero modules (silent no-op), an H3 one handed to LTX fails inside
- // the fuser. The 'unknown' escape hatch above is what makes this a
- // lane check rather than a tag check: a sidecar-less .safetensors
- // dropped into mlx_models/loras/ classifies as 'unknown' and would
- // otherwise surface in the H3 picker, which is the exact
- // cross-gallery leakage the image split was built to stop.
- if (modeTag === 'video:h3') return r.lane === 'h3';
- if (r.lane === 'h3') return false;
- return tags.includes(modeTag) || tags.includes('unknown');
- };
+ const _matches = (r) => _loraRowMatchesMode(r, modeTag);
rows = allRows.filter(r => {
// A model-family mismatch may be revealed with "Show other modes";
// an adapter proven unable to attach to the active LTX generation may
@@ -1496,7 +1534,7 @@ function renderCharacterStrip() {
Object.assign(globalThis, {
checkLoraUpdates, updateLora, writeLoraGuide,
_currentLoraModeFilter, _syncLoraPickerForEngine, importH3Lora, renderH3LoraSlot,
- setH3LoraSlot, _serializeLoras, enhanceLoraPaths, addLoraToActive, populateIngredientCharLoras,
+ setH3LoraSlot, _serializeLoras, imageLorasForSubmit, enhanceLoraPaths, addLoraToActive, populateIngredientCharLoras,
onIngredientCharChange, onIngredientCharStrength, refreshLoras, _loraGenerationCompatible,
renderLorasList, appendTriggerToPrompt, _updateCharsPickerVisibility, refreshManualCharacters,
_renderManualCharactersList, _renderCharsAppliedNote, renderCharacterStrip,
diff --git a/webapp/js/queue.js b/webapp/js/queue.js
index fb3e508..e6fb4e6 100644
--- a/webapp/js/queue.js
+++ b/webapp/js/queue.js
@@ -3464,6 +3464,7 @@ async function poll() {
try {
s = await (await fetch(url)).json();
notifyJobsDone(s);
+ if (typeof starCardPoll === 'function') { try { starCardPoll(s); } catch (_) {} }
_POLL_FAILS = 0;
_setOfflineBanner(false);
} catch (e) {
@@ -4678,6 +4679,14 @@ async function retryJob(jobId, opts) {
let data = {};
try { data = await r.json(); } catch (e) { /* keep empty */ }
if (!r.ok || !data.ok) {
+ // Fleet 2 Nov 2026: a training run whose weights are not downloaded
+ // cannot work however often it is retried. Say why and take the user
+ // to the Train tab, where Download all is.
+ if (data.code === 'train_models') {
+ alert(data.error);
+ if (typeof workflowSwitch === 'function') workflowSwitch('train');
+ return;
+ }
alert('Retry failed: ' + (data.error || ('HTTP ' + r.status)));
return;
}
diff --git a/webapp/js/stage.js b/webapp/js/stage.js
index a0a8add..b0d6c5b 100644
--- a/webapp/js/stage.js
+++ b/webapp/js/stage.js
@@ -47,6 +47,12 @@ function imgStudioUpdateValidity() {
} else if (engInfo && engInfo.fits_mac === false) {
invalidReason = 'This engine needs a ' + engInfo.mac_gb_needed + ' GB Mac — this one has '
+ (_IMG_HOST_RAM_GB || '?') + ' GB. Auto (the 4B FLUX engine) fits here.';
+ } else if (refsCount > ((engInfo && engInfo.max_refs) || 3)) {
+ // The server's cap (image_max_refs, via /image/engine_status). Fleet
+ // 4.19.16: a job over it was queued and failed on its turn.
+ const cap = (engInfo && engInfo.max_refs) || 3;
+ invalidReason = 'This engine takes at most ' + cap + ' reference images — remove '
+ + (refsCount - cap) + ' to generate.';
} else if (needsRefs && refsCount === 0) {
// SYS-14: "Pick a reference image" was the whole message -- for
// someone who came here to make a FIRST picture from words (no photo
@@ -1835,13 +1841,19 @@ async function imgStudioGenerate() {
// imgStudioGenerate doesn't go through FormData(genForm), so we
// attach it explicitly from _activeLoras here. Stacks on top of any
// preset LoRA the chosen engine_override pinned (Lightning, etc.) —
- // run_image_job_inner does the merge.
- if (typeof _activeLoras !== 'undefined' && Array.isArray(_activeLoras) && _activeLoras.length) {
- const slim = _activeLoras.map(l => ({ path: l.path, strength: l.strength }));
- fd.set('loras', JSON.stringify(slim));
- }
+ // run_image_job_inner does the merge. Only the LoRAs the image picker
+ // shows for this engine (imageLorasForSubmit) - not every chip a video
+ // mode left in _activeLoras.
+ const slim = (typeof imageLorasForSubmit === 'function') ? imageLorasForSubmit() : [];
+ if (slim.length) fd.set('loras', JSON.stringify(slim));
const r = await fetch('/queue/add', { method: 'POST', body: fd });
- if (!r.ok) throw new Error(`HTTP ${r.status}`);
+ if (!r.ok) {
+ // A refusal (400 input_missing, ...) carries its reason - show it, not
+ // the status code (4.19.17).
+ let why = `HTTP ${r.status}`;
+ try { const j = await r.json(); if (j && j.error) why = j.error; } catch (_) {}
+ throw new Error(why);
+ }
// The job is queued — if the Ideogram canvas is holding the right stage,
// flip it to Result so the player (with its inline job-progress overlay) is
// visible the moment the render starts.
diff --git a/webapp/style/panel.css b/webapp/style/panel.css
index 0e1ab51..60a5c6a 100644
--- a/webapp/style/panel.css
+++ b/webapp/style/panel.css
@@ -12978,3 +12978,67 @@ body[data-engine="h3"][data-vmode="v2a"] #h3LengthLabel { display: none !importa
.h3-speed .h3-v13-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.h3-speed .h3-v13-note .h3-v13-get { padding: 2px 10px; font-size: 12px; }
.h3-speed .h3-v13-note .h3-v13-get[hidden] { display: none !important; }
+
+/* LIGHTS_ON_CSS_START */
+/* The Pro lamp header, the same block as the 5.0 line (shared there with
+ the Mac app's bundled header, docs/PRO_LAMP.md). Here it dresses the
+ one-time "star us on GitHub" card. */
+.lights-on-header { position: relative; isolation: isolate; display: flex; align-items: center; gap: 22px; padding: 30px 26px; overflow: hidden; border: 1px solid #2a2a2f; border-radius: 12px; background: #0b0b0c; color: #f4f4f5; font-family: Archivo, -apple-system, BlinkMacSystemFont, sans-serif; box-sizing: border-box; }
+.lights-on-header * { box-sizing: border-box; }
+.lights-on-copy { position: relative; min-width: 0; z-index: 1; }
+.lights-on-eyebrow { margin: 0 0 12px; color: #b4b4bb; font-size: 13px; font-weight: 600; letter-spacing: 1.8px; line-height: 1.3; }
+.lights-on-header h2 { text-transform: none; font-variation-settings: "wdth" 86; margin: 0; color: #f4f4f5; font-size: 40px; font-weight: 760; font-stretch: 86%; letter-spacing: -.8px; line-height: 1.02; animation: lamp-title 2.8s ease-out both; }
+.lights-on-lead { max-width: 49ch; margin: 16px 0 0; color: #b4b4bb; font-size: 14px; line-height: 1.55; }
+.lights-on-lamp { position: relative; z-index: 1; width: 112px; height: 125px; flex: 0 0 112px; overflow: visible; }
+.lights-on-wash { pointer-events: none; position: absolute; inset: 0; background: radial-gradient(ellipse at 28% 55%, rgba(255,199,115,.13), transparent 69%); opacity: 1; animation: lamp-bloom 2.8s ease-out both; }
+.lamp-head { transform-origin: 70px 43px; animation: lamp-stutter 2.8s linear both; }
+.lamp-chain { animation: lamp-pull 2.8s ease-out both; }
+.lamp-bulb, .lamp-rim { animation: lamp-ignite 2.8s linear both; }
+.lamp-beam { opacity: .08; animation: lamp-beam 2.8s ease-out both; }
+.lamp-pool { opacity: .12; animation: lamp-pool 2.8s ease-out both; }
+@keyframes lamp-ignite { 0%, 15% { opacity: .12; } 19%, 24% { opacity: .85; } 29%, 40% { opacity: .12; } 45%, 51% { opacity: .65; } 56%, 62% { opacity: .25; } 72%, 100% { opacity: 1; } }
+@keyframes lamp-stutter { 0%, 12% { transform: rotate(-7deg); } 20% { transform: rotate(3deg); } 28%, 40% { transform: rotate(-2deg); } 43% { transform: rotate(-.6deg); } 46% { transform: rotate(-2deg); } 49% { transform: rotate(-.6deg); } 52% { transform: rotate(-2deg); } 75%, 100% { transform: rotate(0); } }
+@keyframes lamp-pull { 0%, 7%, 30%, 100% { transform: translateY(0); } 16% { transform: translateY(6px); } 23% { transform: translateY(-2px); } }
+@keyframes lamp-bloom { 0%, 58% { opacity: 0; } 73% { opacity: .3; } 100% { opacity: 1; } }
+@keyframes lamp-beam { 0%, 58% { opacity: 0; } 73% { opacity: .025; } 100% { opacity: .08; } }
+@keyframes lamp-pool { 0%, 58% { opacity: 0; } 100% { opacity: .12; } }
+@keyframes lamp-title { 0%, 58% { color: #f4f4f5; text-shadow: none; } 100% { color: #fff0d8; text-shadow: 0 0 32px rgba(255,199,115,.13); } }
+@media (max-width: 560px) {
+ .lights-on-header { gap: 12px; padding: 24px 18px; }
+ .lights-on-lamp { width: 76px; height: 85px; flex-basis: 76px; }
+ .lights-on-header h2 { font-size: 32px; }
+ .lights-on-lead { font-size: 13px; }
+}
+/* Native accessibilityReduceMotion is also applied before the first paint. */
+.lights-on-reduced .lights-on-header *, .lights-on-reduced .lights-on-header h2 { animation: none !important; }
+.lights-on-reduced .lights-on-header h2 { color: #fff0d8; text-shadow: 0 0 32px rgba(255,199,115,.13); }
+@media (prefers-reduced-motion: reduce) {
+ .lights-on-header *, .lights-on-header h2 { animation: none !important; }
+ .lights-on-header h2 { color: #fff0d8; text-shadow: 0 0 32px rgba(255,199,115,.13); }
+}
+/* LIGHTS_ON_CSS_END */
+
+/* STAR_CARD_CSS_START: the one-time "star us on GitHub" card (owner, 2 Nov
+ 2026). The Pro lamp header at card size; nothing new in the palette. */
+.star-card { position: fixed; right: 20px; bottom: 20px; z-index: 900; width: min(400px, calc(100vw - 32px)); border: 1px solid #2a2a2f; border-radius: 14px; background: #0b0b0c; color: #f4f4f5; box-shadow: 0 24px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(255,211,145,.04); overflow: hidden; animation: star-card-in .42s cubic-bezier(.2,.8,.2,1) both; }
+.star-card[hidden] { display: none; }
+.star-card .star-card-head { border: 0; border-radius: 0; background: transparent; gap: 14px; padding: 24px 22px 8px 18px; }
+.star-card .star-card-lamp { width: 76px; height: 85px; flex-basis: 76px; }
+.star-card .star-card-head h2 { font-size: 27px; letter-spacing: -.4px; }
+.star-card .lights-on-eyebrow { margin-bottom: 9px; font-size: 11px; letter-spacing: 1.6px; }
+.star-card .lights-on-lead { margin-top: 10px; font-size: 13px; line-height: 1.5; }
+.star-card-actions { display: flex; align-items: center; gap: 6px; padding: 12px 22px 18px; }
+.star-card-primary { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 4px; padding: 11px 15px; background: #f4f4f5; color: #0b0b0c; font: inherit; font-size: 13px; font-weight: 650; white-space: nowrap; cursor: pointer; }
+.star-card-primary svg { color: #c98a2b; flex: 0 0 auto; }
+.star-card-primary:hover { background: #fff0d8; }
+.star-card-later { border: 0; background: transparent; color: #b4b4bb; font: inherit; font-size: 13px; padding: 11px 8px; cursor: pointer; }
+.star-card-later:hover { color: #f4f4f5; }
+.star-card-quiet { display: block; padding: 0 22px 18px; margin-top: -6px; color: #8e8e96; font-size: 12px; text-decoration: none; }
+.star-card-quiet:hover { color: #b4b4bb; text-decoration: underline; }
+.star-card-close { position: absolute; top: 8px; right: 10px; z-index: 2; width: 28px; height: 28px; border: 0; border-radius: 4px; background: transparent; color: #8e8e96; font-size: 20px; line-height: 1; cursor: pointer; }
+.star-card-close:hover { color: #f4f4f5; background: #19191c; }
+.star-card button:focus-visible, .star-card a:focus-visible { outline: 2px solid #ffd391; outline-offset: 2px; }
+@keyframes star-card-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
+@media (prefers-reduced-motion: reduce) { .star-card { animation: none; } }
+@media (max-width: 560px) { .star-card { right: 16px; bottom: 16px; } .star-card .star-card-head h2 { font-size: 24px; } }
+/* STAR_CARD_CSS_END */