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 custom video-model adds on Windows
[._.]/ Adam Eivyee8248986f4e
diff --git a/server/lib/huggingfaceModel.js b/server/lib/huggingfaceModel.jsindex d00af6d517..ebb3c0559e 100644--- a/server/lib/huggingfaceModel.js+++ b/server/lib/huggingfaceModel.js@@ -232,13 +232,17 @@ const isImagePipelineTag = (model) =>* @param {'image'|'video'} [args.kind] - explicit kind override* @param {string} [args.runtime] - explicit video runtime override* @param {string} [args.runner] - explicit image runner override+ * @param {boolean} [args.isWindows] - target platform is Windows (defaults+ * to the host). Windows can't self-service-add VIDEO models — its render path+ * (generate_win.py) hardcodes its LTX repo and the mlx_video/ltx2 runtimes are+ * POSIX-only, so a custom video repo would render wrong weights or fail.* @returns {{ kind, runtime?, runner?, format:'safetensors' }}* Throws ServerError (HF_UNSUPPORTED_FORMAT / HF_NO_SAFETENSORS /* HF_UNSUPPORTED_RUNTIME / HF_UNKNOWN_KIND / HF_UNKNOWN_RUNNER /- * HF_BAD_KIND / HF_BAD_RUNTIME / HF_BAD_RUNNER) on anything unloadable or- * unclassifiable.+ * HF_BAD_KIND / HF_BAD_RUNTIME / HF_BAD_RUNNER / HF_VIDEO_WINDOWS_UNSUPPORTED)+ * on anything unloadable or unclassifiable.*/-export const classifyHfMediaModel = ({ repo, model, kind, runtime, runner } = {}) => {+export const classifyHfMediaModel = ({ repo, model, kind, runtime, runner, isWindows = process.platform === 'win32' } = {}) => {assertLoadableFormat({ repo, model });assertNotLora({ repo, model });const blob = classificationBlob({ repo, model });@@ -292,6 +296,17 @@ export const classifyHfMediaModel = ({ repo, model, kind, runtime, runner } = {}}if (resolvedKind === 'video') {+ // Windows can't self-service-add a custom VIDEO model: generate_win.py+ // hardcodes its LTX-Video repo (ignores the entry's `repo`) and the+ // mlx_video/ltx2 runtimes resolve POSIX-only venv paths — so a Windows add+ // would render the built-in weights or fail. Refuse up front. (Image adds+ // run through the cross-platform diffusers venv and stay allowed.)+ if (isWindows) {+ throw new ServerError(+ `Custom video models can't be added on Windows — the Windows video runtime loads a fixed built-in model and can't use a custom HuggingFace repo. Adding custom image models is supported.`,+ { status: 422, code: 'HF_VIDEO_WINDOWS_UNSUPPORTED' },+ );+ }// Explicit override wins (already allowlist-validated).if (runtime) return { kind: 'video', runtime, format: 'safetensors' };// Otherwise require a POSITIVELY-detected addable runtime. A repo that onlydiff --git a/server/lib/huggingfaceModel.test.js b/server/lib/huggingfaceModel.test.jsindex 06e11cdf02..5997feb7db 100644--- a/server/lib/huggingfaceModel.test.js+++ b/server/lib/huggingfaceModel.test.js@@ -157,6 +157,22 @@ describe('classifyHfMediaModel — happy paths', () => {})).toEqual({ kind: 'image', runner: 'qwen', format: 'safetensors' });});+ it('refuses a custom video add on Windows (render path can not load a custom repo)', () => {+ expect(() => classifyHfMediaModel({+ repo: 'notapalindrome/ltx23-mlx-av-q4',+ model: hf({ files: ['model.safetensors'], tags: ['ltx-video'] }),+ isWindows: true,+ })).toThrow(/can't be added on Windows/);+ });++ it('still allows a custom IMAGE add on Windows (cross-platform diffusers venv)', () => {+ expect(classifyHfMediaModel({+ repo: 'Qwen/Qwen-Image',+ model: hf({ files: ['model.safetensors'], pipeline: 'text-to-image' }),+ isWindows: true,+ })).toMatchObject({ kind: 'image', runner: 'qwen' });+ });+it('rejects an invalid explicit runtime', () => {expect(() => classifyHfMediaModel({repo: 'x/y',diff --git a/server/services/mediaModelInstall.js b/server/services/mediaModelInstall.jsindex 99ec838517..978a38702f 100644--- a/server/services/mediaModelInstall.js+++ b/server/services/mediaModelInstall.js@@ -60,6 +60,9 @@ export const addModelFromHuggingface = async (input, { fetchImpl = fetch } = {})kind: input?.kind,runtime: input?.runtime,runner: input?.runner,+ // Defaults to the host platform; Windows refuses video adds (its render+ // path can't load a custom repo).+ isWindows: process.platform === 'win32',});const entry = buildCustomModelEntry({