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 (agy): honor a model-only video pin on the planner path

[._.]/ Adam Eivyc25fb76754bc
diff --git a/server/services/creative/tools/media.test.js b/server/services/creative/tools/media.test.js
index e25917e702..b955072926 100644
--- a/server/services/creative/tools/media.test.js
+++ b/server/services/creative/tools/media.test.js
@@ -241,6 +241,25 @@ describe('render-backend pin — video (#3135)', () => {
expect(enqueued().params.modelId).toBe('pinned-video-model');
});
+ it('applies a model-only pin that names no backend', async () => {
+ // The scene path reads the model pin unconditionally, so dropping it here
+ // (via the no-pin early return) would make the two surfaces render the
+ // same commission with different models.
+ getSettings.mockResolvedValue({ imageGen: {} });
+ getProject.mockResolvedValue(projectWithPin({ video: { modelId: 'pinned-video-model' } }));
+ await run('media_enqueueVideoJob', { prompt: 'p' }, { projectId: 'cd-1' });
+ expect(enqueued().params).toEqual({ prompt: 'p', modelId: 'pinned-video-model' });
+ });
+
+ it('still passes params through untouched when nothing at all is pinned', async () => {
+ // The byte-identical contract: broadening `pinned` to cover a model-only
+ // pin must not start perturbing jobs for an unconfigured install.
+ getSettings.mockResolvedValue({ imageGen: {} });
+ getProject.mockResolvedValue({ id: 'cd-1' });
+ await run('media_enqueueVideoJob', { prompt: 'p', durationSeconds: 8 }, { projectId: 'cd-1' });
+ expect(enqueued().params).toEqual({ prompt: 'p', durationSeconds: 8 });
+ });
+
describe('grok clip length crosses a contract boundary', () => {
// The local lane derives frames from `durationSeconds`; grok's worker reads
// `duration` and silently falls back to 6s for anything absent. Without the
diff --git a/server/services/videoGen/backendPin.js b/server/services/videoGen/backendPin.js
index 581c7325d2..2c9e491925 100644
--- a/server/services/videoGen/backendPin.js
+++ b/server/services/videoGen/backendPin.js
@@ -60,17 +60,26 @@ export function resolveVideoBackendPin(project, settings, { target = RENDER_TARG
// passthrough. Commissions never persist `auto` (buildRenderBackendPin drops
// it), but a hand-made or peer-synced project can carry the sentinel.
const mode = normalizeRenderPinValue(raw?.mode);
- const modelId = normalizeRenderPinValue(raw?.modelId);
const targetDefaults = renderTargetDefaults(settings, target);
+ const modelId = normalizeRenderPinValue(raw?.modelId) || targetDefaults.videoModel || null;
return {
- pinned: !!mode || hasVideoPin(settings, { target }),
+ // A model pin counts as a pin even with no mode beside it. Naming a local
+ // video model IS a configured choice, and the resolved mode for an
+ // otherwise-unpinned lane is LOCAL — the one backend that consumes a model
+ // id — so there is always something for it to apply to. Gating `pinned` on
+ // the mode alone made the two surfaces disagree: the scene path reads
+ // `modelId` unconditionally and would honor it, while the planner path
+ // takes its byte-identical early return and drops it. Nothing configured
+ // still yields `pinned: false`, so the auto-is-byte-identical contract is
+ // intact — the only jobs that change are ones the user asked to change.
+ pinned: !!mode || !!modelId || hasVideoPin(settings, { target }),
// What the project ASKED for, normalized — null when it pinned nothing.
// Distinct from `mode` (what it GOT): when the two disagree, the ladder
// degraded an unusable pin, and only the caller has the context to decide
// whether that's worth reporting.
requested: mode,
mode: resolveVideoMode(mode, settings, { target }),
- modelId: modelId || targetDefaults.videoModel || null,
+ modelId,
};
}
diff --git a/server/services/videoGen/backendPin.test.js b/server/services/videoGen/backendPin.test.js
index 75007bbe9c..797ec5e021 100644
--- a/server/services/videoGen/backendPin.test.js
+++ b/server/services/videoGen/backendPin.test.js
@@ -35,6 +35,26 @@ describe('resolveVideoBackendPin', () => {
expect(resolveVideoBackendPin(project({ mode: 'auto' }), grokOff).requested).toBe(null);
});
+ it('counts a model-only pin as pinned so the planner path cannot drop it', () => {
+ // Both surfaces must agree: the scene path reads modelId unconditionally,
+ // so if `pinned` were false here the planner path's byte-identical early
+ // return would silently discard a model the user explicitly chose.
+ const pin = resolveVideoBackendPin(project({ modelId: 'ltx-13b' }), grokOn);
+ expect(pin.pinned).toBe(true);
+ expect(pin.mode).toBe(VIDEO_GEN_MODE.LOCAL);
+ expect(pin.modelId).toBe('ltx-13b');
+ });
+
+ it('counts a model-only render-target default as pinned', () => {
+ const settings = {
+ ...grokOn,
+ renderDefaults: { [RENDER_TARGET.CREATIVE_AGENT]: { videoModel: 'target-model' } },
+ };
+ expect(resolveVideoBackendPin(project(null), settings)).toEqual({
+ pinned: true, requested: null, mode: VIDEO_GEN_MODE.LOCAL, modelId: 'target-model',
+ });
+ });
+
it('degrades a grok pin to local when grok is not enabled', () => {
// A nightly commission must still produce something rather than failing
// every fire because the user flipped the toggle off after pinning.