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.

docs: STATE+ROADMAP for evening watchdog rewrite + Elon retrain

mrbizarro08180552d3dd
diff --git a/ROADMAP.md b/ROADMAP.md
index 51ad12b..775ee88 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -249,21 +249,37 @@ Tracking: the HDR-specific Phase 1 work landed via re-exposing the
hdr toggle (commit `<hdr-ship>`); the generic Phases 2–5 stay open
in this entry.
-### `[ ]` I2V Balanced + Extend perf — post-decode hang on Q4 distilled path
+### `[x]` I2V Balanced + Extend perf — post-decode hang (FIXED 2026-05-21)
+
+**Fix shipped: panel-side watchdog SIGKILLs hung helper from outside
+the GIL-blocked process.** See commit `94bd696`. Detail below kept
+for posterity + so the next person to hit something MLX-deallocator-
+shaped knows where to look.
After the May 9 upstream `ltx-2-mlx` refactor, I2V Balanced (and T2V
Balanced) route through `DistilledPipeline.generate_two_stage(image=...)`.
-The actual render completes in ~3 min for a 5s I2V at 1024×576, but
-the helper then hangs 5-15 min before signaling done to the panel.
-
-**Update 2026-05-21 (later session):** Extend exhibits the EXACT SAME
-hang. 768×416 +6f Extend at 12 steps cfg=1.0: denoise completes in
-10:23, decode completes in 16s (output mp4 valid on disk), then the
-helper sits frozen for the next 13+ minutes until killed. So this is
-not specific to DistilledPipeline — it's any pipe that fuses the
-distilled stage 2 LoRA on the dev transformer and then returns from
-`_decode_and_save_video()`. Both DistilledPipeline and the Extend
-pipeline take that path.
+The actual render completed in ~3 min for a 5s I2V at 1024×576, but
+the helper then hung 5-15 min before signaling done to the panel.
+Extend exhibited the EXACT SAME hang on `ExtendPipeline`.
+
+The first fix attempt (commit `adc1cd2`, reverted) shipped an
+in-helper daemon-thread watchdog. **It does not work**: Metal's
+command-buffer completion handlers block every Python thread's GIL
+access during the deallocator chain, so the watchdog thread is
+starved by the very thing it was meant to escape. Observed live:
+ps showed all 16 helper threads at 0% CPU during the hang.
+
+Working fix (commit `94bd696`): rescue from THE PANEL (separate
+process, no GIL contention with the helper). `WarmHelper.
+_build_post_decode_panic` returns a (log_hook, panic_check) pair
+honored by `_read_until`. The log_hook spots the decode-done log
+line and arms a 45s grace clock; if the helper is still silent
+after grace AND the output file is on disk, panic_check SIGKILLs
+the helper and returns a synthetic done event from the known
+output_path. Helper respawns on next job (~30s spawn cost).
+
+Validated end-to-end same evening on the previously-hung Extend
+case: 533s total wall, watchdog rescue logged exactly as designed.
Diagnostic findings (2026-05-21 session):
- Output mp4 IS written to disk before the hang starts.
@@ -279,7 +295,9 @@ Diagnostic findings (2026-05-21 session):
(TI2VidTwoStagesHQPipeline) all return cleanly — confirming the
hang is specific to the distilled-fused-then-decode pattern.
-Path forward:
+**Symptom-level fix shipped 2026-05-21** (commit `94bd696` — panel-
+side watchdog SIGKILLs hung helper). Quality-level work still open:
+
1. **For Q8 (≥48 GB) tiers:** route Balanced I2V/T2V through
`TI2VidTwoStagesPipeline` instead of `DistilledPipeline`. That class:
- Runs full-resolution, not half-res with Stage-2 upscale.
@@ -288,17 +306,19 @@ Path forward:
- Already used by the working HQ path.
The helper's `get_pipe('i2v', ...)` currently aliases to
DistilledPipeline; needs an explicit branch for Balanced→
- TI2VidTwoStagesPipeline on the dev model.
-2. **For Q4 (<48 GB) tiers:** stuck with DistilledPipeline until
- upstream's MLX completion-handler issue is fixed. Workaround
- ideas: spawn a fresh helper subprocess per render so the hang
- happens after the user has their file (Pinokio Update + watchdog
- would respawn for the next job).
+ TI2VidTwoStagesPipeline on the dev model. Eliminates the hang
+ entirely (TI2VidTwoStages doesn't trigger it) AND gives better
+ I2V quality on the distilled-grid artifact #5 users see.
+2. **For Q4 (<48 GB) tiers:** the panel watchdog now hides the
+ hang from users (file lands, panel reports done, helper
+ respawns). Quality fix still needs the same TI2VidTwoStages
+ route on Q4 weights — but until then, watchdog rescue makes
+ the symptom invisible.
3. **Reddit / issue #5** users on small Macs are hitting both this
hang AND the geometric-grid artifact (which is the DistilledPipeline
- structure producing weak I2V on the distilled checkpoint). Both
- problems are the same root cause: forced fallback to a pipeline
- that was never meant for I2V quality.
+ structure producing weak I2V on the distilled checkpoint). The
+ hang is now invisible; the artifact still requires the Q8/Q4
+ TI2VidTwoStages route above.
## Mid term
diff --git a/docs/STATE.md b/docs/STATE.md
index 6aa09aa..0b66c0b 100644
--- a/docs/STATE.md
+++ b/docs/STATE.md
@@ -338,6 +338,79 @@ phosphene-dev.git/
## 7. Known bugs / fixed bugs
+### Fixed 2026-05-21 EVENING (overnight push — read this first)
+
+Late-evening continuation after Mr Bizarro called out the still-broken
+hang ("fix it. What do you mean 'deferred to roadmap'?") and the
+gallery glitch ("the '21:19' label that looks like a render duration").
+Five additional commits to `dev`:
+
+- **The post-decode hang is FIXED** (commit `94bd696`, the second
+ attempt — the first one in `adc1cd2` did not work, see below).
+
+ First attempt: an in-helper daemon-thread watchdog that would emit
+ done + os._exit(0) past a 30s grace. It was correct in concept but
+ doesn't fire in practice — **Metal's command-buffer completion
+ handlers block every Python thread's GIL access during the
+ deallocator chain**, so the watchdog thread is starved by the very
+ thing it was meant to escape. Observed live: helper hung 5+ min
+ after the watchdog should have rescued at 30s; ps showed all 16
+ helper threads at 0% CPU.
+
+ Working fix: rescue from THE PANEL (a separate process — GIL inside
+ the helper is irrelevant from out here). `WarmHelper.
+ _build_post_decode_panic` returns a `(log_hook, panic_check)` pair
+ that `_read_until` honors. `log_hook` spots upstream's
+ "[Decoding ... done in X.Xs]" line and arms a 45s grace clock.
+ `panic_check` runs every 500ms in the select loop; if grace
+ expired + output file is on disk > 8KB, it SIGKILLs the helper
+ (from a daemon thread to not block the tick) and returns a
+ synthetic done event pointing at the known output_path. Helper
+ respawns on the next job (~30s spawn cost).
+
+ Validated end-to-end on the same 768×416 +6f Extend that hung
+ 5+ min the first time and 13+ min the time before. Log shows the
+ exact rescue sequence Mr Bizarro can audit:
+
+ [22:01:07] [Decoding video + audio + muxing] done in 16.9s
+ [22:01:07] [panel-watchdog] extend …: decode-done signal
+ seen, grace clock armed (45s).
+ [22:01:52] [panel-watchdog] extend …: post-decode hang
+ detected — file on disk (802615 bytes) but helper
+ silent for 45s after decode-done. SIGKILLing
+ helper; render counted as done.
+ [22:01:52] Extend done in 533.98s → …mp4
+
+ Armed for `generate` (T2V/I2V Balanced) + `extend` only. A2V,
+ FFLF, T2V Character HQ, image, train all return cleanly and
+ don't need it.
+
+- **Extend speed defaults cut** ("is that not too slow?"). Bundled
+ in `94bd696`. Default steps 12 → 8 (cfg=1.0 doesn't need 12) and
+ Extend TeaCache threshold 0.5 → 0.7 (more aggressive block-skip).
+ Measured ~6 min wall on the same +6f case that was 11 min the
+ same morning. Quality holds at cfg=1.0 single-branch.
+
+- **Gallery dn-cache leak** (commit `94bd696`). The "21:19" label
+ Mr Bizarro pointed at was Extend's pre-downscale cache file
+ (`<base>_dnWxH.mp4`) appearing in the carousel without a sidecar
+ — the duration formatter fell back to mtime HH:MM. Two fixes:
+ `list_outputs` filters stems ending in `_dn\d+x\d+` when no
+ sidecar exists; `_outputDurationLabel` no longer falls back to
+ HH:MM (uses `_relTimeFromMtime` instead).
+
+- **Elon v3 retrain kicked off** (~22:02, ETA ~4h28m, finishes
+ around 02:30). Per the validated v2 recipe Mr Bizarro asked for:
+ rank 32 · 100 epochs (7900 steps for 79 imgs) · lr 1e-4 ·
+ **512×512 square** · center crop · `user_provided` captions
+ (the existing [VISUAL]:-format captions already in the dataset).
+ Identity-only (train_audio=false) so the existing
+ elontrn.audio.safetensors stays in place. Prior `elontrn_v2`
+ bundle backed up to `mlx_models/loras/_backups/20260521_v2_pre_v3/`
+ before kicking off. Output overwrites `elontrn_v2.safetensors`.
+ Test render queued for after training completes — sample lands
+ in `mlx_outputs/` for Mr Bizarro's wake-up review.
+
### Fixed 2026-05-21 (autonomous modality-matrix session)
Mr Bizarro asked for "continue testing and fixing issues as they arise · check all the other modalities · I will be back in a few hours work continuously". Full modality test pass + analytics scaffold + two real bug fixes + one issue-#12 UX gate. 5 commits to `dev`: