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

address review (codex): round-trip video LoRAs via the loraFilenames/loraScales contract

[._.]/ Adam Eivyeb00051ac5f7
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsx
index 9e3d2f1c3e..032d47e5d3 100644
--- a/client/src/pages/VideoGen.jsx
+++ b/client/src/pages/VideoGen.jsx
@@ -442,6 +442,23 @@ export default function VideoGen() {
setLastImageUpload(null);
setExtendFromVideoId('');
setAudioFile(null);
+ // Restore the LoRA picker from the persisted render record. normalizeVideo
+ // exposes filenames as `loraNames`, but scales live on the raw record, so
+ // read the parallel `loraFilenames`/`loraScales` arrays directly (the same
+ // contract ImageGen.handleRemix restores from). Names resolve from the
+ // loaded library, falling back to the filename. The picker self-hides if
+ // the remixed model isn't ltx2, and the payload omits LoRAs there.
+ const raw = item.raw || {};
+ const remixLoraFilenames = item.loraNames?.length ? item.loraNames : raw.loraFilenames;
+ if (Array.isArray(remixLoraFilenames) && remixLoraFilenames.length) {
+ setSelectedLoras(remixLoraFilenames.map((filename, i) => ({
+ filename,
+ name: availableLoras.find((a) => a.filename === filename)?.name || filename,
+ scale: typeof raw.loraScales?.[i] === 'number' ? raw.loraScales[i] : 1.0,
+ })));
+ } else {
+ setSelectedLoras([]);
+ }
window.scrollTo({ top: 0, behavior: 'smooth' });
};
diff --git a/server/services/videoGen/local.js b/server/services/videoGen/local.js
index bbea1bcfe4..7f21a7de73 100644
--- a/server/services/videoGen/local.js
+++ b/server/services/videoGen/local.js
@@ -855,9 +855,16 @@ export async function generateVideo({ pythonPath, prompt, negativePrompt = '', m
// render apart from a user who happened to pick 8 steps — comparing it
// against the default Standard render is the whole point of the knob.
...(t2vTwoStage ? { twoStageT2v: true, stage2Steps: actualStage2Steps } : {}),
- // Stamp the applied LoRAs (basename + strength) so the history entry and
- // the Remix flow can show/round-trip which LoRAs styled this render.
- ...(resolvedLoras.length ? { loras: resolvedLoras.map((l) => ({ filename: l.filename, scale: l.strength })) } : {}),
+ // Stamp applied LoRAs using the SAME parallel-array contract image renders
+ // use (`loraFilenames` + `loraScales`) so the existing history consumers —
+ // normalizeVideo / getRenderConfigForItem (client/src/components/media/
+ // normalize.js) and the Remix handler — surface and round-trip them with no
+ // per-shape special-casing. A bespoke `loras` field would be invisible to
+ // those readers.
+ ...(resolvedLoras.length ? {
+ loraFilenames: resolvedLoras.map((l) => l.filename),
+ loraScales: resolvedLoras.map((l) => l.strength),
+ } : {}),
...(hidden ? { hidden: true } : {}),
};
const job = { ...meta, clients: [], status: 'running' };
@@ -1507,6 +1514,14 @@ export async function stitchVideos(videoIds, opts = {}) {
thumbnail: thumb,
createdAt: new Date().toISOString(),
[historyKey]: videoIds,
+ // Inherit applied LoRAs from the first constituent clip (a chunk chain
+ // shares one LoRA set across all chunks), so the visible stitched entry
+ // round-trips LoRAs on Remix the same way a single render does — mirrors
+ // how modelId/seed/width above are taken from videos[0].
+ ...(Array.isArray(videos[0].loraFilenames) && videos[0].loraFilenames.length ? {
+ loraFilenames: videos[0].loraFilenames,
+ loraScales: videos[0].loraScales,
+ } : {}),
};
const h = await loadHistory();
h.unshift(stitchedMeta);
diff --git a/server/services/videoGen/local.test.js b/server/services/videoGen/local.test.js
index 51c47423cc..bd8fb2c685 100644
--- a/server/services/videoGen/local.test.js
+++ b/server/services/videoGen/local.test.js
@@ -928,3 +928,28 @@ describe('generateVideo — video LoRA (--user-loras) arg threading', () => {
expect(call[1]).not.toContain('--user-loras');
});
});
+
+describe('generateVideo — LoRA history-record contract (Remix round-trip)', () => {
+ it('stamps loraFilenames + loraScales (not a bespoke `loras` field) so normalizeVideo/Remix can read them', async () => {
+ let startedMeta = null;
+ videoGenEvents.on('started', (e) => { if (e.generationId === 'lora-history-test') startedMeta = e; });
+
+ await generateVideo({
+ jobId: 'lora-history-test',
+ pythonPath: '/usr/bin/python3',
+ modelId: 'ltx2_unified',
+ prompt: 'styled clip',
+ width: 512, height: 512, numFrames: 25, fps: 24,
+ mode: 'text',
+ loras: [{ filename: 'a.safetensors', scale: 0.7 }, { filename: 'b.safetensors', scale: 1.0 }],
+ });
+ videoGenEvents.removeAllListeners('started');
+
+ expect(startedMeta).toBeTruthy();
+ // The image LoRA contract that normalize.js#pickLoraFilenames + the Remix
+ // handler consume — parallel arrays, not a `loras: [{filename,scale}]` blob.
+ expect(startedMeta.loraFilenames).toEqual(['a.safetensors', 'b.safetensors']);
+ expect(startedMeta.loraScales).toEqual([0.7, 1.0]);
+ expect(startedMeta.loras).toBeUndefined();
+ });
+});