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 (gemini): hoist BYOV_VIDEO_RUNTIMES to module scope as shared export

[._.]/ Adam Eivy019865cb6b07
diff --git a/server/routes/videoGen.js b/server/routes/videoGen.js
index 66750c9ce8..ec023633df 100644
--- a/server/routes/videoGen.js
+++ b/server/routes/videoGen.js
@@ -21,6 +21,7 @@ import { checkPackages, isAllowedPython } from '../lib/pythonSetup.js';
import {
listVideoModels,
defaultVideoModelId,
+ BYOV_VIDEO_RUNTIMES,
loadHistory,
deleteHistoryItem,
setHistoryItemHidden,
@@ -218,9 +219,10 @@ router.post('/', frameImageUpload, asyncHandler(async (req, res) => {
// inside buildArgs), so they must NOT be blocked by the legacy mlx_video
// pythonPath setting. Without this gate, the queue would happily accept
// a job that's known to fail and only surface it asynchronously on SSE,
- // polluting the persisted queue with a doomed entry.
- const BYOV_RUNTIMES = new Set(['ltx2', 'wan22', 'hunyuan']);
- const runtimeBringsOwnVenv = effectiveModel && BYOV_RUNTIMES.has(effectiveModel.runtime);
+ // polluting the persisted queue with a doomed entry. The allowlist is
+ // shared with services/videoGen/local.js so the route and worker stay
+ // in sync.
+ const runtimeBringsOwnVenv = effectiveModel && BYOV_VIDEO_RUNTIMES.has(effectiveModel.runtime);
if (!pythonPath && !runtimeBringsOwnVenv) {
await cleanupTempUploads();
throw new ServerError(
diff --git a/server/routes/videoGen.test.js b/server/routes/videoGen.test.js
index 4cb15fc461..e196e04252 100644
--- a/server/routes/videoGen.test.js
+++ b/server/routes/videoGen.test.js
@@ -29,6 +29,11 @@ vi.mock('../services/videoGen/local.js', () => ({
// Mirrors the real export — keeps the route's keyframe-range check in
// sync with whatever the service actually defaults to.
DEFAULT_NUM_FRAMES: 121,
+ // The route gates pythonPath enforcement on this allowlist (ltx2/wan22/
+ // hunyuan bring their own venv). Mirror the real export so the
+ // "accepts BYOV-runtime when pythonPath missing" case passes and the
+ // negative case (legacy mlx_video model) still 400s.
+ BYOV_VIDEO_RUNTIMES: new Set(['ltx2', 'wan22', 'hunyuan']),
}));
// Render submissions go through the mediaJobQueue. Mock its surface so the
diff --git a/server/services/videoGen/local.js b/server/services/videoGen/local.js
index 73c2a664ef..8985469285 100644
--- a/server/services/videoGen/local.js
+++ b/server/services/videoGen/local.js
@@ -57,6 +57,14 @@ const IS_WIN = process.platform === 'win32';
// Cached as a plain object at boot for O(1) lookup by id, matching the prior shape.
export const VIDEO_MODELS = Object.fromEntries(getVideoModels().map((m) => [m.id, m]));
+// "Bring-your-own-venv" video runtimes — runtimes that resolve their own
+// Python interpreter inside buildArgs (LTX2_VENV_PYTHON / WAN22_VENV_PYTHON
+// / HUNYUAN_VENV_PYTHON), so the legacy mlx_video `settings.imageGen.local.
+// pythonPath` is irrelevant. Used by BOTH services/videoGen/local.js and
+// routes/videoGen.js to decide when to enforce the pythonPath gate — keep
+// the two in sync via this single export.
+export const BYOV_VIDEO_RUNTIMES = Object.freeze(new Set(['ltx2', 'wan22', 'hunyuan']));
+
export const listVideoModels = () => getVideoModels();
export const defaultVideoModelId = () => getDefaultVideoModelId();
@@ -418,9 +426,8 @@ export async function generateVideo({ pythonPath, prompt, negativePrompt = '', m
// actually uses it. ltx2/wan22/hunyuan resolve their own venv path inside
// buildArgs — gating them on the unrelated mlx_video setting locks users
// out of the runtimes they just installed via INSTALL_WAN22 / INSTALL_LTX2
- // / INSTALL_HUNYUAN. Routes/videoGen.js mirrors this allowlist.
- const BYOV_RUNTIMES = new Set(['ltx2', 'wan22', 'hunyuan']);
- if (!pythonPath && !BYOV_RUNTIMES.has(model.runtime)) {
+ // / INSTALL_HUNYUAN. Routes/videoGen.js reads the same module-level set.
+ if (!pythonPath && !BYOV_VIDEO_RUNTIMES.has(model.runtime)) {
throw new ServerError('Python path not configured — set it in Settings > Image Gen', { status: 400, code: 'VIDEO_GEN_NOT_CONFIGURED' });
}
// macOS/mlx_video requires a HuggingFace repo id — Windows doesn't (the