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): 400 on unknown engine + audio venvs skip the mflux preamble

[._.]/ Adam Eivy4ee5e34eb2dc
diff --git a/scripts/setup-image-video.sh b/scripts/setup-image-video.sh
index 3a59ced129..dad2f629f2 100755
--- a/scripts/setup-image-video.sh
+++ b/scripts/setup-image-video.sh
@@ -52,15 +52,17 @@ mkdir -p "${PORTOS_DATA}/videos"
mkdir -p "${PORTOS_DATA}/video-thumbnails"
# When the user only wants a specific BYOV runtime (set via INSTALL_LTX2 /
-# INSTALL_WAN22 / INSTALL_HUNYUAN — typically from the in-app installer),
-# skip the mflux + legacy mlx_video preamble. Those bring-your-own-venv
-# runtimes are self-contained and don't depend on mflux; running the
-# preamble unprompted hits PEP 668 ("externally-managed-environment") on
-# Homebrew Python and aborts the whole script before the requested runtime
-# install ever starts. A bare `bash setup-image-video.sh` still installs
-# mflux as before.
-ANY_BYOV="${INSTALL_LTX2:-0}${INSTALL_WAN22:-0}${INSTALL_HUNYUAN:-0}"
-if [[ "$ANY_BYOV" == "000" ]]; then
+# INSTALL_WAN22 / INSTALL_HUNYUAN — or one of the self-contained MUSIC venvs
+# INSTALL_MUSICGEN / INSTALL_AUDIOLDM2 / INSTALL_ACESTEP — typically from the
+# in-app installer), skip the mflux + legacy mlx_video preamble. Those
+# bring-your-own-venv runtimes are self-contained and don't depend on mflux;
+# running the preamble unprompted hits PEP 668 ("externally-managed-environment")
+# on Homebrew Python and aborts the whole script before the requested runtime
+# install ever starts — which on Linux/CPU/CUDA blocks the advertised
+# `INSTALL_ACESTEP=1 bash …` path. A bare `bash setup-image-video.sh` still
+# installs mflux as before.
+ANY_BYOV="${INSTALL_LTX2:-0}${INSTALL_WAN22:-0}${INSTALL_HUNYUAN:-0}${INSTALL_MUSICGEN:-0}${INSTALL_AUDIOLDM2:-0}${INSTALL_ACESTEP:-0}"
+if [[ "$ANY_BYOV" == "000000" ]]; then
DEFAULT_INSTALL_MFLUX=1
DEFAULT_INSTALL_VIDEO=$(is_macos && echo 1 || echo 0)
DEFAULT_INSTALL_FLUX2=$(is_macos && echo 1 || echo 0)
diff --git a/server/routes/music.js b/server/routes/music.js
index af32b0ccc0..52e986496d 100644
--- a/server/routes/music.js
+++ b/server/routes/music.js
@@ -126,6 +126,13 @@ const generateSchema = z.object({
router.post('/generate', asyncHandler(async (req, res) => {
const body = validateRequest(generateSchema, req.body ?? {});
+ // Reject an unknown engine explicitly rather than letting getEngine() fall
+ // back to the default — a typo/stale client (`acestep-v2`) would otherwise
+ // burn a render producing the WRONG backend's output + metadata. An ABSENT
+ // engine is allowed (uses the default).
+ if (body.engine !== undefined && !ENGINES[body.engine]) {
+ throw new ServerError(`Unknown audio engine: ${body.engine}`, { status: 400, code: 'PIPELINE_MUSIC_UNKNOWN_ENGINE' });
+ }
const engine = getEngine(body.engine);
// Validate the target track BEFORE the (minutes-long) render so a stale/
diff --git a/server/routes/music.test.js b/server/routes/music.test.js
index 7eb77d5286..a261f931e2 100644
--- a/server/routes/music.test.js
+++ b/server/routes/music.test.js
@@ -215,6 +215,13 @@ describe('music routes', () => {
expect(tracks.createTrack).not.toHaveBeenCalled();
});
+ it('POST /generate rejects an unknown engine before rendering (no wrong-backend output)', async () => {
+ const r = await request(app).post('/api/music/generate').send({ prompt: 'x', engine: 'acestep-v2' });
+ expect(r.status).toBe(400);
+ expect(r.body.code).toBe('PIPELINE_MUSIC_UNKNOWN_ENGINE');
+ expect(gen.generateMusic).not.toHaveBeenCalled();
+ });
+
it('POST /generate rejects a missing prompt', async () => {
const r = await request(app).post('/api/music/generate').send({ engine: 'acestep' });
expect(r.status).toBe(400);