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 round 2): judge the video trigger hint on the enveloped prompt

[._.]/ Adam Eivyf7d4f246f679
diff --git a/client/src/components/imageGen/LoraPicker.test.jsx b/client/src/components/imageGen/LoraPicker.test.jsx
index 13f34c7fac..9e29b5650a 100644
--- a/client/src/components/imageGen/LoraPicker.test.jsx
+++ b/client/src/components/imageGen/LoraPicker.test.jsx
@@ -81,8 +81,9 @@ describe('LoraPicker trigger-word hint (#4665)', () => {
});
it('stays silent when the host did not opt in by passing a prompt', () => {
- // e.g. the pipeline drawers, whose renders weave their own trigger clause
- // and opt out server-side — a hint there would be a lie.
+ // e.g. the pipeline/queue drawers, which have no single prompt textarea to
+ // judge against. Defaulting the hint ON there would flag every selected LoRA
+ // unconditionally, since an empty prompt contains no trigger word.
renderPicker({ ...base, selected: SELECTED });
expect(hint()).toBeNull();
});
diff --git a/client/src/hooks/useVideoGenForm.js b/client/src/hooks/useVideoGenForm.js
index 11d83e0ac9..825ddb022e 100644
--- a/client/src/hooks/useVideoGenForm.js
+++ b/client/src/hooks/useVideoGenForm.js
@@ -1220,25 +1220,31 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
// inline Generate button and by enqueue, so the two paths stay in lockstep.
const isGrok = grokEnabled && backend === 'grok';
+ // A hidden mute checkbox from a prior model must not suppress H3's visible
+ // prompt-audio steering. Treat mute as effective only on a model that can
+ // actually disable its generated audio track.
+ const effectiveDisableAudio = supportsVideoAudioControls(currentModel) && disableAudio;
+ // The style preset and the no-music constraint are ENVELOPE, not content —
+ // they have to wrap a per-chunk beat exactly as they wrap the main prompt.
+ // Shipping a beat raw would render the chunks the user steered in a
+ // different style (and with the soundtrack they disabled) than the chunks
+ // that fall back to the main prompt — a visible change at every seam, which
+ // is the artifact chaining exists to avoid.
+ // Idempotent on "no music": if the text already says it, don't double-append.
+ //
+ // Hoisted out of buildGeneratePayload so the LoRA picker's trigger-word hint
+ // (#4665) can be judged against the EXACT text the render will receive. The
+ // server weaves against the enveloped prompt; a hint reading the raw textarea
+ // would contradict it whenever the envelope already supplies the token.
+ const withEnvelope = (text) => {
+ const c = composeStyledPrompt(text, negativePrompt, stylePreset);
+ return (supportsVideoAudioPromptControls(currentModel) && noMusic && !effectiveDisableAudio && !/no music/i.test(c.prompt))
+ ? `${c.prompt}\n\nno music, no soundtrack`
+ : c.prompt;
+ };
+
const buildGeneratePayload = () => {
const composed = composeStyledPrompt(prompt, negativePrompt, stylePreset);
- // A hidden mute checkbox from a prior model must not suppress H3's visible
- // prompt-audio steering. Treat mute as effective only on a model that can
- // actually disable its generated audio track.
- const effectiveDisableAudio = supportsVideoAudioControls(currentModel) && disableAudio;
- // The style preset and the no-music constraint are ENVELOPE, not content —
- // they have to wrap a per-chunk beat exactly as they wrap the main prompt.
- // Shipping a beat raw would render the chunks the user steered in a
- // different style (and with the soundtrack they disabled) than the chunks
- // that fall back to the main prompt — a visible change at every seam, which
- // is the artifact chaining exists to avoid.
- // Idempotent on "no music": if the text already says it, don't double-append.
- const withEnvelope = (text) => {
- const c = composeStyledPrompt(text, negativePrompt, stylePreset);
- return (supportsVideoAudioPromptControls(currentModel) && noMusic && !effectiveDisableAudio && !/no music/i.test(c.prompt))
- ? `${c.prompt}\n\nno music, no soundtrack`
- : c.prompt;
- };
// Beats for the LIVE chunks only — the backing array is never truncated on
// a chunk-count change, so slicing here is what keeps a stale tail off the
// wire. A short list is fine: the server falls back to the main prompt for
@@ -1363,6 +1369,10 @@ export function useVideoGenForm({ models, status, availableLoras, grokEnabled })
mode, handleModeChange,
// Prompt + style
prompt, setPrompt,
+ // The exact prompt a render would be submitted with right now (style preset
+ // + no-music envelope). The LoRA picker's #4665 trigger hint reads THIS, not
+ // the raw textarea, so it can never disagree with the server-side weave.
+ envelopedPrompt: withEnvelope(prompt),
negativePrompt, setNegativePrompt,
stylePreset, setStylePreset,
remixModelFallback,
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsx
index 841e4a2fc3..03cb68c8c5 100644
--- a/client/src/pages/VideoGen.jsx
+++ b/client/src/pages/VideoGen.jsx
@@ -38,7 +38,6 @@
import { useState, useEffect, useRef, useCallback, useMemo } from 'react';
import { useSearchParams } from 'react-router';
import { isMiniMaxH3Runtime, isLtx2FamilyRuntime } from '../lib/runnerFamilies';
-import { composeStyledPrompt } from '../lib/composeStyledPrompt';
import Drawer from '../components/Drawer';
import { ImageGenTab } from '../components/settings/ImageGenTab';
import LocalSetupPanel from '../components/settings/LocalSetupPanel';
@@ -145,7 +144,7 @@ export default function VideoGen() {
const {
backend, isGrok, handleBackendChange, grokDuration, setGrokDuration,
mode, handleModeChange,
- prompt, setPrompt, negativePrompt, setNegativePrompt, stylePreset, setStylePreset, remixModelFallback,
+ prompt, setPrompt, envelopedPrompt, negativePrompt, setNegativePrompt, stylePreset, setStylePreset, remixModelFallback,
modelId, handleModelChange, currentModel, visibleModels,
loraFamily, videoLoras, loraUnavailableHint,
selectedLoras, setSelectedLoras,
@@ -1194,10 +1193,10 @@ export default function VideoGen() {
const add = triggers.join(', ');
return p && p.trim() ? `${p}, ${add}` : add;
})}
- // The STYLED prompt, not the raw one — buildGeneratePayload's
- // envelope prefixes the style preset, so that is what the server
- // weaves against and what the hint must be judged on.
- prompt={composeStyledPrompt(prompt, negativePrompt, stylePreset).prompt}
+ // The ENVELOPED prompt (style preset + no-music suffix), not the
+ // raw textarea — that is the exact text the server weaves against,
+ // so the hint can never claim an append that will not happen.
+ prompt={envelopedPrompt}
disabled={generating}
/>
</div>