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

stop the video model list reporting an unprobed H3 runtime as LoRA-incapable

[._.]/ Adam Eivy3f73e8b4de03
diff --git a/server/routes/videoGen.js b/server/routes/videoGen.js
index 555bdfc3f0..1d0354c0fd 100644
--- a/server/routes/videoGen.js
+++ b/server/routes/videoGen.js
@@ -33,6 +33,7 @@ import {
listVideoModels,
defaultVideoModelId,
BYOV_RUNTIME_INFO,
+ warmByovLoraCapabilities,
isByovRuntimeReady,
resolveRuntimeFingerprint,
loadHistory,
@@ -92,7 +93,16 @@ import { isDisplaySleepEnabled } from '../services/videoGen/displayPower.js';
const router = Router();
const hardwareAwareVideoModels = async () => {
- const capabilities = await detectSystemCapabilities();
+ // Warm the LoRA-capability verdicts BEFORE decorating: listVideoModels()
+ // stamps each entry's `runtimeLoraCapable` from the sync accessor, which
+ // reads an unprobed runtime as "not capable". Serving that unprobed default
+ // is what made an install whose H3 runtime passes the probe show "this H3
+ // runtime did not pass PortOS's quantization-aware LoRA probe" until the page
+ // was reloaded — the client fetches this list once, so the background warm
+ // never reached it. Concurrent with the hardware probe (both cache for the
+ // process) so the first call after a restart is the only one that pays, and
+ // pays nothing extra in wall time.
+ const [capabilities] = await Promise.all([detectSystemCapabilities(), warmByovLoraCapabilities()]);
return {
capabilities,
models: listVideoModels().map((model) => withHardwareCompatibility(
@@ -104,11 +114,13 @@ const hardwareAwareVideoModels = async () => {
};
// The model list plus the three numbers that decide which entry the picker
-// auto-selects. Deliberately free of any python probe: /status shells out to
-// the interpreter on every call (~1-2s) and the Model field used to wait on it,
-// so `/model-context` serves the same fields off the registry and the cached
-// hardware probe alone. /status keeps returning them for its other readers —
-// this is the single builder both routes share, so the two can't drift.
+// auto-selects. Deliberately free of any PER-CALL python probe: /status shells
+// out to the interpreter on every call (~1-2s) and the Model field used to wait
+// on it, so `/model-context` serves the same fields off the registry, the cached
+// hardware probe and the once-per-process LoRA-capability warm above (a bare
+// MLX import, no model load, cached both ways). /status keeps returning them
+// for its other readers — this is the single builder both routes share, so the
+// two can't drift.
const videoModelContext = async () => {
const { capabilities, models } = await hardwareAwareVideoModels();
return {
@@ -630,10 +642,11 @@ router.get('/models', asyncHandler(async (_req, res) => {
res.json(models);
}));
-// Everything the Model picker needs to render AND auto-select, with no python
-// probe in the way. A sibling route rather than a wrapper around /models so the
-// bare-array shape that route has always returned stays intact for its existing
-// callers (and for an older client talking to a newer server).
+// Everything the Model picker needs to render AND auto-select, with no
+// per-request python probe in the way. A sibling route rather than a wrapper
+// around /models so the bare-array shape that route has always returned stays
+// intact for its existing callers (and for an older client talking to a newer
+// server).
router.get('/model-context', asyncHandler(async (_req, res) => {
res.json(await videoModelContext());
}));
diff --git a/server/routes/videoGen.test.js b/server/routes/videoGen.test.js
index 8f78833ae8..f2aad9cbf5 100644
--- a/server/routes/videoGen.test.js
+++ b/server/routes/videoGen.test.js
@@ -68,6 +68,7 @@ const runtimeProbes = vi.hoisted(() => ({
isByovRuntimeCurrent: vi.fn(async () => false),
invalidateByovReadyCache: vi.fn(),
invalidateByovLoraCapabilityCache: vi.fn(),
+ warmByovLoraCapabilities: vi.fn(async () => {}),
invalidateRuntimeFingerprintCache: vi.fn(),
}));
vi.mock('../services/videoGen/runtimes.js', async (importOriginal) => ({
@@ -648,6 +649,28 @@ describe('videoGen routes', () => {
expect(checkPackages).not.toHaveBeenCalled();
});
+ // Each model's `runtimeLoraCapable` is stamped from a SYNC accessor that
+ // reads a not-yet-probed runtime as "not capable" — the gate fails closed.
+ // That default is indistinguishable from a probed `false` once it is in the
+ // payload, and the client fetches this list ONCE: an install whose H3
+ // runtime passes the probe was told "this H3 runtime did not pass PortOS's
+ // quantization-aware LoRA probe" for the life of the page, because the
+ // background warm corrected the server and nothing corrected the client.
+ it('reports the probed LoRA verdict, not the pre-probe fail-closed default', async () => {
+ let probed = false;
+ runtimeProbes.warmByovLoraCapabilities.mockImplementationOnce(async () => { probed = true; });
+ // Stands in for decorateVideoModel, which stamps the sync read at the
+ // moment the list is built — so this is `false` unless the warm ran first.
+ videoGenService.listVideoModels.mockImplementationOnce(() => [{
+ id: 'minimax_h3_8bit', name: 'MiniMax H3 MLX 8-bit', runtime: 'minimax_h3',
+ supportedModes: ['text'], runtimeLoraCapable: probed,
+ }]);
+
+ const r = await request(app).get('/api/video-gen/model-context');
+ expect(r.status).toBe(200);
+ expect(r.body.models[0].runtimeLoraCapable).toBe(true);
+ });
+
it('agrees with /status on every field the two share', async () => {
const [context, status] = await Promise.all([
request(app).get('/api/video-gen/model-context'),
diff --git a/server/services/videoGen/runtimes.js b/server/services/videoGen/runtimes.js
index cdd6574ab5..999f6dae8f 100644
--- a/server/services/videoGen/runtimes.js
+++ b/server/services/videoGen/runtimes.js
@@ -553,6 +553,29 @@ export function byovRuntimeLoraCapable(runtimeId) {
return false;
}
+// Resolve every probe-gated runtime's LoRA verdict up front, so a caller that
+// then reads the SYNC accessor above gets a probed answer instead of its
+// fail-closed default. Exists because that default is indistinguishable from a
+// real "no" once it is serialized into a payload: a model list built on a cold
+// cache tells the client the runtime cannot take LoRAs, and the background warm
+// that follows corrects the server without correcting the client, which fetched
+// that list once. The user then sees "this runtime did not pass the probe" for
+// the life of the page on an install where the probe passes.
+//
+// Cheap enough to await on a request path: the probe is a bare MLX import with
+// no model load (tens of ms), and BOTH verdicts cache for the life of the
+// process — so this is one spawn per server start, not the per-request python
+// probe that /model-context exists to avoid. An uninstalled runtime spawns
+// nothing; resolve short-circuits on the missing venv.
+export async function warmByovLoraCapabilities() {
+ await Promise.all(Object.keys(BYOV_RUNTIME_INFO)
+ .filter((runtimeId) => BYOV_RUNTIME_INFO[runtimeId].loraProbeArgs)
+ // resolve never rejects today (runVenvProbe resolves every outcome), but
+ // this runs on a request path where a future throw must not take the whole
+ // model-list response down with it.
+ .map((runtimeId) => resolveByovRuntimeLoraCapable(runtimeId).catch(() => false)));
+}
+
// Single user-facing reason a video model can't take LoRAs. Lives here, beside
// the capability data it reads, so the enqueue gate (prepareParams) and the
// render gate (local.js buildArgs) can't drift into telling the user two
diff --git a/server/services/videoGen/runtimes.test.js b/server/services/videoGen/runtimes.test.js
index 12628d2599..8497a26f76 100644
--- a/server/services/videoGen/runtimes.test.js
+++ b/server/services/videoGen/runtimes.test.js
@@ -24,7 +24,7 @@ import {
byovRuntimeLoraCapable, invalidateByovLoraCapabilityCache, invalidateByovReadyCache,
isByovRuntimeCurrent, isByovRuntimeReady, isPinnedSourceStatusClean, modelAnchorsLastFrame,
resolveByovRuntimeLoraCapable, runtimeIsCacheOnly, runtimeNeedsProcessGroupKill, runtimeUsesMlx,
- routesToWindowsHelper, LTX25_EXPECTED_REVISION,
+ routesToWindowsHelper, warmByovLoraCapabilities, LTX25_EXPECTED_REVISION,
} from './runtimes.js';
const REVISION = 'fcd9e9b79a1d6018d91ac477c0968de1fa067e49';
@@ -283,6 +283,17 @@ describe('MiniMax H3 LoRA capability', () => {
expect(runtimeMocks.spawn).toHaveBeenCalledTimes(1);
});
+ // What the model-list route awaits so its payload never ships the cold read
+ // above as if it were a probed verdict.
+ it('makes the sync accessor authoritative, probing only the LoRA-gated runtimes', async () => {
+ runtimeMocks.spawn.mockImplementationOnce(() => exitChild(0));
+ await warmByovLoraCapabilities();
+ expect(byovRuntimeLoraCapable('minimax_h3')).toBe(true);
+ // One spawn, not one per BYOV runtime: everything else declares no
+ // loraProbeArgs, which resolve answers without a child.
+ expect(runtimeMocks.spawn).toHaveBeenCalledTimes(1);
+ });
+
it.each(['ltx2', 'ltx25', 'wan22'])('never probes %s, which has no LoRA runtime path', async (runtime) => {
await expect(resolveByovRuntimeLoraCapable(runtime)).resolves.toBe(false);
expect(byovRuntimeLoraCapable(runtime)).toBe(false);