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: harden H3 LoRA routing and capability refresh
[._.]/ Adam Eivyd1992bfaa3fa
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsxindex b205ad0dc2..f2aec3c687 100644--- a/client/src/pages/VideoGen.jsx+++ b/client/src/pages/VideoGen.jsx@@ -1280,9 +1280,9 @@ export default function VideoGen() {</FormField>)}- {/* Video LoRAs — only on ltx2-runtime models (loraFamily non-null)- and only when at least one video-family LoRA is installed- (videoLoras is the strict ltx-video subset; see the hook). */}+ {/* Video LoRAs — only on runtimes with a compatible video family+ (loraFamily non-null) and when at least one matching LoRA is+ installed (videoLoras is the strict family subset; see hook). */}{loraFamily && videoLoras.length > 0 && (<div className="col-span-2 sm:col-span-3"><LoraPicker@@ -1494,7 +1494,13 @@ export default function VideoGen() {label={byovStatus?.label}streamMethod="POST"onClose={() => setInstallModalOpen(false)}- onComplete={() => refreshByovStatus()}+ onComplete={() => {+ refreshByovStatus();+ // The capability probe is part of /video-gen/status's model+ // decoration. Refresh it after install/repair so H3's LoRA picker+ // and warning react without a manual page reload.+ refreshStatus();+ }}/></div>);diff --git a/client/src/pages/VideoGen.terms.test.jsx b/client/src/pages/VideoGen.terms.test.jsxindex 4d276e10b6..6c9a1c035d 100644--- a/client/src/pages/VideoGen.terms.test.jsx+++ b/client/src/pages/VideoGen.terms.test.jsx@@ -43,6 +43,8 @@ const state = vi.hoisted(() => ({// (settings.videoGen.acceptedModelTerms) the terms endpoints read and write.acceptedTerms: [],setVideoModelTerms: vi.fn(),+ getVideoGenStatus: vi.fn(),+ runtimeInstallComplete: null,}));// Acceptance lives on the server, not in this browser, so a single@@ -58,15 +60,7 @@ vi.mock('../services/api', () => ({// as a media provider the picker renders nothing and every local path below// is unchanged.getInstances: vi.fn(async () => ({ peers: [] })),- getVideoGenStatus: vi.fn(async () => ({- connected: true,- pythonPath: '/opt/example/python3',- defaultModel: 'h3-one',- models: [H3_ONE, H3_TWO],- byovRuntimes: [],- systemMemoryGb: 128,- backendDisclosures: [],- })),+ getVideoGenStatus: (...args) => state.getVideoGenStatus(...args),generateVideo: (...args) => state.generateVideo(...args),cancelVideoGen: vi.fn(async () => ({})),listVideoHistory: vi.fn(async () => []),@@ -135,7 +129,12 @@ vi.mock('../components/ui/Toast', () => ({vi.mock('../components/Drawer', () => ({ default: () => null }));vi.mock('../components/settings/ImageGenTab', () => ({ ImageGenTab: () => null }));vi.mock('../components/settings/LocalSetupPanel', () => ({ default: () => null }));-vi.mock('../components/install/RuntimeInstallModal', () => ({ default: () => null }));+vi.mock('../components/install/RuntimeInstallModal', () => ({+ default: ({ onComplete }) => {+ state.runtimeInstallComplete = onComplete;+ return null;+ },+}));vi.mock('../components/videoGen/FramePanel', () => ({ default: () => null }));vi.mock('../components/videoGen/KeyframePanel', () => ({ default: () => null }));vi.mock('../components/videoGen/AudioPanel', () => ({ default: () => null }));@@ -187,6 +186,16 @@ describe('VideoGen MiniMax H3 orchestration', () => {: state.acceptedTerms.filter((id) => id !== termsId);return { accepted: [...state.acceptedTerms] };});+ state.getVideoGenStatus.mockReset().mockResolvedValue({+ connected: true,+ pythonPath: '/opt/example/python3',+ defaultModel: 'h3-one',+ models: [H3_ONE, H3_TWO],+ byovRuntimes: [],+ systemMemoryGb: 128,+ backendDisclosures: [],+ });+ state.runtimeInstallComplete = null;state.eventSourceRef.current = null;state.attach.mockReset().mockImplementation(async (_jobId, handlers) => {handlers.onComplete({ result: { filename: 'example.mp4' } });@@ -247,4 +256,14 @@ describe('VideoGen MiniMax H3 orchestration', () => {fireEvent.click(repair);expect(state.repairModel).toHaveBeenCalledWith(H3_ONE.id);});++ it('refreshes the model capability payload after runtime setup completes', async () => {+ await renderPage();+ await waitFor(() => expect(screen.getByLabelText('Model')).toHaveValue(H3_ONE.id));+ const before = state.getVideoGenStatus.mock.calls.length;++ await act(async () => { await state.runtimeInstallComplete(); });++ await waitFor(() => expect(state.getVideoGenStatus).toHaveBeenCalledTimes(before + 1));+ });});diff --git a/scripts/minimax_h3_lora.py b/scripts/minimax_h3_lora.pyindex a42d69bb55..77c16a2cda 100644--- a/scripts/minimax_h3_lora.py+++ b/scripts/minimax_h3_lora.py@@ -17,6 +17,7 @@ small integration layer owns the LoRA file-format and quantization contract.from __future__ import annotationsimport math+import refrom pathlib import Pathfrom typing import Any@@ -116,6 +117,17 @@ class LoRALinear(nn.Module):def _normalize_target(target: str) -> tuple[str, str]:"""Map common diffusers/ComfyUI H3 prefixes to PortOS's DiT tree."""+ if target.startswith("lora_unet_"):+ # Kohya flattens the module path with underscores. Keep the terminal+ # ``to_q``/``to_k``/``to_v`` token intact while restoring the separators+ # that identify a Diffusers H3 attention projection.+ target = target[len("lora_unet_"):]+ flattened = re.match(r"^(transformer_blocks|single_transformer_blocks)_(\d+)_(.+)$", target)+ if flattened:+ target = f"{flattened.group(1)}.{flattened.group(2)}.{flattened.group(3)}"+ target = target.replace("_to_out_", ".to_out.")+ target = target.replace("_to_", ".to_")+ target = target.replace(".ff_net_", ".ff.net.")prefixes = ("base_model.model.","model.diffusion_model.",@@ -132,6 +144,7 @@ def _normalize_target(target: str) -> tuple[str, str]:if target.startswith("token_refiner.refiner_blocks."):target = "token_refiner.blocks." + target[len("token_refiner.refiner_blocks."):]target = target.replace(".attention.", ".attn.")+ target = target.replace(".attn1.", ".attn.")if target.endswith(".attn.to_q"):return target[:-len(".attn.to_q")] + ".attn.qkv_proj", "split_q"if target.endswith(".attn.to_k"):diff --git a/scripts/minimax_h3_lora.test.js b/scripts/minimax_h3_lora.test.jsindex 8837980c6b..86dfc480fc 100644--- a/scripts/minimax_h3_lora.test.js+++ b/scripts/minimax_h3_lora.test.js@@ -147,4 +147,15 @@ describe.skipIf(!pyBin)('minimax_h3_lora.py', () => {]);expect(output.trim()).toBe('ok');});++ it('normalizes Diffusers attn1 and flattened kohya H3 targets', () => {+ const output = runPython([+ 'from minimax_h3_lora import _normalize_target',+ 'expected = ("blocks.0.attn.qkv_proj", "split_k")',+ 'for target in ["transformer_blocks.0.attn1.to_k", "lora_unet_transformer_blocks_0_attn1_to_k"]:',+ ' if _normalize_target(target) != expected: raise AssertionError(f"target was not normalized: {target}")',+ 'print("ok")',+ ]);+ expect(output.trim()).toBe('ok');+ });});diff --git a/server/services/videoGen/local.test.js b/server/services/videoGen/local.test.jsindex f7d7924407..3cd545557e 100644--- a/server/services/videoGen/local.test.js+++ b/server/services/videoGen/local.test.js@@ -4332,6 +4332,14 @@ describe('resolveVideoLoras — safetensors key-layout gate', () => {}});+ it('still rejects a known non-LoRA file for MiniMax H3 before rendering', async () => {+ loraLayoutState.layout = 'not_a_lora';+ await expect(resolveVideoLoras(+ [{ filename: 'checkpoint.safetensors' }],+ { runtime: 'minimax_h3' },+ )).rejects.toMatchObject({ status: 400, code: 'LORA_LAYOUT_UNSUPPORTED' });+ });+it('rejects a kohya-layout LoRA with an actionable 400 naming the layout', async () => {loraLayoutState.layout = 'kohya';await expect(resolveVideoLoras([{ filename: 'style.safetensors', scale: 1.0 }]))diff --git a/server/services/videoGen/renderArgs.js b/server/services/videoGen/renderArgs.jsindex 30d0d439d5..c1db235708 100644--- a/server/services/videoGen/renderArgs.js+++ b/server/services/videoGen/renderArgs.js@@ -177,7 +177,9 @@ export const resolveVideoLoras = async (loras, { probeEffect = false, runtime =throw new ServerError(`LoRA not found: ${l.filename}`, { status: 400, code: 'LORA_NOT_FOUND' });}const layout = await getLoraKeyLayout(l.filename);- const issue = runtime === 'minimax_h3' ? null : videoLoraLayoutIssue(layout);+ const issue = runtime === 'minimax_h3' && layout !== 'not_a_lora'+ ? null+ : videoLoraLayoutIssue(layout);if (issue) {throw new ServerError(`LoRA "${l.filename}" can't be used for video: ${issue}.`,