Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: fail a MiniMax H3 pin bump at Install/Repair, not on a failed keyframe render

[._.]/ Adam Eivya69740e8fa0d
diff --git a/scripts/_minimax_h3_mlx_pins.py b/scripts/_minimax_h3_mlx_pins.py
index fd18888f08..4b22eff973 100644
--- a/scripts/_minimax_h3_mlx_pins.py
+++ b/scripts/_minimax_h3_mlx_pins.py
@@ -11,16 +11,18 @@ Both readers import it, so there is one copy to re-record when the pin moves:
- the runner, whose corrections keep guarding their own seam — that is the last
line of defence for a checkout overridden after install; and
-- `minimax_h3_runtime_probe.py`, which runs at Install / Repair and calls
- `verify_pin_seams()` there, so whoever bumps `MINIMAX_H3_EXPECTED_REVISION`
- (server/services/videoGen/runtimes.js) hears about a moved pin at the action
- that moved it, rather than minutes into a failed keyframe render.
-
-A failed seam therefore leaves the whole runtime reported unready, not just the
-render mode that seam serves — deliberately. `verify_runtime_checkout()` already
-byte-verifies the checkout against the expected revision, so a stock install can
-never reach these assertions: the only way to fail one is to have moved the pin,
-and stopping there is the point.
+- `minimax_h3_runtime_probe.py --verify-seams`, which Install / Repair passes,
+ so whoever bumps `MINIMAX_H3_EXPECTED_REVISION` (server/services/videoGen/
+ runtimes.js) hears about a moved pin at the action that moved it, rather than
+ minutes into a failed keyframe render.
+
+The probe's bare readiness path (`isByovRuntimeReady`) deliberately skips
+`verify_pin_seams()`: a moved seam breaks only the keyframe and
+substituted-conditioner paths, so failing readiness over it would set
+`byovGateBlocked` and disable Generate for text-only renders that still work.
+`verify_runtime_checkout()` already byte-verifies the checkout against the
+expected revision, so a stock install can never reach these assertions: the
+only way to fail one is to have moved the pin.
MLX only, deliberately: `generate_minimax_h3_cuda.py` runs diffusers'
`MiniMaxH3ModularPipeline` with no source checkout to pin and nothing to patch,
diff --git a/scripts/minimax_h3_runtime_probe.py b/scripts/minimax_h3_runtime_probe.py
index 48dc7dc090..8986105f57 100644
--- a/scripts/minimax_h3_runtime_probe.py
+++ b/scripts/minimax_h3_runtime_probe.py
@@ -1,18 +1,33 @@
#!/usr/bin/env python3
"""Import-probe a pinned MiniMax H3 source package without trusting its root.
-Run at Install / Repair (`isByovRuntimeReady`, `scripts/setup-image-video.sh`),
-so this is also where a moved pin gets reported: `verify_pin_seams()` asserts
-every method `generate_minimax_h3.py` patches at render time is still there and
-still the shape it patches. Those corrections keep their own guards — they are
-the last line for a checkout overridden after install — but a pin bump that
-breaks one should fail the bump, not the first keyframe render after it.
+Two callers, and they want different strictness — hence `--verify-seams`:
+
+ - `isByovRuntimeReady` (server/services/videoGen/runtimes.js) runs this bare,
+ as a readiness check. It must answer ONLY "can this runtime render at all",
+ because a false negative there sets `byovGateBlocked` in the Video Gen page
+ and disables Generate outright. Same rule minimax_h3_lora_probe.py is kept
+ separate for: a runtime that is perfectly healthy for plain renders is never
+ marked unready over a capability it doesn't need.
+
+ - `scripts/setup-image-video.sh` runs it WITH the flag at Install / Repair,
+ where the extra strictness is what the user asked for and a failure is
+ actionable at the action that caused it.
+
+The flag adds `verify_pin_seams()`: every method of the pinned encoder that
+`generate_minimax_h3.py` patches, asserted up front. Those adapters are only
+correct against the exact implementation they were written for, and their
+render-time guards otherwise fire minutes later — after a cache resolve and a
+pipeline load, and only on the image-conditioned path three of them serve. A pin
+bump reaches Install / Repair anyway (a moved MINIMAX_H3_EXPECTED_REVISION fails
+`isByovRuntimeCurrent`, and a re-locked mlx-vlm needs a re-sync), so gating the
+strict check there costs no coverage a stock user would ever have seen.
"""
from __future__ import annotations
+import argparse
import importlib
-import sys
from pathlib import Path
from _runner_common import register_source_namespace
@@ -20,19 +35,24 @@ from _minimax_h3_mlx_pins import verify_pin_seams
def main() -> int:
- if len(sys.argv) != 2:
- raise SystemExit("usage: minimax_h3_runtime_probe.py <runtime-dir>")
- runtime_dir = Path(sys.argv[1]).resolve()
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("runtime_dir")
+ parser.add_argument("--verify-seams", action="store_true",
+ help="also assert the encoder seams PortOS patches (Install / Repair only)")
+ args = parser.parse_args()
+
+ runtime_dir = Path(args.runtime_dir).resolve()
package_dir = runtime_dir / "minimax_h3_mlx"
if not (package_dir / "pipeline.py").is_file():
raise RuntimeError(f"MiniMax H3 runtime source is missing under {runtime_dir}.")
register_source_namespace("minimax_h3_mlx", package_dir)
importlib.import_module("minimax_h3_mlx.pipeline")
- # Kept ahead of verify_pin_seams even though that reaches into the same
- # package: a venv that never installed mlx-vlm has to report as an
- # ImportError naming the missing distribution, not as a pin that moved.
+ # The bare readiness path keeps this one import: the vision tower's language
+ # model is loaded by every keyframe render, so a checkout that cannot resolve
+ # it is broken for real rather than merely un-patchable.
importlib.import_module("mlx_vlm.models.qwen3_vl.language")
- verify_pin_seams()
+ if args.verify_seams:
+ verify_pin_seams()
return 0
diff --git a/scripts/minimax_h3_runtime_probe.test.js b/scripts/minimax_h3_runtime_probe.test.js
index 858b0da4ff..c820fa56af 100644
--- a/scripts/minimax_h3_runtime_probe.test.js
+++ b/scripts/minimax_h3_runtime_probe.test.js
@@ -1,133 +1,258 @@
import { execFileSync } from 'node:child_process';
+import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
import { describe, expect, it } from 'vitest';
import { resolveTestPython } from '../server/lib/testHelper.js';
+import { MINIMAX_H3_EXPECTED_REVISION } from '../server/services/videoGen/runtimes.js';
-// The probe `isByovRuntimeReady()` and scripts/setup-image-video.sh run at
-// Install / Repair. It imports the pinned package out of a namespace that never
-// exposes the checkout root, and — since the seams moved here — refuses a pin
-// whose text encoder no longer fits the corrections generate_minimax_h3.py
-// installs at render time.
-const scriptsDir = dirname(fileURLToPath(import.meta.url));
-const script = join(scriptsDir, 'minimax_h3_runtime_probe.py');
+const here = dirname(fileURLToPath(import.meta.url));
+const script = join(here, 'minimax_h3_runtime_probe.py');
+const readScript = (name) => readFileSync(join(here, name), 'utf8');
-// Probe for an interpreter that actually RUNS rather than assuming a name (see
-// _minimax_h3_mlx_pins.test.js for why a bare name is not enough on Windows).
+// Same interpreter probe generate_minimax_h3.test.js explains: a name-only
+// choice passes on a Windows box whose `python` is the Store alias STUB, and
+// then every case dies with an opaque "Command failed".
const pyBin = resolveTestPython();
+const runPython = (source) => execFileSync(pyBin, ['-c', source, script], { encoding: 'utf8' });
-// Drive the probe as `__main__` through runpy rather than spawning it directly:
-// the mlx-vlm and pinned-package imports have to be satisfied by stubs, and a
-// bare interpreter has neither. Everything the probe itself does — the source
-// namespace registration, the imports, verify_pin_seams — still runs for real.
-const runProbe = (setup) => {
- const source = [
- 'import runpy, sys, tempfile, types',
- 'from pathlib import Path',
- 'probe = Path(sys.argv[1])',
- // The probe reaches its siblings through sys.path[0], which runpy does not
- // set for it.
- 'sys.path.insert(0, str(probe.parent))',
- 'runtime = Path(tempfile.mkdtemp()) / "runtime"',
- 'package = runtime / "minimax_h3_mlx"',
- 'package.mkdir(parents=True)',
- '(package / "pipeline.py").write_text("PIPELINE = True")',
- // mlx-vlm is not installed under a bare interpreter, and the two names the
- // corrections borrow are seams of their own, so stub the tree explicitly.
- 'for name in ("mlx_vlm", "mlx_vlm.models", "mlx_vlm.models.qwen3_vl", "mlx_vlm.models.qwen3_vl.language", "mlx_vlm.models.qwen3_vl.qwen3_vl", "mlx_vlm.utils"):',
- ' sys.modules[name] = types.ModuleType(name)',
- 'sys.modules["mlx_vlm.models.qwen3_vl.qwen3_vl"].Model = type("Model", (), {"merge_input_ids_with_image_features": staticmethod(lambda *args: None)})',
- 'sys.modules["mlx_vlm.models.qwen3_vl.language"].LanguageModel = type("LanguageModel", (), {"get_rope_index": staticmethod(lambda *args, **kwargs: None)})',
- 'sys.modules["mlx_vlm.utils"].sanitize_weights = lambda *args: None',
- ...setup,
- 'sys.argv = ["minimax_h3_runtime_probe.py", str(runtime)]',
- 'try:',
- ' runpy.run_path(str(probe), run_name="__main__")',
- 'except SystemExit as exc:',
- ' print(f"EXIT:{exc.code}")',
- 'except RuntimeError as exc:',
- ' print(str(exc))',
+// The probe reaches `_runner_common` and `_minimax_h3_mlx_pins` by bare name,
+// which works when Python runs it as a script because the script's own
+// directory lands on sys.path. Loading it through spec_from_file_location does
+// not do that, so the harness has to.
+const importProbe = [
+ 'import hashlib, importlib.util, inspect, sys',
+ 'from pathlib import Path',
+ 'script = Path(sys.argv[1])',
+ 'sys.path.insert(0, str(script.parent))',
+ 'spec = importlib.util.spec_from_file_location("minimax_h3_runtime_probe", script)',
+ 'probe = importlib.util.module_from_spec(spec)',
+ 'spec.loader.exec_module(probe)',
+ 'pins = sys.modules["_minimax_h3_mlx_pins"]',
+ 'common = sys.modules["_runner_common"]',
+].join('\n');
+
+// mlx-vlm is a Metal-only dependency that exists solely inside the H3 venv, and
+// the probe reads exactly three attributes off it — so the suite stands in
+// through sys.modules rather than skipping everywhere it isn't installed. The
+// stub SHADOWS a real install too: a stub parent carries no `__path__`, so its
+// submodules are unimportable unless this puts them in sys.modules. That is what
+// makes `drop` work for a whole module as well as for a leaf, and what makes
+// every case behave the same on a dev Mac and in CI.
+const stubMlxVlm = (drop = null) => [
+ 'import sys, types',
+ 'def _module(name):',
+ ' module = types.ModuleType(name)',
+ ' sys.modules[name] = module',
+ ' return module',
+ 'for _name in ["mlx_vlm", "mlx_vlm.models", "mlx_vlm.models.qwen3_vl"]:',
+ ' _module(_name)',
+ '_module("mlx_vlm.utils").sanitize_weights = lambda *a, **k: None',
+ '_module("mlx_vlm.models.qwen3_vl.qwen3_vl").Model = type(',
+ ' "Model", (), {"merge_input_ids_with_image_features": staticmethod(lambda *a, **k: None)})',
+ '_module("mlx_vlm.models.qwen3_vl.language").LanguageModel = type(',
+ ' "LanguageModel", (), {"get_rope_index": staticmethod(lambda *a, **k: None)})',
+ // Built whole, then holed: a `drop` is one `del` against the finished stub
+ // rather than a conditional threaded through every line that builds it.
+ ...(drop ? [`_drop = ${JSON.stringify(drop)}`, [
+ 'if _drop in sys.modules:',
+ ' del sys.modules[_drop]',
+ 'else:',
+ ' _owner, _, _leaf = _drop.rpartition(".")',
+ ' _parent, _, _attr = _owner.rpartition(".")',
+ ' delattr(sys.modules.get(_owner) or getattr(sys.modules[_parent], _attr), _leaf)',
+ ].join('\n')] : []),
+].join('\n');
+
+// A stand-in for the pinned checkout, on disk: the probe registers the package
+// namespace itself and the encode seam is guarded with `inspect.getsource`, so
+// neither part survives a sys.modules-only fake. Written as ordinary Python text
+// with the merge line spliced in from the SHIPPED constant, so a re-recorded pin
+// can never leave this suite asserting the old one.
+const CHECKOUT_SEAMS = {
+ _wanted: [' def _wanted(self, key):', ' return key'],
+ processor: [' @property', ' def processor(self):', ' return None'],
+ _load_weights: [' def _load_weights(self, model_dir, dtype, verbose):', ' return None'],
+ encode: [' def encode(self, prompt, images=None):', ' # __MERGE__', ' return None'],
+};
+
+const fakeCheckout = ({ drop = null, plainProcessor = false } = {}) => {
+ const body = Object.entries(CHECKOUT_SEAMS)
+ .filter(([name]) => name !== drop)
+ .flatMap(([name, lines]) => (name === 'processor' && plainProcessor ? lines.slice(1) : lines));
+ const source = ['class MiniMaxH3TextEncoder:', ...body, ''].join('\n');
+ return [
+ 'import atexit, shutil, tempfile',
+ 'temp = Path(tempfile.mkdtemp())',
+ 'atexit.register(shutil.rmtree, temp, True)',
+ 'package = temp / "minimax_h3_mlx"',
+ 'package.mkdir()',
+ '(package / "pipeline.py").write_text("MiniMaxH3Pipeline = object\\n")',
+ `(package / "text_encoder.py").write_text(${JSON.stringify(source)}.replace(`
+ + ' "__MERGE__", pins.PINNED_BROADCAST_MERGE))',
].join('\n');
- return execFileSync(pyBin, ['-c', source, script], { encoding: 'utf8' });
};
-// Write the pinned encoder into the checkout the probe is pointed at, so
-// `register_source_namespace` + `inspect.getsource` both see a real file — which
-// is what the encode digest is computed over. `pins` is imported first and the
-// digest re-recorded against this stand-in, because the probe's own import of
-// the module resolves to the same sys.modules entry.
-const conformingPin = [
- 'import hashlib, importlib, inspect',
- 'pins = importlib.import_module("_minimax_h3_mlx_pins")',
- '(package / "text_encoder.py").write_text("\\n".join([',
- ' "class MiniMaxH3TextEncoder:",',
- ' " def _wanted(self, key):",',
- ' " return key",',
- ' " @property",',
- ' " def processor(self):",',
- ' " return None",',
- ' " def _load_weights(self, model_dir, dtype, verbose):",',
- ' " return None",',
- ' " def encode(self, prompt, images=None):",',
- ' " # " + pins.PINNED_BROADCAST_MERGE,',
- ' " return None",',
- ']))',
-];
-const syncDigest = [
- 'from minimax_h3_mlx.text_encoder import MiniMaxH3TextEncoder as Pinned',
- 'pins.PINNED_ENCODE_DIGEST = hashlib.sha256(inspect.getsource(Pinned.encode).encode("utf-8")).hexdigest()',
-];
+// The fake's `encode` is not the pinned one, so its digest has to be recorded
+// before the probe reads it — otherwise every case would fail on the digest and
+// prove nothing about the seam it actually removed. Registering the namespace
+// here is what `probe.main()` does anyway, and it leaves the already-imported
+// module cached for the run under test.
+const recordFakeDigest = [
+ 'common.register_source_namespace("minimax_h3_mlx", package)',
+ 'from minimax_h3_mlx.text_encoder import MiniMaxH3TextEncoder as Fake',
+ // The dropped-encode case has no body to hash, and does not need one: its
+ // missing-hook check fires before the digest is ever consulted.
+ 'if hasattr(Fake, "encode"):',
+ ' pins.PINNED_ENCODE_DIGEST = hashlib.sha256(',
+ ' inspect.getsource(Fake.encode).encode("utf-8")',
+ ' ).hexdigest()',
+].join('\n');
+
+const runProbe = (flags = ['--verify-seams']) => [
+ `sys.argv = ["minimax_h3_runtime_probe.py", str(temp), ${flags.map((f) => JSON.stringify(f)).join(', ')}]`,
+ 'try:',
+ ' print("exit", probe.main())',
+ 'except RuntimeError as exc:',
+ ' print(str(exc))',
+].filter(Boolean).join('\n');
+
+const seamCase = (opts, flags) => runPython([
+ importProbe, stubMlxVlm(opts.mlxVlmDrop), fakeCheckout(opts), recordFakeDigest, runProbe(flags),
+].join('\n'));
describe.skipIf(!pyBin)('minimax_h3_runtime_probe.py', () => {
- it('passes a checkout whose text encoder still has every patched seam', () => {
- const output = runProbe([
- ...conformingPin,
- // Importing the pinned module needs the namespace the probe registers, so
- // register it here too — the probe's own call is idempotent.
- 'from _runner_common import register_source_namespace',
- 'register_source_namespace("minimax_h3_mlx", package)',
- ...syncDigest,
- ]);
- expect(output.trim()).toBe('EXIT:0');
+ it('passes a checkout whose every patched seam is still where PortOS left it', () => {
+ expect(seamCase({}).trim()).toBe('exit 0');
});
- // The whole point of moving the assertions here: a pin bump that breaks a
- // correction has to fail the bump, not the first keyframe render after it.
- it('refuses a checkout whose text encoder lost a patched seam', () => {
- const output = runProbe([
- ...conformingPin,
- 'from _runner_common import register_source_namespace',
- 'register_source_namespace("minimax_h3_mlx", package)',
- ...syncDigest,
- // Written after the digest is recorded, so `encode` is untouched and this
- // case can only be reported for the seam it actually broke.
- '(package / "text_encoder.py").write_text((package / "text_encoder.py").read_text().replace("_load_weights", "_load_weights_renamed"))',
- 'del sys.modules["minimax_h3_mlx.text_encoder"]',
- ]);
- expect(output).toMatch(/no longer exposes MiniMaxH3TextEncoder\._load_weights/);
- expect(output).not.toMatch(/EXIT:0/);
+ // The readiness path in server/services/videoGen/runtimes.js runs this probe
+ // BARE, and a false negative there sets byovGateBlocked and disables Generate
+ // for text-only renders too. So a moved seam — which breaks only the keyframe
+ // and substituted-conditioner paths — must not fail the flagless probe.
+ it('ignores a moved seam without --verify-seams, so readiness is unaffected', () => {
+ expect(seamCase({ drop: 'encode' }, []).trim()).toBe('exit 0');
});
- // The other half of what verify_pin_seams checks: names the corrections borrow
- // from mlx-vlm rather than from the pinned checkout. Nothing about the checkout
- // moved here, so only an mlx-vlm-side drift can produce this.
- it('refuses a runtime whose mlx-vlm dropped a borrowed name', () => {
- const output = runProbe([
- ...conformingPin,
- 'from _runner_common import register_source_namespace',
- 'register_source_namespace("minimax_h3_mlx", package)',
- ...syncDigest,
- 'del sys.modules["mlx_vlm.models.qwen3_vl.qwen3_vl"].Model.merge_input_ids_with_image_features',
- ]);
- expect(output).toMatch(/no longer exposes mlx_vlm\.models\.qwen3_vl\.qwen3_vl\.Model\.merge_input_ids_with_image_features/);
- expect(output).not.toMatch(/EXIT:0/);
+ // The whole point of the move: each of these used to surface minutes into a
+ // keyframe render (three of the four only on the image-conditioned path),
+ // where the pin bump that caused it was long out of sight.
+ it.each([
+ ['_wanted', /no longer exposes MiniMaxH3TextEncoder\._wanted/],
+ ['processor', /no longer exposes MiniMaxH3TextEncoder\.processor/],
+ ['_load_weights', /no longer exposes MiniMaxH3TextEncoder\._load_weights/],
+ ['encode', /no longer exposes MiniMaxH3TextEncoder\.encode/],
+ ])('fails Install / Repair when the pin dropped %s', (seam, expected) => {
+ expect(seamCase({ drop: seam })).toMatch(expected);
+ });
+
+ // A `processor` that is no longer a property is as much a pin change as an
+ // absent one: the pinned caller would start reading it as a plain attribute,
+ // and the correction binds a property.
+ it('fails Install / Repair when processor is no longer a property', () => {
+ expect(seamCase({ plainProcessor: true })).toMatch(/no longer exposes MiniMaxH3TextEncoder\.processor/);
+ });
+
+ // The merge correction copies the pinned `encode` body rather than wrapping
+ // it, so "the hook is present" is not enough — the body has to be the one that
+ // was copied, and the two ways it can stop being that want opposite fixes.
+ it('fails Install / Repair when the pinned encode body moved under an intact hook', () => {
+ const output = runPython([
+ importProbe, stubMlxVlm(), fakeCheckout(), runProbe(),
+ ].join('\n'));
+ expect(output).toMatch(/changed MiniMaxH3TextEncoder\.encode outside the merge/);
+ });
+
+ it('fails Install / Repair when upstream stopped merging by broadcast', () => {
+ const fixedUpstream = [
+ 'source = (package / "text_encoder.py").read_text()',
+ '(package / "text_encoder.py").write_text(',
+ ' source.replace(pins.PINNED_BROADCAST_MERGE, "a real scatter"))',
+ ].join('\n');
+ const output = runPython([
+ importProbe, stubMlxVlm(), fakeCheckout(), fixedUpstream, runProbe(),
+ ].join('\n'));
+ expect(output).toMatch(/no longer merges keyframe embeddings/);
+ });
+
+ // The corrections call these three by name; the probe did not import two of
+ // them at all before, so a locked-mlx-vlm bump could take them away and only
+ // a keyframe render would notice.
+ it.each([
+ // Dropping the whole module and dropping just the leaf attribute both walk
+ // the same dotted path in require_borrowed_attr, so both report the full
+ // attribute it was trying to resolve rather than the shorter module name.
+ ['mlx_vlm.utils', /no longer exposes mlx_vlm\.utils\.sanitize_weights/],
+ ['mlx_vlm.utils.sanitize_weights', /no longer exposes mlx_vlm\.utils\.sanitize_weights/],
+ ['mlx_vlm.models.qwen3_vl.qwen3_vl', /no longer exposes mlx_vlm\.models\.qwen3_vl\.qwen3_vl\.Model\.merge_input_ids_with_image_features/],
+ [
+ 'mlx_vlm.models.qwen3_vl.qwen3_vl.Model.merge_input_ids_with_image_features',
+ /no longer exposes mlx_vlm\.models\.qwen3_vl\.qwen3_vl\.Model\.merge_input_ids_with_image_features/,
+ ],
+ [
+ 'mlx_vlm.models.qwen3_vl.language.LanguageModel.get_rope_index',
+ /no longer exposes mlx_vlm\.models\.qwen3_vl\.language\.LanguageModel\.get_rope_index/,
+ ],
+ ])('fails Install / Repair when mlx-vlm no longer carries %s', (dotted, expected) => {
+ expect(seamCase({ mlxVlmDrop: dotted })).toMatch(expected);
+ });
+
+ // The one mlx-vlm module the FLAGLESS probe imports as well: losing it is a
+ // broken runtime, not a moved seam, so it fails readiness too — and as an
+ // ImportError from the bare import rather than a seam RuntimeError.
+ it('fails even the flagless probe when mlx-vlm loses the language module', () => {
+ expect(() => runPython([
+ importProbe, stubMlxVlm('mlx_vlm.models.qwen3_vl.language'), fakeCheckout(), runProbe([]),
+ ].join('\n'))).toThrow(/No module named .mlx_vlm.models.qwen3_vl.language./);
+ });
+
+ it('still refuses a runtime directory with no source package at all', () => {
+ const output = runPython([
+ importProbe,
+ 'import atexit, shutil, tempfile',
+ 'temp = Path(tempfile.mkdtemp())',
+ 'atexit.register(shutil.rmtree, temp, True)',
+ runProbe([]),
+ ].join('\n'));
+ expect(output).toMatch(/runtime source is missing/);
+ });
+});
+
+describe('MiniMax H3 pin facts', () => {
+ // The failure this whole mechanism defends against is authored HERE, on a
+ // branch: someone advances MINIMAX_H3_EXPECTED_REVISION and does not re-read
+ // `encode`. Both probe suites overwrite PINNED_ENCODE_DIGEST with a freshly
+ // computed one, so without this the shipped digest is asserted by nothing and
+ // a stale pair ships green. Update this triple in the same commit that moves
+ // the revision — after re-reading the new `encode` and folding whatever
+ // changed into install_vision_embed_merge.
+ it('keeps the recorded encode digest moving with the pinned revision', () => {
+ const pinsSource = readScript('_minimax_h3_mlx_pins.py');
+ expect(MINIMAX_H3_EXPECTED_REVISION).toBe('fcd9e9b79a1d6018d91ac477c0968de1fa067e49');
+ expect(pinsSource).toContain(
+ 'PINNED_ENCODE_DIGEST = "8047e407e797cd46cd7538024ca09d97402d369d97b1d825757a1590416bda7d"',
+ );
+ expect(pinsSource).toContain(
+ 'PINNED_BROADCAST_MERGE = "mx.where(image_mask[..., None], '
+ + 'hidden.astype(inputs_embeds.dtype)[None], inputs_embeds)"',
+ );
});
- it('still refuses a runtime directory with no pinned package in it', () => {
- const output = runProbe([
- ...conformingPin,
- '(package / "pipeline.py").unlink()',
- ]);
- expect(output).toMatch(/MiniMax H3 runtime source is missing/);
+ // BORROWED_MLX_VLM_ATTRS is a hand-kept mirror of what the corrections import.
+ // A correction that reaches for a fourth symbol would otherwise sail past
+ // Install / Repair and fail mid-render — the exact gap this change closes for
+ // the encoder seams.
+ it('probes every mlx-vlm symbol the corrections import', () => {
+ const covered = new Set(
+ [...readScript('_minimax_h3_mlx_pins.py').matchAll(/\("(mlx_vlm[\w.]*)",\s*"([\w.]+)"/g)]
+ .map(([, module, dotted]) => `${module}.${dotted.split('.')[0]}`),
+ );
+ const imported = [...readScript('generate_minimax_h3.py')
+ .matchAll(/^\s*from (mlx_vlm[\w.]*) import (.+)$/gm)]
+ .flatMap(([, module, names]) => names.split(',').map((name) => `${module}.${name.trim()}`));
+ // Bypass probe: an import line that stopped matching would make the
+ // assertion below vacuously true rather than failing.
+ expect(imported.length).toBeGreaterThanOrEqual(3);
+ expect(imported.filter((name) => !covered.has(name))).toEqual([]);
});
});
diff --git a/scripts/setup-image-video.sh b/scripts/setup-image-video.sh
index 92631f2291..6ae2817b43 100755
--- a/scripts/setup-image-video.sh
+++ b/scripts/setup-image-video.sh
@@ -442,8 +442,15 @@ if [[ "$INSTALL_MINIMAX_H3" == "1" ]]; then
fi
echo "📦 Syncing pinned MiniMax H3 MLX packages..."
"$MINIMAX_H3_UV" pip sync --python "$MINIMAX_H3_PY" "$MINIMAX_H3_LOCK"
- if ! "$MINIMAX_H3_PY" "${SCRIPT_DIR}/minimax_h3_runtime_probe.py" "$MINIMAX_H3_DIR" 2>/dev/null; then
- echo "❌ MiniMax H3 MLX synced but its pipeline import failed." >&2
+ # --verify-seams is Install/Repair-only strictness: it also asserts the encoder
+ # seams generate_minimax_h3.py patches, which the readiness probe deliberately
+ # skips (a moved seam must not mark a text-only-capable runtime unready). That
+ # message is then the one thing telling a pin bump apart from a broken sync, so
+ # capture stderr instead of discarding it and show the tail — the exception
+ # line, under whatever traceback preceded it.
+ if ! MINIMAX_H3_PROBE_OUT="$("$MINIMAX_H3_PY" "${SCRIPT_DIR}/minimax_h3_runtime_probe.py" "$MINIMAX_H3_DIR" --verify-seams 2>&1)"; then
+ echo "❌ MiniMax H3 MLX synced but its runtime probe failed." >&2
+ printf '%s\n' "$MINIMAX_H3_PROBE_OUT" | tail -n 5 | sed "s/^/ /" >&2
echo " Use Repair / Upgrade from the Video Gen runtime panel to retry." >&2
exit 1
fi
diff --git a/server/services/videoGen/runtimes.js b/server/services/videoGen/runtimes.js
index 68d3282a4f..8a19011891 100644
--- a/server/services/videoGen/runtimes.js
+++ b/server/services/videoGen/runtimes.js
@@ -135,6 +135,13 @@ export const BYOV_RUNTIME_INFO = Object.freeze({
// The port is source-only rather than pip-installed. The dedicated probe
// registers only the source package namespace; it never prepends the whole
// checkout, where an untracked root module could shadow a locked venv dep.
+ // Deliberately WITHOUT the probe's --verify-seams flag: that flag asserts the
+ // encoder seams generate_minimax_h3.py patches, and a moved seam breaks only
+ // the keyframe / substituted-conditioner paths. Failing readiness over it
+ // would set byovGateBlocked and disable Generate for text-only renders too —
+ // the same trap minimax_h3_lora_probe.py is kept a separate probe to avoid.
+ // Install / Repair passes the flag (scripts/setup-image-video.sh), which is
+ // where a pin bump is actionable.
probeArgs: [MINIMAX_H3_RUNTIME_PROBE_SCRIPT, MINIMAX_H3_REPO_DIR],
// Separate, OPTIONAL capability probe: can this checkout apply LoRAs to the
// quantized DiT at runtime? H3's shipped weights are 8-bit, so a LoRA can