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
address review (codex): refuse undetected video repos, stamp flux2 quantization:none
[._.]/ Adam Eivyc427c0b8685c
diff --git a/server/lib/huggingfaceModel.js b/server/lib/huggingfaceModel.jsindex 6ba681f67c..bda3dfee69 100644--- a/server/lib/huggingfaceModel.js+++ b/server/lib/huggingfaceModel.js@@ -235,11 +235,20 @@ export const classifyHfMediaModel = ({ repo, model, kind, runtime, runner } = {}{ status: 422, code: 'HF_UNSUPPORTED_RUNTIME' },);}- // Explicit override wins (already allowlist-validated). Otherwise use the- // detected runtime; a repo with no video marker at all defaults to- // mlx_video (the safetensors/MLX default).+ // Explicit override wins (already allowlist-validated).if (runtime) return { kind: 'video', runtime, format: 'safetensors' };- return { kind: 'video', runtime: detectedVideo?.runtime || 'mlx_video', format: 'safetensors' };+ // Otherwise require a POSITIVELY-detected addable runtime. A repo that only+ // looks like video via its pipeline_tag (no LTX/Wan/Hunyuan marker) must NOT+ // default to mlx_video — that runtime only loads the LTX family, so the+ // entry would register but 400 at render. Refuse and ask for an explicit+ // runtime, keeping the "a bad add can't wedge the picker" guarantee.+ if (!detectedVideo) {+ throw new ServerError(+ `Couldn't determine which video runtime loads "${repo}" — only LTX-family repos are auto-detected. Pass an explicit runtime (one of ${ADDABLE_VIDEO_RUNTIMES.join(', ')}) if you know it loads on one of them.`,+ { status: 422, code: 'HF_UNKNOWN_RUNTIME' },+ );+ }+ return { kind: 'video', runtime: detectedVideo.runtime, format: 'safetensors' };}const resolvedRunner = runner || imageRunner;@@ -298,7 +307,18 @@ export const buildCustomModelEntry = ({ repo, model, classification, name, stepssource: 'user',installedAt: new Date().toISOString(),};- if (classification.kind === 'video') entry.runtime = classification.runtime;- else entry.runner = classification.runner;+ if (classification.kind === 'video') {+ entry.runtime = classification.runtime;+ } else {+ entry.runner = classification.runner;+ // flux2 defaults missing `quantization` to 'sdnq', which then REQUIRES a+ // `tokenizerRepo` (the gated base repo) — a self-service add has neither, so+ // without this the entry registers but every render 400s with+ // IMAGE_GEN_FLUX2_MISCONFIGURED. A plain HF repo added here is treated as an+ // unquantized base (`none`): the runner loads `repo` directly, no tokenizer+ // sidecar needed. A user who added a quantized community repo can edit the+ // JSON to set sdnq/int8 + the required sibling repo.+ if (classification.runner === RUNNER_FAMILIES.FLUX2) entry.quantization = 'none';+ }return entry;};diff --git a/server/lib/huggingfaceModel.test.js b/server/lib/huggingfaceModel.test.jsindex b672328605..dae80f8f15 100644--- a/server/lib/huggingfaceModel.test.js+++ b/server/lib/huggingfaceModel.test.js@@ -137,6 +137,23 @@ describe('classifyHfMediaModel — happy paths', () => {runner: 'mflux',})).toThrow(/Unknown image runner|mflux/);});++ it('refuses a text-to-video repo with no detected runtime (would 400 at render on mlx_video)', () => {+ // pipeline_tag says video but no LTX/Wan/Hunyuan marker — mlx_video only+ // loads LTX, so defaulting to it would register an un-renderable entry.+ expect(() => classifyHfMediaModel({+ repo: 'someone/mystery-video',+ model: hf({ files: ['model.safetensors'], pipeline: 'text-to-video' }),+ })).toThrow(/Couldn't determine which video runtime/);+ });++ it('accepts an undetected video repo when an explicit runtime is supplied', () => {+ expect(classifyHfMediaModel({+ repo: 'someone/mystery-video',+ model: hf({ files: ['model.safetensors'], pipeline: 'text-to-video' }),+ runtime: 'mlx_video',+ })).toEqual({ kind: 'video', runtime: 'mlx_video', format: 'safetensors' });+ });});describe('customModelIdFromRepo', () => {@@ -176,6 +193,16 @@ describe('buildCustomModelEntry', () => {});expect(entry).toMatchObject({ runner: 'qwen', name: 'My Qwen', steps: 40, guidance: 5, source: 'user' });expect(entry.runtime).toBeUndefined();+ expect(entry.quantization).toBeUndefined(); // only flux2 needs it+ });++ it('stamps quantization:none on a flux2 entry so the runner uses repo directly (no tokenizerRepo 400)', () => {+ const entry = buildCustomModelEntry({+ repo: 'black-forest-labs/FLUX.2-klein-9B',+ model: hf({}),+ classification: { kind: 'image', runner: 'flux2', format: 'safetensors' },+ });+ expect(entry).toMatchObject({ runner: 'flux2', quantization: 'none', source: 'user' });});});