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): detect ltx2/qwen-edit variants, scope registry lookups to current platform

[._.]/ Adam Eivy7a50e0c66016
diff --git a/server/lib/huggingfaceModel.js b/server/lib/huggingfaceModel.js
index fcae384bf5..37ddcf6488 100644
--- a/server/lib/huggingfaceModel.js
+++ b/server/lib/huggingfaceModel.js
@@ -82,7 +82,14 @@ const detectVideoRuntime = (blob) => {
if (/hunyuan/.test(blob)) {
return { runtime: 'hunyuan', installHint: 'INSTALL_HUNYUAN=1 bash scripts/setup-image-video.sh' };
}
- if (looksLikeLtxVideo(blob)) return { runtime: 'mlx_video' };
+ if (looksLikeLtxVideo(blob)) {
+ // dgrauet's LTX-2 repos run on the `ltx2` BYO-venv runtime (true keyframe
+ // pipeline), not notapalindrome's `mlx_video` — auto-detect that from the
+ // author/marker so an added dgrauet repo routes to the right generator.
+ // Everything else LTX defaults to mlx_video (the shipped default runtime).
+ if (/dgrauet|ltx[\s._-]?pipelines/.test(blob)) return { runtime: 'ltx2' };
+ return { runtime: 'mlx_video' };
+ }
return null;
};
@@ -329,7 +336,12 @@ export const classifyHfMediaModel = ({ repo, model, kind, runtime, runner } = {}
{ status: 422, code: 'HF_FLUX2_QUANTIZED' },
);
}
- return { kind: 'image', runner: resolvedRunner, format: 'safetensors' };
+ // Qwen-Image-Edit loads QwenImageEditPipeline (not QwenImagePipeline) and
+ // REQUIRES a source image — a text-only render crashes deep in diffusers, so
+ // the built-in carries `editOnly`. Detect the edit repo so the added entry
+ // gets the right pipeline + gate instead of the plain text-to-image config.
+ const editVariant = resolvedRunner === RUNNER_FAMILIES.QWEN && /qwen[\s._-]?image[\s._-]?edit|-edit\b|\bedit\b/.test(blob);
+ return { kind: 'image', runner: resolvedRunner, format: 'safetensors', ...(editVariant ? { editVariant: true } : {}) };
};
// Derive a stable, collision-resistant registry id from the repo. `org/name`
@@ -381,6 +393,12 @@ export const buildCustomModelEntry = ({ repo, model, classification, name, steps
// the first render will prompt the user to accept that license + set an HF
// token, same as the shipped built-in.
Object.assign(entry, RUNNER_METADATA[classification.runner] || {});
+ // A Qwen-Image-Edit repo needs the edit pipeline + the editOnly gate
+ // (text-only renders crash it), overriding the plain QwenImagePipeline.
+ if (classification.editVariant) {
+ entry.pipelineClass = 'QwenImageEditPipeline';
+ entry.editOnly = true;
+ }
}
return entry;
};
diff --git a/server/lib/huggingfaceModel.test.js b/server/lib/huggingfaceModel.test.js
index 8839585f90..eda327d91a 100644
--- a/server/lib/huggingfaceModel.test.js
+++ b/server/lib/huggingfaceModel.test.js
@@ -107,6 +107,23 @@ describe('classifyHfMediaModel — happy paths', () => {
})).toEqual({ kind: 'video', runtime: 'mlx_video', format: 'safetensors' });
});
+ it('auto-detects a dgrauet LTX repo as the ltx2 runtime (not mlx_video)', () => {
+ expect(classifyHfMediaModel({
+ repo: 'dgrauet/ltx-2.3-mlx-q8',
+ model: hf({ files: ['model.safetensors'], tags: ['ltx'] }),
+ })).toEqual({ kind: 'video', runtime: 'ltx2', format: 'safetensors' });
+ });
+
+ it('detects a Qwen-Image-Edit repo and stamps the edit pipeline + editOnly', () => {
+ const c = classifyHfMediaModel({
+ repo: 'Qwen/Qwen-Image-Edit',
+ model: hf({ files: ['model.safetensors'], pipeline: 'text-to-image' }),
+ });
+ expect(c).toMatchObject({ kind: 'image', runner: 'qwen', editVariant: true });
+ const entry = buildCustomModelEntry({ repo: 'Qwen/Qwen-Image-Edit', model: hf({}), classification: c });
+ expect(entry).toMatchObject({ runner: 'qwen', pipelineClass: 'QwenImageEditPipeline', editOnly: true });
+ });
+
it('honors an explicit ltx2 runtime override', () => {
expect(classifyHfMediaModel({
repo: 'dgrauet/ltx-2.3-mlx-q8',
diff --git a/server/lib/mediaModels.js b/server/lib/mediaModels.js
index afe386649c..53041ae707 100644
--- a/server/lib/mediaModels.js
+++ b/server/lib/mediaModels.js
@@ -725,14 +725,18 @@ const persistRegistry = (reg) => {
// truth + they round-trip through the shipped-defaults upgrade machinery).
export const isUserModelEntry = (entry) => entry?.source === 'user';
-// Locate a model entry by id across every list (video macos/windows + image),
-// returning `{ entry, list, listKey, idx }` or null. `listKey` ('macos' |
-// 'windows' | 'image') lets the mutators rebuild just the affected list
-// immutably (no deep clone of the whole registry).
+// Locate a model entry by id, returning `{ entry, list, listKey, idx }` or null.
+// Scans the CURRENT platform's video list + the image list — NOT the other
+// platform's video list. The other platform's rows aren't visible to
+// getVideoModels()/the render path on this install, and scanning both would
+// make patch/remove ambiguous when a shared media-models.json (macOS+Windows
+// peer) legitimately holds the same custom id in both platform lists — a
+// remove(id) meant for the Windows row would hit the macOS row first. `listKey`
+// ('macos' | 'windows' | 'image') lets the mutators rebuild just that list.
const findModelLocation = (reg, id) => {
+ const videoKey = IS_WIN ? 'windows' : 'macos';
const lists = [
- ['macos', reg.video?.macos],
- ['windows', reg.video?.windows],
+ [videoKey, reg.video?.[videoKey]],
['image', reg.image],
];
for (const [listKey, list] of lists) {
diff --git a/server/routes/imageVideoModels.js b/server/routes/imageVideoModels.js
index 65a7a7c963..dc4af9a175 100644
--- a/server/routes/imageVideoModels.js
+++ b/server/routes/imageVideoModels.js
@@ -17,6 +17,8 @@ import { z } from 'zod';
import { asyncHandler, ServerError } from '../lib/errorHandler.js';
import { PATHS, formatBytes, dirSize } from '../lib/fileUtils.js';
import {
+ getImageModels,
+ getVideoModels,
isUserModelEntry,
loadMediaModels,
patchUserModelEntry,
@@ -124,7 +126,6 @@ router.get('/', asyncHandler(async (_req, res) => {
// reports the model *catalog* (what can be picked), including entries whose
// weights aren't downloaded yet.
router.get('/registry', asyncHandler(async (_req, res) => {
- const reg = loadMediaModels();
const flatten = (list, kind) =>
(Array.isArray(list) ? list : []).map((m) => ({
id: m.id,
@@ -141,12 +142,14 @@ router.get('/registry', asyncHandler(async (_req, res) => {
source: m.source || null,
installedAt: m.installedAt || null,
}));
+ // Use the CURRENT platform's video list (getVideoModels) rather than
+ // flattening both macos+windows — that matches what's actually pickable here
+ // and avoids showing duplicate rows when a shared media-models.json holds the
+ // same custom id in both platform lists (macOS+Windows peer). Image entries
+ // are single-list.
res.json({
- video: [
- ...flatten(reg.video?.macos, 'video'),
- ...flatten(reg.video?.windows, 'video'),
- ],
- image: flatten(reg.image, 'image'),
+ video: flatten(getVideoModels(), 'video'),
+ image: flatten(getImageModels(), 'image'),
});
}));
diff --git a/server/routes/imageVideoModels.test.js b/server/routes/imageVideoModels.test.js
index f9cc3b7eb8..b2a179a902 100644
--- a/server/routes/imageVideoModels.test.js
+++ b/server/routes/imageVideoModels.test.js
@@ -6,19 +6,17 @@ import { errorMiddleware, ServerError } from '../lib/errorHandler.js';
// Stub the registry + install service — this suite verifies routing +
// validation + status-code mapping for the #2124 add/manage endpoints, not the
// live HuggingFace fetch or on-disk registry write.
+const VIDEO_LIST = [
+ { id: 'ltx23_distilled_q4', name: 'LTX-2.3 Q4', repo: 'notapalindrome/ltx23-mlx-av-q4', runtime: 'mlx_video', steps: 25, guidance: 3 },
+ { id: 'hf-mine', name: 'Mine', repo: 'me/mine', runtime: 'ltx2', steps: 8, guidance: 3, source: 'user' },
+];
+const IMAGE_LIST = [
+ { id: 'dev', name: 'Flux 1 Dev', runner: 'mflux', steps: 20, guidance: 3.5 },
+];
vi.mock('../lib/mediaModels.js', () => ({
- loadMediaModels: vi.fn(() => ({
- video: {
- macos: [
- { id: 'ltx23_distilled_q4', name: 'LTX-2.3 Q4', repo: 'notapalindrome/ltx23-mlx-av-q4', runtime: 'mlx_video', steps: 25, guidance: 3 },
- { id: 'hf-mine', name: 'Mine', repo: 'me/mine', runtime: 'ltx2', steps: 8, guidance: 3, source: 'user' },
- ],
- windows: [],
- },
- image: [
- { id: 'dev', name: 'Flux 1 Dev', runner: 'mflux', steps: 20, guidance: 3.5 },
- ],
- })),
+ loadMediaModels: vi.fn(() => ({ video: { macos: VIDEO_LIST, windows: [] }, image: IMAGE_LIST })),
+ getVideoModels: vi.fn(() => VIDEO_LIST),
+ getImageModels: vi.fn(() => IMAGE_LIST),
isUserModelEntry: (e) => e?.source === 'user',
patchUserModelEntry: vi.fn((id, patch) => ({ id, ...patch, source: 'user' })),
removeUserModelEntry: vi.fn((id) => ({ ok: true, id })),