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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: decide the H3 LoRA gate from the settled probe, not the cold model snapshot
[._.]/ Adam Eivy87236e9b56a3
diff --git a/server/services/videoGen/local.js b/server/services/videoGen/local.jsindex 1d4ec61ce9..daf571d377 100644--- a/server/services/videoGen/local.js+++ b/server/services/videoGen/local.js@@ -1002,10 +1002,13 @@ export async function generateVideo({ pythonPath, prompt, negativePrompt = '', m// rejects LoRAs on non-ltx2 runtimes (the route also guards), so this is a// no-op there.const resolvedLoras = await resolveVideoLoras(loras);- // Resolve the runtime's LoRA capability BEFORE buildArgs, which reads it- // synchronously. Without this the render would hit a cold cache and reject a- // LoRA the installed runner can actually apply (the sync read fails closed).- if (resolvedLoras.length) await resolveByovRuntimeLoraCapable(model.runtime);+ // `model` was decorated from a SYNC cache read, which is false on a cold+ // cache. Resolve the probe and re-decorate from the settled verdict before+ // buildArgs reads it off the snapshot — otherwise the first LoRA render after+ // boot is refused on a capable install and only heals on retry.+ const loraCapableModel = resolvedLoras.length+ ? { ...model, runtimeLoraCapable: await resolveByovRuntimeLoraCapable(model.runtime) }+ : model;// IC-LoRA remix: resolve the per-mode weight before any GPU work. A cached// weight resolves to the exact file inside the HF snapshot; an un-cached one@@ -1317,7 +1320,7 @@ export async function generateVideo({ pythonPath, prompt, negativePrompt = '', m// logic of the spawn-error handler so failure modes converge.let bin, args;try {- ({ bin, args } = buildArgs({ pythonPath, modelId, model, wanModelPath, wanRequiredWeights, prompt, negativePrompt, width: w, height: h, numFrames: parsedNumFrames, fps: parsedFps, steps: actualSteps, stage2Steps: actualStage2Steps, guidance: actualGuidance, seed: actualSeed, tiling, disableAudio, sourceImagePath: resolvedSourceImage, lastImagePath: resolvedLastImage, keyframes: resolvedKeyframes, extendFromVideoPath, audioFilePath, audioStartSec, mode, imageStrength: actualImageStrength, textEncoderRepo: actualTextEncoderRepo, outputPath, loras: resolvedLoras, icReferencePaths: resolvedIcReferencePaths, icLoraWeightPath, icStrength: actualIcStrength, icAttentionStrength: actualIcAttentionStrength, icSkipStage2 }));+ ({ bin, args } = buildArgs({ pythonPath, modelId, model: loraCapableModel, wanModelPath, wanRequiredWeights, prompt, negativePrompt, width: w, height: h, numFrames: parsedNumFrames, fps: parsedFps, steps: actualSteps, stage2Steps: actualStage2Steps, guidance: actualGuidance, seed: actualSeed, tiling, disableAudio, sourceImagePath: resolvedSourceImage, lastImagePath: resolvedLastImage, keyframes: resolvedKeyframes, extendFromVideoPath, audioFilePath, audioStartSec, mode, imageStrength: actualImageStrength, textEncoderRepo: actualTextEncoderRepo, outputPath, loras: resolvedLoras, icReferencePaths: resolvedIcReferencePaths, icLoraWeightPath, icStrength: actualIcStrength, icAttentionStrength: actualIcAttentionStrength, icSkipStage2 }));} catch (err) {job.status = 'error';const reason = err.message || 'Failed to build video gen args';diff --git a/server/services/videoGen/local.test.js b/server/services/videoGen/local.test.jsindex 6619b7df52..9a107a0dc2 100644--- a/server/services/videoGen/local.test.js+++ b/server/services/videoGen/local.test.js@@ -174,10 +174,14 @@ vi.mock('fs', () => ({// DiT. Really a spawned python probe; stubbed here so the render-path tests// drive both verdicts without the shared child_process mock (which resolves// every spawn successfully) silently reporting "capable".-const h3LoraState = vi.hoisted(() => ({ capable: false }));+// `cached` is the SYNC read (false on a cold cache even for a capable install);+// `capable` is the settled probe verdict. They are separate so a test can pin+// the cold-cache case, where the two legitimately disagree.+const h3LoraState = vi.hoisted(() => ({ capable: false, cached: null }));vi.mock('./runtimes.js', async (importOriginal) => ({...await importOriginal(),- byovRuntimeLoraCapable: vi.fn((runtime) => runtime === 'minimax_h3' && h3LoraState.capable),+ byovRuntimeLoraCapable: vi.fn((runtime) => runtime === 'minimax_h3'+ && (h3LoraState.cached ?? h3LoraState.capable)),resolveByovRuntimeLoraCapable: vi.fn(async (runtime) => runtime === 'minimax_h3' && h3LoraState.capable),}));@@ -2180,7 +2184,26 @@ describe('MiniMax H3 user LoRAs', () => {loras: [{ filename: 'fox.safetensors', scale: 0.8 }],});- afterEach(() => { h3LoraState.capable = false; });+ afterEach(() => { h3LoraState.capable = false; h3LoraState.cached = null; });++ // The model is decorated from the sync cache read, so on a capable install the+ // FIRST LoRA render after boot sees `runtimeLoraCapable: false`. buildArgs must+ // decide from the settled probe, not that stale snapshot, or the render is+ // refused and only succeeds on a retry.+ it('renders on a cold capability cache once the probe settles capable', async () => {+ h3LoraState.capable = true;+ h3LoraState.cached = false; // sync read hasn't caught up yet+ const { spawnDetached } = await import('../../lib/detachedSpawn.js');+ const spawnMock = vi.mocked(spawnDetached);+ spawnMock.mockClear();++ await expect(h3Render('h3-lora-cold-cache')).resolves.toBeDefined();++ const [, args] = spawnMock.mock.calls.find(([, a]) => (+ Array.isArray(a) && a.some((arg) => String(arg).endsWith('/generate_minimax_h3.py'))+ ));+ expect(args).toContain('--lora');+ });it('rejects LoRAs with an H3-specific reason when the runner has no applicator', async () => {h3LoraState.capable = false;