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 (claude): refuse wan/hunyuan even under runtime override; silence double toast

[._.]/ Adam Eivyd7f3cbb7a704
diff --git a/client/src/pages/MediaModels.jsx b/client/src/pages/MediaModels.jsx
index b66b80b2d0..5fbd821c65 100644
--- a/client/src/pages/MediaModels.jsx
+++ b/client/src/pages/MediaModels.jsx
@@ -113,7 +113,7 @@ export default function MediaModels() {
steps: Number(editFields.steps),
guidance: Number(editFields.guidance),
};
- await patchCustomMediaModel(id, patch)
+ await patchCustomMediaModel(id, patch, { silent: true })
.then((updated) => {
toast.success('Model updated');
setEditId(null);
@@ -128,7 +128,7 @@ export default function MediaModels() {
const handleRemoveCustom = async (id) => {
setBusy(id);
- await removeCustomMediaModel(id)
+ await removeCustomMediaModel(id, { silent: true })
.then(() => {
toast.success('Custom model removed');
setRegistry((r) => ({
diff --git a/client/src/services/apiImageVideo.js b/client/src/services/apiImageVideo.js
index 0d9e00cad6..8d4e172015 100644
--- a/client/src/services/apiImageVideo.js
+++ b/client/src/services/apiImageVideo.js
@@ -298,15 +298,18 @@ export const addMediaModelFromHf = ({ url, kind, runtime, runner, name, steps, g
};
// Edit a user-added model's name/steps/guidance. Built-ins return 403.
-export const patchCustomMediaModel = (id, patch) => request(`/image-video/models/custom/${encodeURIComponent(id)}`, {
+// `silent` lets a caller with its own error toast suppress the apiCore toast.
+export const patchCustomMediaModel = (id, patch, { silent = false } = {}) => request(`/image-video/models/custom/${encodeURIComponent(id)}`, {
method: 'PATCH',
body: JSON.stringify(patch),
+ silent,
});
// Remove a user-added model entry (weights stay in the HF cache). Built-ins
-// return 403; unknown ids 404.
-export const removeCustomMediaModel = (id) => request(`/image-video/models/custom/${encodeURIComponent(id)}`, {
+// return 403; unknown ids 404. `silent` as above.
+export const removeCustomMediaModel = (id, { silent = false } = {}) => request(`/image-video/models/custom/${encodeURIComponent(id)}`, {
method: 'DELETE',
+ silent,
});
// LoRA manager — Civitai-aware list/install/patch/delete. Reads sidecar
diff --git a/server/lib/huggingfaceModel.js b/server/lib/huggingfaceModel.js
index d689ea47be..938c754eac 100644
--- a/server/lib/huggingfaceModel.js
+++ b/server/lib/huggingfaceModel.js
@@ -214,17 +214,22 @@ export const classifyHfMediaModel = ({ repo, model, kind, runtime, runner } = {}
}
if (resolvedKind === 'video') {
- // Explicit override wins (already allowlist-validated). Otherwise use the
- // detected runtime — and if that detected runtime isn't addable (wan22 /
- // hunyuan need a BYO venv), refuse with the install hint. A repo with no
- // video marker at all defaults to mlx_video (the safetensors/MLX default).
- if (runtime) return { kind: 'video', runtime, format: 'safetensors' };
+ // Refuse a repo whose DETECTED runtime isn't addable (wan22 / hunyuan need
+ // a BYO venv) BEFORE honoring any override — the "a bad add can't wedge the
+ // picker" guarantee must hold even when the caller forces
+ // `runtime: 'mlx_video'` on a HunyuanVideo repo (the entry would register
+ // but the runtime couldn't load it). The override only picks between the
+ // *addable* runtimes; it can't launder a known-unsupported repo through.
if (detectedVideo && !ADDABLE_VIDEO_RUNTIMES.includes(detectedVideo.runtime)) {
throw new ServerError(
`HuggingFace repo "${repo}" targets the "${detectedVideo.runtime}" runtime, which needs a dedicated venv (${detectedVideo.installHint}) and can't be added self-service — set it up via the script, then edit data/media-models.json.`,
{ 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).
+ if (runtime) return { kind: 'video', runtime, format: 'safetensors' };
return { kind: 'video', runtime: detectedVideo?.runtime || 'mlx_video', format: 'safetensors' };
}
diff --git a/server/lib/huggingfaceModel.test.js b/server/lib/huggingfaceModel.test.js
index 53f8787efe..484cad147a 100644
--- a/server/lib/huggingfaceModel.test.js
+++ b/server/lib/huggingfaceModel.test.js
@@ -53,6 +53,18 @@ describe('classifyHfMediaModel — strict refusal', () => {
})).toThrow(/Hunyuan/);
});
+ it('refuses a wan/hunyuan repo even when an addable runtime is forced (no override-laundering)', () => {
+ // The "a bad add can't wedge the picker" guarantee must hold even under an
+ // explicit runtime override — forcing mlx_video on a Hunyuan repo would
+ // register an entry no runtime can load.
+ expect(() => classifyHfMediaModel({
+ repo: 'tencent/HunyuanVideo',
+ model: hf({ files: ['model.safetensors'], tags: ['hunyuan'] }),
+ kind: 'video',
+ runtime: 'mlx_video',
+ })).toThrow(/needs a dedicated venv/);
+ });
+
it('refuses an unclassifiable safetensors repo with no kind hint', () => {
expect(() => classifyHfMediaModel({
repo: 'someone/mystery-weights',