Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.
Python ai-filmmakingai-videoai-video-generatorapple-siliconhailuoimage-to-videolip-synclocal-ailora-trainingltx-2ltx-2-5ltx-videomacosminimax-h3mlxmusic-generationoffline-aipinokiotext-to-videovideo-generation
release(v4.9.3): the full-review fixes — Storyboard on 24 GB Macs, character rename, Image Studio memory gating, H3 engine pin on Update (#71, #74)
mrbizarro8c0b367cd534
diff --git a/README.md b/README.mdindex 1ede320..ae39e77 100644--- a/README.md+++ b/README.md@@ -13,7 +13,7 @@</p>-> **Current release: v4.9.2.** Three issue fixes: an interrupted image-model download now resumes instead of crashing every generation (#73), character training survives the GPU watchdog killing caption encoding by relaunching once at a shorter text encode (#61), and suggested trigger words are letters-only — the old `mrz07` shape was half digit tokens (#62). Includes v4.9.1, which fixed the buttons v4.9.0's reorganization silently broke (thanks @blackest) and added an "×" on the Recent-uploads strip. Full notes on the [releases page](https://github.com/mrbizarro/phosphene/releases).+> **Current release: v4.9.3.** Fixes from a full review of the fast 4.9.x releases. Storyboard works again on Macs that cap at 768 (24 GB): new films are planned at a size the Mac can deliver, the fix button offers the real size, and the Quality section is visible at Pinokio window widths (#71). Renaming a character works again. A freshly trained character clicked "Use in video" now actually rides on the render. Image Studio tells 8/24 GB Macs up front which engines fit instead of refusing at the last second. High/Keyframes/Extend without the Q8 pack point to Settings → Models. Image mode with no image is stopped at the button. Update moves the H3 engine to its pinned branch before building the half-memory engine (#74, thanks @blackest). Full notes on the [releases page](https://github.com/mrbizarro/phosphene/releases).## Overviewdiff --git a/VERSION b/VERSIONindex dad10c7..c01c413 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-4.9.2+4.9.3diff --git a/docs/ANALYTICS.md b/docs/ANALYTICS.mdindex f044da8..64a00c0 100644--- a/docs/ANALYTICS.md+++ b/docs/ANALYTICS.md@@ -256,7 +256,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). 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). 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 failurediff --git a/docs/STATE.md b/docs/STATE.mdindex 6b0d7da..42dc7c9 100644--- a/docs/STATE.md+++ b/docs/STATE.md@@ -1,5 +1,56 @@# Phosphene — project state, history, open work+> **🩹 2026-09-03 — v4.9.3: the full-review fixes, shipped as a plain bugfix.**+> Everything in the 09-02 review entry below, plus #74 (Update now moves the+> H3 engine checkout to `codex/h3-engine-v2` via the new shared+> `scripts/pinokio/h3_checkout.sh` before building the Q8 engine — diagnosed+> by @blackest). Image-mode identity on the 24 GB lane was REPRODUCED AS+> WORKING (Q4 · Balanced · Anchor, seed 4242: frame one = the reference, the+> character holds to the last frame) — the Pinokio report from @vxlab is not+> a code defect on the default path; answered with the Anchor/Inspire and+> train-a-character guidance. Gates: full 58/0/0 including the codec check on+> that clip. Promoted by the snapshot ritual.++> **🔎 2026-09-02 — FULL REVIEW after the fast releases (4.9.0→4.9.2): fix wave on dev/beta, UNRELEASED (dcb2589).**+> Four audit lanes + fleet analytics. **Verdicts:** the module split is sound+> (634 publishes checked, zero order hazards) and the route move is+> behaviour-identical (2,568 probes old vs new); update from 4.8.2/4.6.0 and+> fresh install both rehearsed clean. **What shipped broken and is now fixed+> on beta:** (1) Storyboard on a 768-cap Mac — every NEW film was born with an+> illegal 1024×576 delivery (clamp never ran for a fresh board), Render dead+> from the first click, fix button offered the same illegal size, Quality+> section crushed to 2px at Pinokio width, dropdowns replaced by the poll+> (#71 follow-up; `storyboard.fit_canvas`, `test_storyboard_capfit.py`);+> (2) character rename always failed (route split lost one body-read+> preamble); (3) trained character "Use in video" never sent the LoRA+> (called a serialiser that never existed); (4) Image Studio offered 8/24 GB+> Macs engines that can't fit — 15/16 "unclassified" failures on 4.9.0 —+> now disabled with "needs a 32 GB Mac", Studio moves to Auto, guard is a+> refusal (`image_ram`); (5) High/Keyframes/Extend without the Q8 pack →+> refusal (`pack_missing`) pointing at Settings → Models, not a CLI line;+> (6) Image mode with no image stopped at the button; (7) header memory+> readout clipped at 1300px; (8) in-app Update now skipped post_update.sh+> when only it changed + self-repair probe covered 1 of 3 packages ++> production serves boot-time webapp snapshot; (9) classifier: helper_exit+> moved below model_missing/disk_full (was swallowing ~500 events/wk),+> stuck partial downloads bounded. **Gate added:** lint_webapp fails on a+> handler calling a function nothing declares. Gates: full 58/0/0, --fast+> 56/0/2 on the final tree.+> **Fleet (3 days):** 501 active installs/wk, 93 new on 09-01; 4.9.0 fail+> rate 9.6% (4.8.1 was 23%); **43% of active installs rendered nothing all+> week** — activation is the product problem, not stability. 22% of the+> fleet has ≤24 GB. i2v > t2v; characters used in ~4% of renders; no events+> for Storyboard/Editor use at all (instrumentation gap).+> **Open:** Pinokio has NO Official Update post for 4.9.0/4.9.1/4.9.2 (rule:+> post on every release); Pinokio question from @vxlab (24 GB, i2v loses the+> reference face) unanswered; Lane B P1 — keyframe/audio/LoRA "not found"+> gates lack the plain-English remedy the i2v gate has; Lane A — 3 function+> names reached only through strings (`install_card` table, Python-emitted+> `openModelsModal`, `${cta.run}`) that the lint cannot see.+> **Process lesson:** two review agents ran `pkill -f mlx_ltx_panel.py` and+> killed the owner's 8199 panel — briefs must mandate PID kills (memory+> `feedback_agents_never_pkill_by_pattern`).+> **🩹 2026-09-02 — v4.9.2: three issue fixes (#73, #61, #62), shipped the same day as v4.9.1.**> **#73 — an interrupted image-engine download looked ready and crashed every> render.** Qwen-Image-Edit-2511 stopped at 38 of 54 GB with 14 blobs stilldiff --git a/image_engine.py b/image_engine.pyindex ccd2fc9..473e1a5 100644--- a/image_engine.py+++ b/image_engine.py@@ -157,6 +157,9 @@ def hf_repo_partial_download(repo_id: str, env: "dict | None" = None) -> "dict |"repo_dir": repo_dir}+_REPAIR_MEMO: dict = {} # repo_id -> on_disk_gb at the last repair attempt++def repair_partial_hf_download(repo_id: str, env: "dict | None" = None) -> "dict | None":"""Make an interrupted download resume instead of crash.@@ -173,7 +176,19 @@ def repair_partial_hf_download(repo_id: str, env: "dict | None" = None) -> "dictimport shutil as _shutilinfo = hf_repo_partial_download(repo_id, env)if not info:+ _REPAIR_MEMO.pop(str(repo_id), None)return None+ # Bounded (review 2026-09-02): if the previous attempt in this process+ # left the download exactly where it was, wiping and re-fetching again+ # on every render just burns time — say what's stuck instead.+ on_disk = round(float(info.get("on_disk_gb") or 0.0), 2)+ if _REPAIR_MEMO.get(str(repo_id)) == on_disk:+ raise RuntimeError(+ f"The download for {repo_id} is stuck at {on_disk:.1f} GB — it did "+ f"not grow on the last try. Check free disk space and the network, "+ f"then Generate again to resume it."+ )+ _REPAIR_MEMO[str(repo_id)] = on_disksnaps = info["repo_dir"] / "snapshots"if snaps.is_dir():_shutil.rmtree(snaps, ignore_errors=True)diff --git a/install_h3.js b/install_h3.jsindex 11d4b04..068111e 100644--- a/install_h3.js+++ b/install_h3.js@@ -133,9 +133,10 @@ module.exports = {params: {path: "minimax-h3-mlx",message: [- "git fetch --force origin " + H3_BRANCH,- "if [ -d minimax_h3_mlx ]; then git reset --hard HEAD; else echo 'WARN: not the H3 tree - skipping reset'; fi",- "git checkout --force -B " + H3_BRANCH + " FETCH_HEAD",+ // The pin itself lives in scripts/pinokio/h3_checkout.sh (#74: Update+ // must make the same move; one literal, two callers). H3_BRANCH above+ // is only the fresh-clone branch and must match it.+ "bash ../scripts/pinokio/h3_checkout.sh \"$(pwd)\"","git rev-parse --short HEAD"]}diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.pyindex 24a25c5..d1cc886 100644--- a/mlx_ltx_panel.py+++ b/mlx_ltx_panel.py@@ -4341,7 +4341,7 @@ def _run_stats_fetch_once() -> None:"stats: no GitHub token resolvable (tried ""PHOSPHENE_REPO_STATS_TOKEN, GH_STATS_TOKEN, GH_TOKEN, ""GITHUB_TOKEN, `gh auth token`). Dashboard will be empty "- "until you set one. See docs/stats-README.md."+ "until you set one.")_STATS_WARNED_NO_TOKEN = Truereturn@@ -12074,6 +12074,12 @@ _ANALYTICS_REFUSAL_REASONS = (# front instead — the remedy is two Update clicks, and the refusal says# so. Capability comes from the helper's gemma4_tower_supported probe.("stale_engine", ("predates ltx-2.5's text encoder",)),+ # Image Studio memory guard (review 2026-09-02) — both of its messages+ # open with this phrase; the disk-space pre-flight does not.+ ("image_ram", ("image pre-flight:",)),+ # A quality/mode that needs the Q8 pack, chosen on a Mac that hasn't+ # downloaded it — an install prompt, not a fault (review 2026-09-02).+ ("pack_missing", ("isn't downloaded on this mac yet",)),)_ANALYTICS_REFUSAL_SLUGS = tuple(s for s, _ in _ANALYTICS_REFUSAL_REASONS)@@ -12115,14 +12121,6 @@ _ANALYTICS_ERROR_CLASSES = (("oom_jetsam", ("sigkill", "helper died mid-job")),("native_crash", ("sigsegv", "sigbus", "sigabrt")),("helper_start_timeout", ("helper failed to start", "handshake")),- # "exited with code N" is the shared shape of six raise sites (training,- # audio trainer, H3 render, upscale, qwen-edit, generic subprocess) that- # all landed in `other`. Negative codes are decoded to signal names at the- # raise sites, so SIGKILL/SIGABRT strings are claimed by the rows above- # before this needle sees them.- ("helper_exit", ("pipe closed", "broken pipe", "helper exited",- "exited mid-job", "exited with code",- "failed (exit")),# ONE NEEDLE HOISTED, so the row below cannot claim it: a hub# "repo not found" is a fetch fault about something that was never local.# The rest of `download_failed` stays in its original place, BELOW@@ -12148,8 +12146,9 @@ _ANALYTICS_ERROR_CLASSES = (# fleet story as one whose file has gone, and splitting them across two# classes would hide half of it.("input_missing", ("does not exist", "no longer exists",- "not found:", "no longer on disk",- "needs a reference image")),+ "not found:", "not found at", "no longer on disk",+ "not on disk",+ "needs a reference image", "needs at least 1 reference")),# HOISTED ABOVE THE LOOSE `download` NEEDLE for the same reason# `input_missing` is: these strings carry paths and reassurances that# contain the word "download". "[load_safetensors] Failed to open file@@ -12179,6 +12178,19 @@ _ANALYTICS_ERROR_CLASSES = (("venv_broken", ("venv", "dangling", "runner missing","no module named")),("disk_full", ("enospc", "no space left")),+ # BELOW model_missing / download_failed / model_corrupt / disk_full ON+ # PURPOSE (review 2026-09-02): the subprocess-exit sentence wraps the+ # real cause ("mflux-generate failed (exit 1) … Failed to open file …",+ # "… No space left on device"), and sitting above them it claimed 493+ # missing-weights events a week as a generic exit.+ # "exited with code N" is the shared shape of six raise sites (training,+ # audio trainer, H3 render, upscale, qwen-edit, generic subprocess) that+ # all landed in `other`. Negative codes are decoded to signal names at the+ # raise sites, so SIGKILL/SIGABRT strings are claimed by the rows above+ # before this needle sees them.+ ("helper_exit", ("pipe closed", "broken pipe", "helper exited",+ "exited mid-job", "exited with code",+ "failed (exit")),("export_failed", ("ffmpeg", "pipersr")),("bad_params", ("required", "invalid", "unknown mode","unsupported mode", "must be", "out of range")),@@ -15252,6 +15264,11 @@ def storyboard_status() -> dict:"engine_modes": list(STORYBOARD_ENGINE_MODES),"draft_qualities": list(STORYBOARD_DRAFT_QUALITIES),"final_qualities": list(STORYBOARD_FINAL_QUALITIES),+ # What each quality DELIVERS on this Mac, clamped. The chips are+ # labelled from this and the click writes exactly what the chip says —+ # the browser computes no canvas of its own (docs/ARCHITECTURE.md).+ "max_dim": _sb_max_dim(),+ "canvases": _sb_canvases(),"defaults": {"shots": s.get("storyboard_shots", 12),"draft_quality": s.get("storyboard_draft_quality", "quick"),@@ -15355,24 +15372,41 @@ def _sb_parse_locations(text: str) -> list[dict]:return out+# A FILM'S canvas per quality tier — one size for every shot in the film, which+# is why this is not the Manual strip's registry canvas (Standard there is+# 1280x704). ONE home: the policy builder below, the BOOT table the Quality+# chips are labelled from, and the over-cap fix all read this and nothing else.+# Three copies of it used to exist — here, in webapp/js/storyboard.js, and as+# hand-written sub-labels in webapp/index.html — and the chips advertised sizes+# the click then did not write.+_SB_QUALITY_CANVAS = {+ "quick": (640, 448),+ "balanced": (768, 432),+ "standard": (1024, 576),+ "high": (1024, 576),+ "high_720p": (1024, 576),+}+++def _sb_canvases() -> dict:+ """Quality key -> the canvas THIS Mac actually delivers, already clamped."""+ cap = _sb_max_dim()+ out = {}+ for q, (w, h) in _SB_QUALITY_CANVAS.items():+ fw, fh = storyboard.fit_canvas(w, h, cap)+ out[q] = {"width": fw, "height": fh}+ return out++def _sb_policy_for(draft_quality: str, final_quality: str) -> dict:"""The board's two passes, in the panel's own geometry vocabulary, clampedto what this Mac can actually render."""cap = _sb_max_dim()- table = {- "quick": (640, 448),- "balanced": (768, 432),- "standard": (1024, 576),- "high": (1024, 576),- }def cell(q, default):q = (q or default).strip().lower()- w, h = table.get(q, table[default])- if max(w, h) > cap:- scale = cap / float(max(w, h))- w = max(64, int(w * scale) // 8 * 8)- h = max(64, int(h * scale) // 8 * 8)+ w, h = _SB_QUALITY_CANVAS.get(q, _SB_QUALITY_CANVAS[default])+ w, h = storyboard.fit_canvas(w, h, cap)return {"quality": q, "width": w, "height": h,"frames": storyboard.ltx_frames_for(5)}@@ -19648,6 +19682,34 @@ def _preflight_model_cached(cfg) -> bool:return _repo_hf_cache_dir(model) is not None+_IMAGE_ENGINE_LABELS = {+ "auto": "the Auto engine",+ "qwen_edit_lightning_inline": "Reference Edit — Fast",+ "qwen_edit_inline": "Reference Edit — Standard",+ "qwen_edit_high_inline": "Reference Edit — Quality",+ "ideogram4_inline": "Ideogram 4",+ "hidream_fast_inline": "HiDream Fast",+ "hidream_inline": "HiDream Medium",+ "hidream_quality_inline": "HiDream Quality",+}++# Fleet Mac sizes, for "needs a 32 GB Mac" copy. The pre-flight compares+# the engine's need against FREE memory, and macOS keeps several GB for+# itself, so an engine needing 24 GB free never passes on a 24 GB Mac —+# the honest floor is need + 4, rounded up to a size that exists.+_MAC_SIZES_GB = (8, 16, 24, 32, 36, 48, 64, 96, 128, 192, 256, 512)+++def _image_engine_fit(need_gb: float) -> tuple[bool, int]:+ """(fits this Mac at all, smallest Mac size that does) for an engine+ needing `need_gb` free memory. Total RAM is the judge here, not free:+ this is the "can this machine ever run it" question the Image Studio+ asks BEFORE offering an engine."""+ floor = float(need_gb) + 4.0+ mac_gb = next((g for g in _MAC_SIZES_GB if g >= floor), int(round(floor)))+ return (float(SYSTEM_RAM_GB or 0) >= floor), mac_gb++def _preflight_image_job(cfg, *, engine_override: str = "auto") -> None:"""Raise RuntimeError if the host can't safely run this image cfg.@@ -19668,12 +19730,30 @@ def _preflight_image_job(cfg, *, engine_override: str = "auto") -> None:total_gb = float(mem.get("total_gb") or 0.0)used_gb = float(mem.get("used_gb") or 0.0)free_gb = max(0.0, total_gb - used_gb)+ # Two different stories, both REFUSALS (deliberate guards, not faults —+ # review 2026-09-02: 15 of the 16 "unclassified" failures on 4.9.0 were+ # this branch, on 8 GB and 24 GB Macs that had been offered an engine+ # holding ~24 GB of weights, then blocked here with a message pointing+ # at a developer env var). A Mac that can never fit the engine is told+ # which Mac size can and what fits here; a Mac that could fit it but is+ # busy is told to close apps. Same slug, one-click breakdown either way.+ fits_mac, mac_gb = _image_engine_fit(need_gb)+ label = _IMAGE_ENGINE_LABELS.get(engine_override, engine_override)+ if not fits_mac:+ raise RenderRefused(+ "image_ram",+ f"Image pre-flight: {label} holds ~{need_gb:.0f} GB of weights in "+ f"memory and needs a {mac_gb} GB Mac; this Mac has "+ f"{total_gb:.0f} GB. Pick Auto (the 4B FLUX engine, fits here) "+ f"or a lighter preset."+ )if free_gb < need_gb:- raise RuntimeError(- f"pre-flight: this engine ({engine_override}) needs ~{need_gb:.0f} GB free RAM "- f"but only {free_gb:.1f} GB is available "- f"(total {total_gb:.0f} GB, used {used_gb:.1f} GB). "- f"Close other apps or set PHOSPHENE_SKIP_PREFLIGHT=1 to override."+ raise RenderRefused(+ "image_ram",+ f"Image pre-flight: {label} needs ~{need_gb:.0f} GB free, but "+ f"only {free_gb:.1f} GB is free right now (this Mac has "+ f"{total_gb:.0f} GB, {used_gb:.1f} GB in use). Close other apps "+ f"— browsers, another render — and try again.")cache_root = _hf_cache_root()@@ -21788,14 +21868,17 @@ def run_job_inner(job: dict) -> None:# the helper to the Q8 dir.ext_missing = hq_surface_missing()if ext_missing:- raise RuntimeError(- f"Extend requires the full Q8 model at {pack_path('q8')}. "+ raise RenderRefused(+ "pack_missing",+ f"Extend needs the LTX-2.5 High add-on (the Q8 model), which "+ f"isn't downloaded on this Mac yet. "f"Missing {len(ext_missing)} file(s): {', '.join(ext_missing[:3])}"f"{' …' if len(ext_missing) > 3 else ''}. "f"Install it from Settings \u2192 Models "f"({(pack_repo('q8') or {}).get('name', 'the Q8 pack')}, "f"~{(pack_repo('q8') or {}).get('size_gb', '?')} GB)."- )+ f" Open Settings → Models and download it, then render again."+ )src = p["video_path"]if not src or not Path(src).exists():raise RuntimeError(f"source video for extend not found: {src}")@@ -22425,13 +22508,14 @@ def run_job_inner(job: dict) -> None:# `load_safetensors` error referencing a specific missing file.kf_missing = hq_surface_missing()if kf_missing:- raise RuntimeError(- f"Keyframe mode requires the full Q8 model at {pack_path('q8')}. "+ raise RenderRefused(+ "pack_missing",+ f"Keyframe mode needs the LTX-2.5 High add-on (the Q8 model), which "+ f"isn't downloaded on this Mac yet. "f"Missing {len(kf_missing)} file(s): {', '.join(kf_missing[:3])}"f"{' …' if len(kf_missing) > 3 else ''}. "- f"Run: hf download {(pack_repo('q8') or {}).get('repo_id', MODEL_ID_HQ)} "- f"--local-dir {pack_path('q8')}"- )+ f" Open Settings → Models and download it, then render again."+ )# Multi-keyframe path: agent submits a JSON-encoded list of# {image_path, frame_index} pairs. Layer 1 of the SDK shipped the# helper-side acceptance; this branch is Layer 2 (panel form).@@ -22970,13 +23054,14 @@ def run_job_inner(job: dict) -> None:# Same completeness check as keyframe — see comment there.hq_missing = hq_surface_missing()if hq_missing:- raise RuntimeError(- f"High quality requires the full Q8 model at {pack_path('q8')}. "+ raise RenderRefused(+ "pack_missing",+ f"High quality needs the LTX-2.5 High add-on (the Q8 model), which "+ f"isn't downloaded on this Mac yet. "f"Missing {len(hq_missing)} file(s): {', '.join(hq_missing[:3])}"f"{' …' if len(hq_missing) > 3 else ''}. "- f"Run: hf download {(pack_repo('q8') or {}).get('repo_id', MODEL_ID_HQ)} "- f"--local-dir {pack_path('q8')}"- )+ f" Open Settings → Models and download it, then render again."+ )# HQ is the only inference path that runs the dev transformer with# CFG and the full sigma schedule — which is exactly what character# LoRAs are trained against. Distilled inference (Quick/Standard)@@ -24848,6 +24933,16 @@ class Handler(BaseHTTPRequestHandler):(concept + str(time.time())).encode()).hexdigest()[:6])board = storyboard.new_storyboard(bid, "Planning…")+ # new_storyboard() hands back storyboard.DEFAULT_POLICY —+ # 1024x576 delivery, no tier clamp, and not the user's saved+ # Quality either. That made the `setdefault("policy", ...)`+ # further down a NO-OP for every new film ever planned: the+ # clamp never ran. Invisible on a 1024+ Mac; on a 24 GB Mac+ # (768px cap) every fresh plan came back with an illegal+ # delivery pass, an over_cap error, and Render disabled.+ board["policy"] = _sb_policy_for(+ get_settings().get("storyboard_draft_quality", "quick"),+ get_settings().get("storyboard_final_quality", "standard"))# Offer the number or refuse it — never quietly render a# different film. A brief that asked for 4 shots used to come# back as a 12-shot board with no message anywhere. The four@@ -27047,6 +27142,22 @@ def page() -> str:# unchanged from when the string was embedded here.HTML = (ROOT / "webapp" / "index.html").read_text(encoding="utf-8")+# The JS/CSS the page loads follow the same rule in production: a git pull+# under a running panel must not hand new modules to old markup (review+# 2026-09-02 — the in-app Update pulls code while the panel runs, and the+# page is read once). Snapshot the tree at boot; the /webapp/ route serves+# from here when populated. Dev keeps reading from disk so a hard-refresh+# still picks up edits without a restart (docs/ARCHITECTURE.md).+_WEBAPP_SNAPSHOT: dict[str, bytes] = {}+if PROFILE != "dev":+ try:+ _wa = ROOT / "webapp"+ for _f in _wa.rglob("*"):+ if _f.is_file():+ _WEBAPP_SNAPSHOT[_f.relative_to(_wa).as_posix()] = _f.read_bytes()+ except Exception: # noqa: BLE001+ _WEBAPP_SNAPSHOT = {}+def _diagnose_port_busy(port: int) -> str:"""Best-effort diagnosis of WHO holds the port, for the pre-flight errordiff --git a/panel/routes_characters.py b/panel/routes_characters.pyindex 7435e22..05a836d 100644--- a/panel/routes_characters.py+++ b/panel/routes_characters.py@@ -573,6 +573,12 @@ def post_character_delete(h, path, qs, ctype) -> None:@post_when(lambda p: p.startswith("/characters/") and p.endswith("/rename"))def post_character_rename(h, path, qs, ctype) -> None:+ # The one moved POST handler that lost its body-read preamble in the+ # route split — every rename raised NameError (review 2026-09-02).+ _rb = h._read_form_body()+ if _rb is None:+ return+ body, form = _rbcid_raw = path[len("/characters/"):-len("/rename")]try:cid = P._character_safe_id(cid_raw)diff --git a/panel/routes_files.py b/panel/routes_files.pyindex 353ed58..fa96582 100644--- a/panel/routes_files.py+++ b/panel/routes_files.py@@ -731,7 +731,11 @@ def get_webapp_file(h, parsed) -> None:".html": "text/html; charset=utf-8",".svg": "image/svg+xml",}.get(ext, "application/octet-stream")- body = path.read_bytes()+ # Production serves the bytes this process booted with (snapshot taken+ # beside HTML at import) so a pull under a running panel can't pair new+ # modules with old markup; dev reads from disk for hard-refresh edits.+ _snap = getattr(P, "_WEBAPP_SNAPSHOT", None) or {}+ body = _snap.get(rel) if rel in _snap else path.read_bytes()if ext == ".css":# The one dynamic seam in the stylesheet: per-engine accent +# fold rules are emitted from the ENGINES registry, exactly asdiff --git a/panel/routes_image.py b/panel/routes_image.pyindex 9d90c18..b628002 100644--- a/panel/routes_image.py+++ b/panel/routes_image.py@@ -357,10 +357,22 @@ def get_image_engine_status(h, parsed) -> None:]sec = sum(per_image) / len(per_image)samples = f"observed-{len(observed)}"+ # Memory verdict (review 2026-09-02): the Studio offered 8 GB+ # and 24 GB Macs engines that hold ~24 GB of weights, and the+ # render's pre-flight refused every time. Say it up front.+ try:+ _need = P._preflight_estimate_ram_gb(+ P._build_image_engine_config(engine))+ except Exception: # noqa: BLE001+ _need = 8.0+ _fits, _mac_gb = P._image_engine_fit(_need)out.append({"engine": engine,"repo_id": repo or "","cached": cached,+ "ram_need_gb": round(float(_need), 1),+ "mac_gb_needed": int(_mac_gb),+ "fits_mac": bool(_fits),"partial": bool(partial),"partial_gb": (partial["on_disk_gb"] if partial else 0),"family_installed": family_installed,@@ -375,7 +387,8 @@ def get_image_engine_status(h, parsed) -> None:"license_url": ("https://huggingface.co/" + repo)if (repo and engine == "ideogram4_inline") else None,})- h._json({"engines": out})+ h._json({"engines": out,+ "host_ram_gb": int(round(float(P.SYSTEM_RAM_GB or 0)))})except Exception as exc: # noqa: BLE001h._json({"error": f"engine_status failed: {exc}"}, 500)diff --git a/panel/routes_meta.py b/panel/routes_meta.pyindex e6327ef..57599c0 100644--- a/panel/routes_meta.py+++ b/panel/routes_meta.py@@ -348,9 +348,15 @@ def post_version_pull(h, path, qs, ctype) -> None:"install.js", "update.js", "pinokio.js", "download_q8.js","patch_ltx_codec.py", "required_files.json","requirements.txt", "pyproject.toml", "setup.py",+ # Since v4.0 every pin, patch and weight step lives in+ # post_update.sh and scripts/pinokio/ — a pull that touches+ # them without the full Update ships new code onto old+ # dependencies (review 2026-09-02).+ "scripts/post_update.sh", "scripts/check_post_update.js",)for line in diff_out.splitlines():- if line in deps_signals or line.startswith("ltx-2-mlx/"):+ if (line in deps_signals or line.startswith("ltx-2-mlx/")+ or line.startswith("scripts/pinokio/")):deps_touched = Truebreakdiff --git a/scripts/lint_webapp.mjs b/scripts/lint_webapp.mjsindex 3290ee3..1b22bce 100644--- a/scripts/lint_webapp.mjs+++ b/scripts/lint_webapp.mjs@@ -95,7 +95,6 @@ for (const f of moduleFiles) {}// Optional hooks the code probes with `typeof x === 'function'` before// calling — declared, guarded, legitimately absent.-shared.add("_syncLorasJsonField");const BROWSER = Object.fromEntries(("window document navigator location localStorage sessionStorage fetch " +@@ -179,14 +178,34 @@ if (inline.trim()) {const handlerRe = new RegExp(String.raw`(?:\bon[a-z]+\s*=\s*\\?["']|href\s*=\s*\\?["']javascript:|setAttribute\(\s*['"]on[a-z]+['"]\s*,\s*['"\x60])([^"'\x60]{0,400})`, "g");const callRe = new RegExp(String.raw`\b(${IDENT})\s*\(`, "g");+ const KNOWN_CALLABLE = new Set((+ "if for while switch catch return function async await typeof void " ++ "Object Array String Number Boolean JSON Math Date RegExp Error Promise " ++ "Map Set Symbol BigInt Function parseInt parseFloat isNaN isFinite " ++ "encodeURIComponent decodeURIComponent encodeURI decodeURI escape unescape " ++ "Intl Reflect Proxy WeakMap WeakSet").split(" "));const sources = [[INDEX, html], ...modSrc.entries()];const seen = new Set();for (const [file, src] of sources) {for (const m of src.matchAll(handlerRe)) {for (const c of m[1].matchAll(callRe)) {const name = c[1];+ if (publishedAll.has(name) || seen.has(name)) continue;+ // `obj.method(` and `new Ctor(` are not global function calls.+ const before = m[1].slice(0, c.index).trimEnd();+ if (/[.\w$]$/.test(before) && !/\bnew$/.test(before)) continue;const owner = topLevelAnywhere.get(name);- if (!owner || publishedAll.has(name) || seen.has(name)) continue;+ if (!owner) {+ // Review 2026-09-02: a handler calling a function NOBODY declares+ // (deleted, renamed, or never written) is the same dead-button+ // class, and this pass used to skip it. Builtins and keywords+ // are the only legitimate unowned callees in a handler string.+ if (KNOWN_CALLABLE.has(name) || name in BROWSER) continue;+ seen.add(name);+ errors++;+ console.error(`inline handler calls '${name}' but nothing declares it — a deleted or renamed function; the control would do nothing. Referenced from ${path.relative(ROOT, file)}`);+ continue;+ }seen.add(name);errors++;console.error(`inline handler calls '${name}' (declared in ${path.relative(ROOT, owner)}) but it is not published — add it to that module's Object.assign(globalThis, {...}) block. Referenced from ${path.relative(ROOT, file)}`);diff --git a/scripts/pinokio/h3_checkout.sh b/scripts/pinokio/h3_checkout.shnew file mode 100755index 0000000..e4b128c--- /dev/null+++ b/scripts/pinokio/h3_checkout.sh@@ -0,0 +1,47 @@+#!/bin/bash+# Move the vendored minimax-h3-mlx checkout to the branch the app expects,+# and re-sync its venv deps. THE ONE PLACE THE H3 BRANCH PIN LIVES.+#+# Issue #74 (diagnosed by @blackest): installs cloned before the v2 engine sat+# on `codex/h3-engine`, and Update's Q8 build step ran h3_build_q8.sh against+# that tree — where scripts/quantize_stream.py has never existed — so the+# half-memory engine never got built on any pre-existing install. The H3+# installer already moved the branch on a re-install; Update did not. Both+# call this now.+#+# Usage: bash scripts/pinokio/h3_checkout.sh <h3-checkout-dir>+# Exit 0 = the tree is on the pin and its deps are synced. Non-zero = left as+# it was (nothing destructive happens before the fetch succeeds).+set -u+H3_BRANCH="codex/h3-engine-v2"+H3_URL="https://github.com/mrbizarro/minimax-h3-mlx.git"+H3_DIR="${1:-}"+if [ -z "$H3_DIR" ] || [ ! -d "$H3_DIR/.git" ]; then+ echo "h3_checkout.sh: no H3 checkout at '${H3_DIR:-<none>}' - nothing to move."+ exit 1+fi+cd "$H3_DIR" || exit 1+git remote get-url origin >/dev/null 2>&1 || git remote add origin "$H3_URL"+if ! git fetch --force origin "$H3_BRANCH"; then+ echo "WARN: could not fetch $H3_BRANCH from $H3_URL - H3 checkout left as is."+ exit 1+fi+if [ -d minimax_h3_mlx ]; then+ git reset --hard HEAD >/dev/null+else+ echo 'WARN: not the H3 tree - skipping reset'+fi+if ! git checkout --force -B "$H3_BRANCH" FETCH_HEAD; then+ echo "WARN: could not check out $H3_BRANCH - H3 checkout left as is."+ exit 1+fi+echo "H3 engine at $H3_BRANCH ($(git rev-parse --short HEAD))"+if [ ! -f scripts/quantize_stream.py ]; then+ echo "WARN: $H3_BRANCH has no scripts/quantize_stream.py - the Q8 build cannot run from this tree."+ exit 1+fi+# The branch move can change requirements; uv is a no-op when nothing did.+if [ -x .venv/bin/python ]; then+ uv pip install --python .venv/bin/python -r requirements.txt \+ || echo 'WARN: H3 requirements re-sync failed - re-run the H3 engine Install.'+fidiff --git a/scripts/post_update.sh b/scripts/post_update.shindex d752b7c..8971662 100644--- a/scripts/post_update.sh+++ b/scripts/post_update.sh@@ -291,6 +291,12 @@ H3_CHECKOUT="${LTX_H3_ROOT:-$ROOT/minimax-h3-mlx}"H3_DIT_REL='deepbeep-pruned-bf16/MiniMax-H3-FL2VA-pruned_bf16.safetensors'if { [ -f "$H3_MODELS_ROOT/models/$H3_DIT_REL" ] || [ -f "$H3_MODELS_ROOT/$H3_DIT_REL" ]; } \&& [ -d "$H3_CHECKOUT" ]; then+ # #74: the build script needs the v2 engine tree. Installs cloned before it+ # sat on the old branch and this step built against that forever. Move the+ # checkout to the pin first (the same move the H3 installer makes).+ echo 'Ensuring the H3 engine checkout is on the pinned branch…'+ bash "$ROOT/scripts/pinokio/h3_checkout.sh" "$H3_CHECKOUT" \+ || echo 'WARN: could not move the H3 checkout to its pinned branch — the Q8 build below may not run; re-run the H3 engine Install to retry.'echo 'Ensuring the H3 compact (Q8) engine is built (halves H3 render memory)…'( cd "$H3_CHECKOUT" && bash "$ROOT/scripts/pinokio/h3_build_q8.sh" "$ROOT" ) \|| echo 'WARN: H3 Q8 build failed — H3 keeps the full bf16 engine for now; re-run the H3 engine Install to retry.'@@ -333,11 +339,12 @@ echo 'Trim done.'# and import again, because a torn site-packages is exactly what this repairs# and the user should not have to run anything by hand. Only a second failure# is fatal, and then `require` says so in the app's own words.-# The probe deliberately imports ONE package and the gate imports all three, so-# `check_post_update.js` can tell them apart: the gate is the line it must find-# wrapped in `require`, and a probe that matched the same text would shadow it.+# The probe imports the same three packages as the gate but in semicolon form,+# so `check_post_update.js` can still tell them apart: the gate is the+# comma-form line it must find wrapped in `require`. (A one-package probe let+# a torn ltx_core_mlx skip the repair and fail the gate — review 2026-09-02.)echo 'Verifying the render engine actually imports…'-if ! "$PY" -c "import ltx_pipelines_mlx" 2>/dev/null; then+if ! "$PY" -c "import ltx_core_mlx; import ltx_pipelines_mlx; import mlx" 2>/dev/null; thenecho 'Render engine did not import — repairing the vendored packages once…'( cd "$ROOT/ltx-2-mlx" && uv pip install --python env/bin/python --reinstall \--no-deps --build-constraints ../pip-build-constraints.txt \diff --git a/scripts/test_analytics_dryrun.py b/scripts/test_analytics_dryrun.pyindex f591b43..db00119 100644--- a/scripts/test_analytics_dryrun.py+++ b/scripts/test_analytics_dryrun.py@@ -681,7 +681,12 @@ class TestEventSchemas(AnalyticsTestCase):is drawn from a set defined in the source, never from user text."""self.assertEqual(sorted(P._ANALYTICS_REFUSAL_SLUGS),["h3_lora_slots", "h3_mode", "h3_ram",- "hardware_tier", "ingredients_generation",+ "hardware_tier",+ # v4.9.3: the Image Studio memory guard.+ "image_ram",+ "ingredients_generation",+ # v4.9.3: High/Keyframes/Extend without the Q8 pack.+ "pack_missing",# v4.9: the stale-vendored-engine gate (a 2.5 render# on an engine predating the Gemma 4 tower is# refused with the two-Update-clicks remedy).diff --git a/storyboard.py b/storyboard.pyindex b38c616..fdad116 100644--- a/storyboard.py+++ b/storyboard.py@@ -615,10 +615,17 @@ def validate_storyboard_detail(p = policy.get(key) or {}w, h = p.get("width"), p.get("height")if isinstance(w, int) and isinstance(h, int) and max(w, h) > max_dim:+ # `fit_*` is the offer the UI's one-click fix writes. It ships in+ # the error because the browser must never compute a canvas of+ # its own (docs/ARCHITECTURE.md) — and because the button used to+ # carry a hardcoded 1024x576, which on a 768px Mac was itself+ # illegal.+ fw, fh = fit_canvas(w, h, max_dim)add("over_cap",f"policy.{key}: {w}x{h} exceeds this machine's {max_dim}px cap — "f"lower it or the render will clamp",- field=f"policy.{key}", pass_name=key, width=w, height=h, max_dim=max_dim)+ field=f"policy.{key}", pass_name=key, width=w, height=h, max_dim=max_dim,+ fit_width=fw, fit_height=fh)return errs@@ -1457,6 +1464,23 @@ def default_policy() -> dict:return {k: dict(v) for k, v in DEFAULT_POLICY.items()}+def fit_canvas(width: int, height: int, cap: int) -> tuple[int, int]:+ """The largest 8-aligned canvas with this aspect that a `cap`px Mac may render.++ THE ONE CLAMP FORMULA. The panel's policy builder, the per-quality canvas+ table the Quality chips are labelled from, and the over-cap error's own+ "use this instead" offer must all land on the SAME numbers — otherwise the+ button offers a size the validator then rejects, which is exactly the loop+ a 24 GB Mac was stuck in (offered 1024x576 against a 768px cap, and the+ guard around the write meant clicking it did nothing at all).+ """+ w, h = int(width), int(height)+ if cap <= 0 or max(w, h) <= cap:+ return w, h+ scale = cap / float(max(w, h))+ return max(64, int(w * scale) // 8 * 8), max(64, int(h * scale) // 8 * 8)++def new_storyboard(board_id: str, title: str, *, shots: list[dict] | None = None,cast: list[dict] | None = None, policy: dict | None = None,locations: list[dict] | None = None) -> dict:diff --git a/test_panel_assets.py b/test_panel_assets.pyindex a67a95d..b373bb4 100644--- a/test_panel_assets.py+++ b/test_panel_assets.py@@ -186,3 +186,22 @@ class TheStructureLawHolds(unittest.TestCase):if __name__ == "__main__":unittest.main()+++class ModulesTheTemplateLoads(unittest.TestCase):+ """v4.9.0's headline bug was a split that left code unreachable. The+ cheapest guard of that shape: every module file under webapp/js is a+ <script type="module"> tag in the template, and every such tag names a+ file that exists — in the same order main.js must come last."""++ def test_every_module_is_loaded_and_main_is_last(self) -> None:+ import re+ from pathlib import Path+ root = Path(__file__).resolve().parent+ html = (root / "webapp" / "index.html").read_text(encoding="utf-8")+ tags = re.findall(r'<script type="module" src="/webapp/js/([\w.-]+\.js)"', html)+ on_disk = sorted(p.name for p in (root / "webapp" / "js").glob("*.js"))+ self.assertEqual(sorted(tags), on_disk,+ "a module on disk is not loaded by the page (or a tag names a missing file)")+ self.assertEqual(len(tags), len(set(tags)), "a module is loaded twice")+ self.assertEqual(tags[-1], "main.js", "main.js must be the last module tag")diff --git a/test_refusal_gates.py b/test_refusal_gates.pyindex 1ebeef2..1a426a1 100644--- a/test_refusal_gates.py+++ b/test_refusal_gates.py@@ -30,6 +30,7 @@ import reimport sysimport tempfileimport unittest+import unittest.mockfrom pathlib import PathROOT = Path(__file__).resolve().parent@@ -430,3 +431,49 @@ class TestH3RamRefusalStatesTheRealFloor(unittest.TestCase):if __name__ == "__main__":unittest.main(verbosity=2)+++class ImageStudioMemoryGuardIsARefusal(unittest.TestCase):+ """Review 2026-09-02: 15 of the 16 unclassified failures on 4.9.0 were+ the Image Studio pre-flight refusing 8 GB / 24 GB Macs an engine that+ holds ~24 GB of weights, with a message pointing at a developer env+ var. The guard is now a refusal (closed slug `image_ram`) that names+ the Mac size that runs the engine, or says to close apps when the Mac+ could fit it but is busy."""++ def _cfg(self):+ return P._build_image_engine_config("qwen_edit_lightning_inline")++ def test_engine_that_can_never_fit_names_the_mac_size(self):+ with unittest.mock.patch.object(P, "SYSTEM_RAM_GB", 24.0), \+ unittest.mock.patch.object(P, "get_memory",+ lambda: {"total_gb": 24.0, "used_gb": 6.0}):+ with self.assertRaises(P.RenderRefused) as cm:+ P._preflight_image_job(self._cfg(), engine_override="qwen_edit_lightning_inline")+ self.assertEqual(cm.exception.reason, "image_ram")+ self.assertIn("needs a 32 GB Mac", str(cm.exception))+ self.assertIn("Auto", str(cm.exception))+ self.assertNotIn("PHOSPHENE_SKIP_PREFLIGHT", str(cm.exception))+ self.assertEqual(P._analytics_refusal_reason(str(cm.exception)), "image_ram")++ def test_busy_mac_that_could_fit_is_told_to_close_apps(self):+ with unittest.mock.patch.object(P, "SYSTEM_RAM_GB", 64.0), \+ unittest.mock.patch.object(P, "get_memory",+ lambda: {"total_gb": 64.0, "used_gb": 54.0}):+ with self.assertRaises(P.RenderRefused) as cm:+ P._preflight_image_job(self._cfg(), engine_override="qwen_edit_lightning_inline")+ self.assertEqual(cm.exception.reason, "image_ram")+ self.assertIn("free right now", str(cm.exception))++ def test_fit_table_rounds_to_a_mac_size_that_exists(self):+ with unittest.mock.patch.object(P, "SYSTEM_RAM_GB", 64.0):+ self.assertEqual(P._image_engine_fit(24.0), (True, 32))+ self.assertEqual(P._image_engine_fit(32.0), (True, 36))+ with unittest.mock.patch.object(P, "SYSTEM_RAM_GB", 16.0):+ self.assertEqual(P._image_engine_fit(24.0)[0], False)+ self.assertEqual(P._image_engine_fit(8.0), (True, 16))++ def test_pack_missing_is_a_refusal_slug(self):+ msg = ("High quality needs the LTX-2.5 High add-on (the Q8 model), which "+ "isn't downloaded on this Mac yet. Missing 12 file(s): x.")+ self.assertEqual(P._analytics_refusal_reason(msg), "pack_missing")diff --git a/test_storyboard_capfit.py b/test_storyboard_capfit.pynew file mode 100644index 0000000..452bf8b--- /dev/null+++ b/test_storyboard_capfit.py@@ -0,0 +1,265 @@+#!/usr/bin/env python3+"""The Storyboard on a Mac that CANNOT deliver 1024x576.++GitHub #71, Mac mini M4 Pro 24 GB (768px cap). Three defects, one film:++ * every freshly planned board carried an over-cap delivery pass, because+ `new_storyboard()` hands back the module DEFAULT_POLICY and the panel's+ `setdefault("policy", _sb_policy_for(...))` could therefore never fire —+ the tier clamp had never run for a new film on any Mac;+ * the one-click fix under the error offered a hardcoded "Use 1024x576",+ itself illegal at a 768px cap, and its write was guarded on `> 1024` so+ clicking it did NOTHING. Render stayed disabled with no way out;+ * the Quality control's chips printed sizes from a literal table in the+ browser, so they advertised canvases the machine would never deliver and+ the click wrote one of them straight into the board.++Everything here is fast: pure functions, one node run for the browser half,+and text pins on the two structural rules (one canvas table, one clamp).+"""+from __future__ import annotations++import json+import re+import shutil+import subprocess+import sys+import tempfile+import unittest+from pathlib import Path++ROOT = Path(__file__).resolve().parent+sys.path.insert(0, str(ROOT))+sys.path.insert(0, str(ROOT / "scripts"))++import storyboard # noqa: E402+from extract_panel_js import extract_function # noqa: E402++NODE = shutil.which("node")+JS = ROOT / "webapp" / "js" / "storyboard.js"+CSS = ROOT / "webapp" / "style" / "panel.css"+INDEX = ROOT / "webapp" / "index.html"++# The cap a 24 GB Mac reports (CAPABILITIES["base"]["t2v_max_dim"]).+CAP_24GB = 768+++class FitCanvas(unittest.TestCase):+ """THE ONE CLAMP FORMULA — everything else must agree with it."""++ def test_leaves_a_legal_canvas_alone(self):+ self.assertEqual(storyboard.fit_canvas(640, 448, CAP_24GB), (640, 448))+ self.assertEqual(storyboard.fit_canvas(768, 432, CAP_24GB), (768, 432))++ def test_no_cap_is_no_clamp(self):+ self.assertEqual(storyboard.fit_canvas(1280, 704, 0), (1280, 704))++ def test_is_IDEMPOTENT(self):+ """The whole bug in one property: the size the UI offers must be a size+ the validator then accepts. Offer 1024x576 against a 768 cap and the+ error the button was meant to clear simply comes back."""+ for w, h in ((1024, 576), (1280, 704), (640, 448)):+ for cap in (512, 768, 1024, 1536):+ once = storyboard.fit_canvas(w, h, cap)+ self.assertEqual(storyboard.fit_canvas(*once, cap), once,+ f"{w}x{h} @ {cap} does not survive its own clamp")+ self.assertLessEqual(max(once), cap)+ self.assertEqual(once[0] % 8, 0)+ self.assertEqual(once[1] % 8, 0)+++class OverCapError(unittest.TestCase):+ def _board(self, w, h):+ b = storyboard.new_storyboard("sb_cap", "cap")+ b["policy"] = {"draft": {"quality": "quick", "width": 640, "height": 448,+ "frames": 49},+ "final": {"quality": "standard", "width": w, "height": h,+ "frames": 121}}+ b["shots"] = [{"n": 1, "title": "one", "mode": "text", "engine": "ltx",+ "prompt": "a street at night", "duration_s": 5.0, "refs": []}]+ return b++ def test_carries_an_offer_the_validator_accepts(self):+ errs = storyboard.validate_storyboard_detail(+ self._board(1024, 576), max_dim=CAP_24GB)+ cap = [e for e in errs if e["code"] == "over_cap"]+ self.assertEqual(len(cap), 1, errs)+ d = cap[0]["data"]+ self.assertEqual((d["fit_width"], d["fit_height"]), (768, 432))+ # Take the offer; the error must be GONE, not restated.+ fixed = self._board(d["fit_width"], d["fit_height"])+ self.assertEqual(+ [e["code"] for e in storyboard.validate_storyboard_detail(+ fixed, max_dim=CAP_24GB) if e["code"] == "over_cap"], [])+++class PanelPolicy(unittest.TestCase):+ """The server half: a new film must be born legal."""++ def setUp(self):+ import mlx_ltx_panel as p # noqa: PLC0415+ self.p = p++ def test_policy_for_is_clamped_at_every_quality(self):+ p = self.p+ real = p._sb_max_dim+ p._sb_max_dim = lambda: CAP_24GB # noqa: SLF001+ try:+ for fq in p.STORYBOARD_FINAL_QUALITIES:+ for dq in p.STORYBOARD_DRAFT_QUALITIES:+ pol = p._sb_policy_for(dq, fq) # noqa: SLF001+ for key, cell in pol.items():+ self.assertLessEqual(+ max(cell["width"], cell["height"]), CAP_24GB,+ f"{dq}/{fq} {key} is over the cap: {cell}")+ # And the BOOT table the chips are labelled from says the same.+ cv = p._sb_canvases() # noqa: SLF001+ for q, cell in cv.items():+ self.assertLessEqual(max(cell["width"], cell["height"]), CAP_24GB, q)+ self.assertEqual(cv["standard"], {"width": 768, "height": 432})+ finally:+ p._sb_max_dim = real # noqa: SLF001++ def test_a_planned_board_validates_clean(self):+ """The regression itself, end to end over the two pure halves."""+ p = self.p+ real = p._sb_max_dim+ p._sb_max_dim = lambda: CAP_24GB # noqa: SLF001+ try:+ board = storyboard.new_storyboard("sb_new", "new")+ board["policy"] = p._sb_policy_for("quick", "standard") # noqa: SLF001+ board["shots"] = [{"n": 1, "title": "one", "mode": "text",+ "engine": "ltx", "prompt": "a street at night",+ "duration_s": 5.0, "refs": []}]+ errs = storyboard.validate_storyboard_detail(board, max_dim=CAP_24GB)+ self.assertEqual([e["code"] for e in errs], [], errs)+ finally:+ p._sb_max_dim = real # noqa: SLF001++ def test_the_plan_route_ASSIGNS_the_policy_it_computes(self):+ """`setdefault` on a board that always already has one is a no-op, and+ that is precisely how the clamp came to never run. Pinned as text+ because the handler is a 200-line arm of do_POST."""+ src = (ROOT / "mlx_ltx_panel.py").read_text(encoding="utf-8")+ i = src.index('board = storyboard.new_storyboard(bid, "Planning…")')+ window = src[i:i + 1400]+ self.assertIn('board["policy"] = _sb_policy_for(', window,+ "a brand-new board must be GIVEN the tier-clamped policy; "+ "the setdefault() below it can never fire")++[email protected](NODE is None, "node not installed")+class FixButton(unittest.TestCase):+ """The browser half of the one-click fix, run for real."""++ def _run(self, policy, canvases):+ fn = extract_function("sbFixError", JS.read_text(encoding="utf-8"))+ prog = f"""+ const SB_BOOT = {{ canvases: {json.dumps(canvases)} }};+ const board = {json.dumps({"policy": policy, "shots": []})};+ const SB = {{ payload: {{ board: board }} }};+ function sbShotById() {{ return null; }}+ function sbAddShot() {{}}+ function sbRenderPlan() {{}}+ function sbQueueSave() {{}}+ {fn}+ sbFixError('cap', 0, 'over_cap');+ console.log(JSON.stringify(board.policy));+ """+ with tempfile.TemporaryDirectory() as d:+ f = Path(d) / "fix.mjs"+ f.write_text(prog, encoding="utf-8")+ out = subprocess.run([NODE, str(f)], capture_output=True, text=True,+ timeout=30)+ self.assertEqual(out.returncode, 0, out.stderr)+ return json.loads(out.stdout.strip().splitlines()[-1])++ def test_lands_under_a_768_cap(self):+ cv = {"quick": {"width": 640, "height": 448},+ "balanced": {"width": 768, "height": 432},+ "standard": {"width": 768, "height": 432}}+ got = self._run(+ {"draft": {"quality": "quick", "width": 640, "height": 448},+ "final": {"quality": "standard", "width": 1024, "height": 576}}, cv)+ # THE BUG: the old button only wrote when max(w,h) > 1024, so at a 768+ # cap it left 1024x576 exactly where it was and the error never cleared.+ self.assertEqual(got["final"], {"quality": "standard",+ "width": 768, "height": 432})+ self.assertEqual(got["draft"]["width"], 640)++ def test_an_unknown_quality_still_lands_somewhere_legal(self):+ cv = {"quick": {"width": 640, "height": 448},+ "balanced": {"width": 768, "height": 432}}+ got = self._run(+ {"draft": {"quality": "quick", "width": 640, "height": 448},+ "final": {"quality": "wat", "width": 1920, "height": 1080}}, cv)+ self.assertEqual(got["final"]["width"], 768)+ self.assertEqual(got["final"]["quality"], "balanced")+++class NoSecondCanvasTable(unittest.TestCase):+ """One home for the numbers. Three copies is what shipped the bug."""++ def test_the_browser_holds_no_canvas_literal(self):+ js = JS.read_text(encoding="utf-8")+ self.assertNotIn("[1024, 576]", js)+ self.assertNotIn("balanced: [768, 432]", js)+ self.assertIn("SB_BOOT.canvases", js)++ def test_the_markup_holds_no_hand_written_sizes(self):+ html = INDEX.read_text(encoding="utf-8")+ i = html.index('id="sbDraftQuality"')+ self.assertNotIn("640×448", html[i - 400:i + 400],+ "draft chips must be rendered from the server's "+ "clamped table, not typed into the markup")+++class PlanColumnIsNotSqueezable(unittest.TestCase):+ """The layout half of #71.++ `.customize-section` carries `overflow: hidden`, which gives a flex item an+ automatic minimum size of ZERO. Inside `.sb-plan` — a bounded column flex+ container — it was therefore the ONE child the browser could crush, and it+ absorbed the whole overflow the moment the pane's content wrapped: at 1365px+ the Quality disclosure collapsed to its 2px border. Full screen looked fine,+ which is why it read as a Pinokio-only defect: the app window is narrower.+ """++ def test_children_of_sb_plan_do_not_shrink(self):+ css = CSS.read_text(encoding="utf-8")+ self.assertRegex(+ css, r"\.sb-plan\s*>\s*\*\s*\{[^}]*flex-shrink:\s*0",+ "no rule stops .sb-plan's children being crushed")++ def test_the_scroller_is_still_the_stage(self):+ """If .sb-plan ever became the scroller this rule would trap content."""+ css = CSS.read_text(encoding="utf-8")+ rules = [m.group(0) for m in re.finditer(r"(?m)^\s*#sbStage\s*\{[^}]*\}", css)]+ self.assertTrue(rules, "#sbStage rule missing")+ self.assertTrue(any("overflow-y: auto" in r for r in rules),+ f"#sbStage no longer scrolls: {rules}")+++class ShotListRepaintIsGuarded(unittest.TestCase):+ """A <select> whose native menu is open is not document.activeElement in an+ app window, so the 2 s poll rebuilt the shot list under it and the menu+ blinked shut — "you can't change the length of the video". The list is+ byte-identical on almost every tick, so it must only be painted when it+ CHANGED, and an in-progress dropdown must hold the repaint off outright."""++ def test_only_paints_when_the_html_changed(self):+ js = JS.read_text(encoding="utf-8")+ fn = extract_function("sbRenderPlan", js)+ self.assertIn("_sbShotsHtml", fn)+ self.assertRegex(fn, r"if\s*\(html\s*!==\s*_sbShotsHtml")++ def test_an_open_dropdown_holds_the_repaint_and_the_poll(self):+ js = JS.read_text(encoding="utf-8")+ self.assertIn("sbSelectOpen", extract_function("sbRenderPlan", js))+ self.assertIn("sbSelectOpen", extract_function("sbHoldingShots", js))+ # and the flag cannot be latched forever+ self.assertIn("SB_SELECT_HOLD_MS", js)+++if __name__ == "__main__":+ unittest.main()diff --git a/webapp/index.html b/webapp/index.htmlindex 504f333..8fa1bfa 100644--- a/webapp/index.html+++ b/webapp/index.html@@ -3322,11 +3322,11 @@<div class="cz-body"><div class="cz-control"><div class="cz-label">Draft pass <span class="cz-label-hint">what you watch first</span></div>- <div class="pill-group cols-3" id="sbDraftQuality">- <button type="button" class="pill-btn active" data-q="quick">Quick<span class="sub">640×448</span></button>- <button type="button" class="pill-btn" data-q="balanced">Balanced<span class="sub">768×432</span></button>- <button type="button" class="pill-btn" data-q="standard">Standard<span class="sub">1024×576</span></button>- </div>+ <!-- Rendered from the registry by sbRenderDraftQualities(), for+ the same reason the delivery row below is: hand-written sizes+ cannot know this Mac's pixel cap, so on a 24 GB Mac all three+ printed canvases it will never deliver. -->+ <div class="pill-group cols-3" id="sbDraftQuality"></div></div><div class="cz-control"><div class="cz-label">Delivery pass <span class="cz-label-hint">what you keep</span></div>diff --git a/webapp/js/characters.js b/webapp/js/characters.jsindex a3664ac..54d3fc1 100644--- a/webapp/js/characters.js+++ b/webapp/js/characters.js@@ -2471,12 +2471,12 @@ function trainUseInVideo(loraPath, trigger, targetMode) {// Use the existing picker plumbing if available. _activeLoras and// renderLorasList come from the unified LoRA picker module.if (typeof window._activeLoras !== 'undefined' && Array.isArray(window._activeLoras)) {- const already = window._activeLoras.some(x => x.path === loraPath);- if (!already) {- window._activeLoras.push({ path: loraPath, strength: 1.0, name: loraPath.split('/').pop() });- if (typeof renderLorasList === 'function') renderLorasList();- if (typeof _syncLorasJsonField === 'function') _syncLorasJsonField();- }+ // Go through the picker's own add path: it renders the chip AND+ // serialises #lorasJson, which is what the form actually posts. The+ // previous hand-rolled push rendered the chip but called a serialiser+ // that never existed (_syncLorasJsonField), so a freshly trained+ // character LOOKED applied and rendered without it (review 2026-09-02).+ addLoraToActive({ path: loraPath, strength: 1.0, name: loraPath.split('/').pop() });} else {// Fall back: copy the path so the user can paste it into the LoRA// picker manually.diff --git a/webapp/js/health.js b/webapp/js/health.jsindex a419633..b1689d2 100644--- a/webapp/js/health.js+++ b/webapp/js/health.js@@ -121,7 +121,10 @@ function renderVersionPill() {const trail = sha ? ` · ${sha}${date ? ` (${date})` : ''}` : '';const branchLabel = (s.local_branch && s.local_branch !== 'main')? s.local_branch : 'dev';- pill.textContent = `${local} · ${branchLabel}${trail}`;+ // The SHA/date tail is what pushes a 1300px (Pinokio-sized) header over+ // budget and clips the health chip; below 1400px CSS hides .vp-detail.+ const _esc = (t) => String(t).replace(/[&<>"]/g, c => ({'&':'&','<':'<','>':'>','"':'"'}[c]));+ pill.innerHTML = `${_esc(local)} · ${_esc(branchLabel)}<span class="vp-detail">${_esc(trail)}</span>`;pill.title = `Update check paused: ${s.suppress_reason}.`+ (sha ? `\nFull SHA: ${s.local_sha || sha}` : '')+ `\nClick to copy a paste-ready debug string.`;@@ -439,8 +442,13 @@ function updateHealthChip() {// Name the thing that is wrong. "Attention" tells the user to go looking.const bad = [models, helper, mem].find(el => _hcSeverity(el) === worst);face.textContent = clean(bad) || 'needs attention';+ face.dataset.short = 'attention';} else {face.textContent = clean(mem) || 'all good';+ // The narrow-header face (review 2026-09-02): below 1400px the chip+ // shows just the percentage — the full readout was being CLIPPED to+ // "15/64" at Pinokio's window width. CSS swaps to data-short.+ face.dataset.short = ((face.textContent.match(/(\d+)%/) || [])[1] || '') ? (face.textContent.match(/(\d+)%/)[1] + '%') : (face.textContent.split(/[\s·]+/)[0] || '');}document.querySelectorAll('#healthPop .hc-row').forEach(row => {const pill = row.querySelector('.pill');diff --git a/webapp/js/queue.js b/webapp/js/queue.jsindex f6ac9d9..102854c 100644--- a/webapp/js/queue.js+++ b/webapp/js/queue.js@@ -4220,6 +4220,18 @@ document.getElementById('genForm').addEventListener('submit', async e => {return;}+ // Image mode with nothing in the Image slot used to queue, fail on the+ // server, and show up as a red card — one person hit it six times in a+ // row (fleet, 2026-09-02). Say it before the click costs anything.+ const _modeNow = String(fd.get('mode') || '');+ if ((_modeNow === 'i2v' || _modeNow === 'i2v_clean_audio')+ && !String(fd.get('image') || '').trim()) {+ alert('Image mode needs a reference image — drop one into the Image slot, '+ + 'or switch to Text mode and render from the prompt alone.');+ reenable();+ return;+ }+// Safety net: if the prompt mentions a trigger word from a LoRA the user// has installed but NOT toggled active for this render, ask before// submitting. The #1 silent-failure mode is "I typed my LoRA's triggerdiff --git a/webapp/js/stage.js b/webapp/js/stage.jsindex a7a0223..92f6d28 100644--- a/webapp/js/stage.js+++ b/webapp/js/stage.js@@ -40,6 +40,9 @@ function imgStudioUpdateValidity() {invalidReason = (eng.value === 'ideogram4_inline')? 'The Ideogram 4 engine needs mflux 0.18+ (the mflux-generate-ideogram4 CLI). Update the mflux add-on, then come back and Generate.': 'The Qwen-Image-Edit engine isn\'t installed. It ships with the image-engine pack: click Update in Pinokio\'s Phosphene sidebar (NOT in this panel), then come back and Generate. If it\'s still missing after Update, the sidebar also shows "Reinstall image engines (Ideogram 4 + Qwen-Edit)" — ~30 s, ~150 MB.';+ } 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 (needsRefs && refsCount === 0) {invalidReason = 'Pick at least 1 reference image (drop a file into one of the 3 slots above) — Qwen-Image-Edit composes against an image, it cannot run text-only. Use the Lightning preset only after picking a ref.';}@@ -247,6 +250,35 @@ function imgStudioUpdateRefWarning() {// on every keystroke. Refreshed when setMode('image') runs and after a// successful Generate (in case the worker just downloaded weights).let _IMG_ENGINE_STATUS = {}; // engine_override -> {cached, download_gb, sec_per_image}+let _IMG_HOST_RAM_GB = 0;++// Memory fit (review 2026-09-02). The Studio's default engine holds ~24 GB+// of weights; a fifth of the fleet has 24 GB or less and was offered it,+// then refused at pre-flight with a developer-flag message. Engines that+// can never fit this Mac stay listed — an honest offer — but disabled and+// labelled with the Mac size that runs them; if the current pick is one+// of them, the Studio moves to Auto (the 4B engine that fits everywhere).+function imgStudioApplyMemoryFit() {+ const sel = document.getElementById('imgStudioEngine');+ if (!sel) return;+ let moved = false;+ Array.from(sel.options).forEach(opt => {+ const info = _IMG_ENGINE_STATUS[opt.value];+ if (!info || info.fits_mac !== false) return;+ if (!opt.dataset.ramTagged) {+ opt.dataset.ramTagged = '1';+ opt.textContent = opt.textContent + ' — needs a ' + info.mac_gb_needed + ' GB Mac';+ }+ opt.disabled = true;+ if (opt.selected) { sel.value = 'auto'; moved = true; }+ });+ if (moved) {+ try { phosToast && phosToast('That image engine needs more memory than this Mac has — switched to Auto, which fits here.'); } catch (_) {}+ try { imgStudioRenderEnginePill(); } catch (_) {}+ try { imgStudioUpdateEstimate(); } catch (_) {}+ try { ideoSyncVisibility && ideoSyncVisibility(); } catch (_) {}+ }+}async function imgStudioRefreshEngineStatus() {try {@@ -256,6 +288,8 @@ async function imgStudioRefreshEngineStatus() {const map = {};(j.engines || []).forEach(e => { map[e.engine] = e; });_IMG_ENGINE_STATUS = map;+ _IMG_HOST_RAM_GB = Number(j.host_ram_gb || 0);+ imgStudioApplyMemoryFit();} catch (e) {// Silent — pill falls back to "unknown" (dim ellipsis)._IMG_ENGINE_STATUS = {};@@ -327,6 +361,13 @@ function imgStudioRenderEnginePill() {// the weights-cached check below, which is about HF model downloads.// When family_installed is false, the engine literally can't run —// every other state is moot.+ if (info.fits_mac === false) {+ pill.dataset.state = 'missing-engine';+ pill.innerHTML = '<svg class="ph" aria-hidden="true" style="margin-right:4px;vertical-align:-2px"><use href="#ph-warning-bold"/></svg>needs a ' + info.mac_gb_needed + ' GB Mac';+ pill.title = 'This engine holds ~' + info.ram_need_gb + ' GB of weights in memory; this Mac has '+ + (_IMG_HOST_RAM_GB || '?') + ' GB. Auto (the 4B FLUX engine) fits here.';+ return;+ }if (info.family_installed === false) {pill.dataset.state = 'missing-engine';if (v === 'ideogram4_inline') {diff --git a/webapp/js/storyboard.js b/webapp/js/storyboard.jsindex 89422f6..55be259 100644--- a/webapp/js/storyboard.js+++ b/webapp/js/storyboard.js@@ -61,7 +61,14 @@ const SB_ERR_COPY = {refs_not_list: { html: (e) => `<b>Shot ${e.n}'s reference images are damaged.</b>`, fix: 'clearrefs', label: 'Clear them' },ref_missing: { html: (e) => `<b>Shot ${e.n} wants a reference image that isn't there any more:</b> <code>${escapeHtml(e.data.name || '')}</code>`, fix: 'clearrefs', label: 'Clear them' },remix_needs_ref: { html: (e) => `<b>Shot ${e.n} is a Remix shot with no reference image.</b>`, fix: 'text', label: 'Make it Text' },- over_cap: { html: (e) => `<b>${e.data.pass_name === 'final' ? 'Delivery' : 'Draft'} is set to ${e.data.width}×${e.data.height}; this Mac caps at ${e.data.max_dim}.</b> It'll shrink to fit unless you lower it.`, fix: 'cap', label: 'Use 1024×576' },+ // The offer is the server's own `fit_*` — the largest canvas THIS Mac may+ // render at the quality already chosen. It used to read "Use 1024×576" on+ // every machine, which on a Mac that caps at 768 offered a size the validator+ // rejects, and the button's guard (`> 1024`) meant it wrote nothing at all:+ // the error never cleared and Render stayed disabled forever. (GitHub #71)+ over_cap: { html: (e) => `<b>${e.data.pass_name === 'final' ? 'Delivery' : 'Draft'} is set to ${e.data.width}×${e.data.height}; this Mac caps at ${e.data.max_dim}.</b> It'll shrink to fit unless you lower it.`,+ fix: 'cap',+ label: (e) => `Use ${e.data.fit_width}×${e.data.fit_height}` },};function sbEl(id) { return document.getElementById(id); }@@ -141,27 +148,43 @@ function sbFilmPick(films, want) {// show a tier the registry grew. Filtered to the server's own final_qualities// list, labelled and sized from the cell, and stamped with the pack so the// q4-tier CSS gate hides every q8 tier rather than the one called "high".-function sbRenderFinalQualities() {- const box = sbEl('sbFinalQuality');+// The sub-label is the storyboard's OWN canvas for that tier, clamped to this+// Mac (SB_BOOT.canvases) — not the registry's `c.canvas`, which describes a+// single Manual render and disagrees (Standard is 1280×704 there, 1024×576+// here). The chip must say what the click writes: printing one number and+// writing another is how a 24 GB Mac ended up with an over-cap delivery pass+// it never chose. (GitHub #71)+function sbQualityChips(boxId, allowed, current) {+ const box = sbEl(boxId);if (!box) return;const cells = ((BOOT.ltx || {}).qualities) || [];- const allowed = (SB_BOOT.final_qualities || []).slice();+ const cv = SB_BOOT.canvases || {};const list = (Array.isArray(cells) ? cells : Object.values(cells))- .filter(c => c && allowed.indexOf(c.key) !== -1);+ .filter(c => c && (allowed || []).indexOf(c.key) !== -1);if (!list.length) return;- // The ACTIVE chip is applied later from the board's own policy- // (sbRenderPlan), so this only needs a sane pre-board default.- const current = (SB_BOOT.defaults || {}).final_quality || 'standard';box.innerHTML = list.map(c => {const on = c.key === current;- const sub = `${c.canvas}${c.pack === 'q8' ? ' · Q8' : ''}`;+ const size = cv[c.key] ? `${cv[c.key].width}×${cv[c.key].height}` : c.canvas;+ const sub = `${size}${c.pack === 'q8' ? ' · Q8' : ''}`;return `<button type="button" class="pill-btn${on ? ' active' : ''}" `+ `data-q="${escapeHtml(c.key)}" data-pack="${escapeHtml(c.pack || '')}">`+ `${escapeHtml(c.label)}<span class="sub">${escapeHtml(sub)}</span></button>`;}).join('');}+// The ACTIVE chip is applied later from the board's own policy (sbRenderPlan),+// so these only need a sane pre-board default.+function sbRenderFinalQualities() {+ sbQualityChips('sbFinalQuality', SB_BOOT.final_qualities,+ (SB_BOOT.defaults || {}).final_quality || 'standard');+}+function sbRenderDraftQualities() {+ sbQualityChips('sbDraftQuality', SB_BOOT.draft_qualities,+ (SB_BOOT.defaults || {}).draft_quality || 'quick');+}+function sbInit() {+ sbRenderDraftQualities();sbRenderFinalQualities();const help = sbEl('sbRamHelpNote');if (help && !help.textContent) help.textContent = SB_BOOT.ram_help || '';@@ -238,7 +261,33 @@ function sbTypingInShots() {const t = (a.tagName || '').toUpperCase();return t === 'TEXTAREA' || (t === 'INPUT' && a.type !== 'button');}+// AN OPEN <select> IS NOT RELIABLY document.activeElement. In the Pinokio app+// window the dropdown is a NATIVE menu in its own window, so the page loses+// focus the instant it opens and activeElement falls back to <body> — the guard+// below then read "nobody is holding", the 2 s poll rebuilt the shot list, and+// the menu the user was reading blinked shut. Every time. In a browser tab the+// select keeps document focus, which is exactly why the same build worked at+// 127.0.0.1:8198 and not in the app. (GitHub #71)+//+// So we track the interaction ourselves rather than asking the document who has+// focus. Set on pointerdown, cleared by the change (a choice) or by the next+// pointerdown anywhere else (a dismissal); the ceiling exists only so a lost+// clear cannot freeze the board poller for good.+let _sbSelectOpenUntil = 0;+const SB_SELECT_HOLD_MS = 20000;+function sbSelectOpen() { return Date.now() < _sbSelectOpenUntil; }+document.addEventListener('pointerdown', (ev) => {+ const t = ev.target;+ _sbSelectOpenUntil = (t && t.closest && t.closest('#sbShots select'))+ ? Date.now() + SB_SELECT_HOLD_MS : 0;+}, true);+document.addEventListener('change', (ev) => {+ const t = ev.target;+ if (t && t.closest && t.closest('#sbShots select')) _sbSelectOpenUntil = 0;+}, true);+function sbHoldingShots() {+ if (sbSelectOpen()) return true;const a = document.activeElement;if (a && a.closest && a.closest('#sbShots')) {const t = (a.tagName || '').toUpperCase();@@ -946,6 +995,10 @@ document.addEventListener('keydown', function (e) {});// ---- the plan screen -------------------------------------------------------+// The last shot-list HTML this module wrote. Nothing else writes #sbShots, so+// "same string" means "the DOM already says this" — see sbRenderPlan.+let _sbShotsHtml = '';+function sbRenderPlan(r) {const b = r.board || {};const est = r.estimate || {};@@ -1056,9 +1109,22 @@ function sbRenderPlan(r) {// --- shot cards ---// Rebuilding the list under a cursor is what makes editing impossible, so a// repaint that arrives mid-word repaints everything EXCEPT the cards. The- // next repaint after blur (<=2 s) brings the server's copy in.- if (!sbTypingInShots()) {- sbEl('sbShots').innerHTML = shots.map(s => sbShotCard(s, r, errs)).join('');+ // next repaint after blur (<=2 s) brings the server's copy in. Same for a+ // dropdown someone has open (see sbSelectOpen).+ //+ // AND: only paint when the list actually CHANGED. A board that nobody is+ // touching renders byte-identical cards on every 2 s tick, and this line was+ // still destroying and rebuilding every node in it ~30 times a minute — for+ // nothing. Anything the DOM was holding died with it, an open <select> most+ // visibly. Cheap, too: the string is built either way, the compare is the+ // only new work.+ const box = sbEl('sbShots');+ if (!sbTypingInShots() && !sbSelectOpen()) {+ const html = shots.map(s => sbShotCard(s, r, errs)).join('');+ if (html !== _sbShotsHtml || box.childElementCount !== shots.length) {+ box.innerHTML = html;+ _sbShotsHtml = html;+ }}// --- which engine, and why ---@@ -1117,8 +1183,9 @@ function sbErrRow(e) {const copy = SB_ERR_COPY[e.code];const html = !copy ? escapeHtml(e.message): (typeof copy.html === 'function' ? copy.html(e) : copy.html);+ const label = copy && (typeof copy.label === 'function' ? copy.label(e) : copy.label);const fix = copy && copy.fix- ? `<button type="button" class="sb-err-fix" onclick="sbFixError('${copy.fix}',${e.n || 0},'${escapeHtml(e.code)}')">${escapeHtml(copy.label)}</button>`+ ? `<button type="button" class="sb-err-fix" onclick="sbFixError('${copy.fix}',${e.n || 0},'${escapeHtml(e.code)}')">${escapeHtml(label)}</button>`: '';return `<div class="sb-err-row"><span class="sb-err-dot"></span><span>${html}</span>${fix}</div>`;}@@ -1592,9 +1659,18 @@ function sbFixError(fix, n, code) {} else if (fix === 'clearrefs' && s) {s.refs = [];} else if (fix === 'cap') {+ // Both passes, to whatever THIS Mac delivers at the quality each already+ // asks for — looked up in the server's clamped table, never computed here.+ const cv = SB_BOOT.canvases || {};['draft', 'final'].forEach(k => {const p = (board.policy || {})[k];- if (p && Math.max(p.width, p.height) > 1024) { p.width = 1024; p.height = 576; }+ if (!p) return;+ let fit = cv[p.quality];+ if (!fit) { // a hand-edited quality name+ p.quality = (k === 'draft' ? 'quick' : 'balanced');+ fit = cv[p.quality];+ }+ if (fit) { p.width = fit.width; p.height = fit.height; }});}sbRenderPlan(SB.payload);@@ -1974,11 +2050,15 @@ document.addEventListener('click', (ev) => {const board = ((SB.payload || {}).board);if (!board) return;const which = q.closest('#sbDraftQuality') ? 'draft' : 'final';- const table = { quick: [640, 448], balanced: [768, 432], standard: [1024, 576], high: [1024, 576] };- const dims = table[q.dataset.q] || [1024, 576];+ // Server-owned, already clamped to this Mac. The literal table that used to+ // live here wrote 1024×576 for Standard on a machine that caps at 768 — an+ // over_cap error the moment you touched the control, with Render disabled+ // and a fix button that did nothing. (GitHub #71)+ const dims = (SB_BOOT.canvases || {})[q.dataset.q];+ if (!dims) return;board.policy = board.policy || {};board.policy[which] = Object.assign({}, board.policy[which],- { quality: q.dataset.q, width: dims[0], height: dims[1] });+ { quality: q.dataset.q, width: dims.width, height: dims.height });sbSaveSetting(which === 'draft' ? 'storyboard_draft_quality' : 'storyboard_final_quality', q.dataset.q);sbRenderPlan(SB.payload);sbQueueSave(true);diff --git a/webapp/style/panel.css b/webapp/style/panel.cssindex 81ddd6d..3891eab 100644--- a/webapp/style/panel.css+++ b/webapp/style/panel.css@@ -309,6 +309,16 @@font-variant-numeric: tabular-nums;}#healthChip:hover { background: rgba(255,255,255,.07); }+ /* Narrow header (Pinokio's window is ~1300px): the chip's full readout+ ("15/64 GB · 23%") was clipped mid-number by the cluster's+ overflow:hidden — the compaction rule above still targeted the+ retired span.pill markup. Show the percentage alone; the full text+ stays in the title and the pop-over (review 2026-09-02). */+ @media (max-width: 1400px) {+ #healthChip .hc-face { font-size: 0; }+ #healthChip .hc-face::after { content: attr(data-short); font-size: 11.5px; }+ #versionPill .vp-detail { display: none; }+ }.hc-dot {width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto;background: #5fbf8f; box-shadow: 0 0 0 3px rgba(95,191,143,.15);@@ -787,6 +797,18 @@/* ---- plan review ----------------------------------------------- */.sb-plan { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }.sb-plan[hidden] { display: none !important; }+ /* NOTHING IN THIS COLUMN IS SQUEEZABLE. #sbStage is the scroller; .sb-plan+ only stacks. But a flex item defaults to flex-shrink:1, and an item whose+ overflow is HIDDEN has an automatic minimum size of zero — so the Quality+ <details> (.customize-section carries overflow:hidden) was the one child+ the browser was allowed to crush, and it absorbed the ENTIRE overflow+ whenever the plan grew taller than the pane. Shrink the window to ~1365px+ and the summary cells, the engine note and the error row each wrap one+ line more: Quality collapsed to its 2px border — invisible, unclickable,+ "slides a few pixels" when opened — while full screen looked perfect.+ Reported from a Pinokio app window, which is simply narrower than a+ browser window. (GitHub #71) */+ .sb-plan > * { flex-shrink: 0; }.sb-plan-head { position: relative; z-index: 4; }.sb-title {flex: 1 1 auto; min-width: 120px;