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

fix: keep Music Video render pins local (#3245)

[._.]/ Adam Eivyc27bd256707f
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 8bba3b1f28..5a4efdbe6b 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -1,5 +1,9 @@
# Unreleased Changes
+## Music Video
+
+- **[issue-3245] Synced Music Video projects now use each machine's own render backends.** Image and video backend pins no longer cross federation boundaries or overwrite a peer's locally usable choices, while shared model and pacing settings continue to sync.
+
## POST
- **[issue-3252] A new Practice Plan page decides what you're actually studying.** POST had grown to roughly thirty drill types across six subjects plus three standalone study surfaces, with no single place to say which of them you want. Practice Plan (`/post/plan`, also reachable from ⌘K and by voice) lists every topic with a switch, expandable to its individual drills, and shows a live "your daily POST will include…" summary that updates as you flip switches — so you can see what tomorrow's session becomes before you run it. Drill Config still owns how hard each drill is; Practice Plan owns what's in the rotation.
diff --git a/server/lib/syncWire.js b/server/lib/syncWire.js
index c13366b797..1a903e1256 100644
--- a/server/lib/syncWire.js
+++ b/server/lib/syncWire.js
@@ -178,7 +178,6 @@ export function sanitizeRecordForWire(kind, record) {
case 'moodBoard':
case 'writersRoomFolder':
case 'writersRoomExercise':
- case 'musicVideoProject':
case 'commissionFeedback': {
// Persona/music/creative-director/mood-board records: like mediaCollection,
// no `ephemeral` flag — always wire-syncable when present. Strip-then-tail-
@@ -190,14 +189,32 @@ export function sanitizeRecordForWire(kind, record) {
// record LWW contract; a moodBoard (name/description/items) is the same.
// Writers Room folders + exercises (#1645) are also body-less whole-record
// LWW kinds with no ephemeral counters — they wire identically (no liveMode
- // strip like writersRoomWork below). A musicVideoProject (#1770:
- // metadata + beat-aligned scenes[]) is the same whole-record LWW contract.
// A commissionFeedback (#2686: one reaction — commissionId/runId/rating/
// note/tags/at) is a body-less whole-record LWW record with no local-only
// fields to strip, so it rides this same group.
const { deleted: _d, deletedAt: _da, ...rest } = record;
return { ...rest, ...sanitizeSoftDeleteFields(record) };
}
+ case 'musicVideoProject': {
+ // Music Video projects are whole-record LWW, but their image render pin
+ // and video backend are install-capability choices: a peer may not have
+ // the selected provider configured. Keep those fields wire-local while
+ // preserving the rest of videoSettings (model, pacing, generation mode).
+ // Stripping also keeps the wire/hash form byte-stable with peers from
+ // before these fields shipped, so no schema-version gate is required.
+ const {
+ deleted: _d,
+ deletedAt: _da,
+ imageMode: _imageMode,
+ imageModelId: _imageModelId,
+ ...rest
+ } = record;
+ if (rest.videoSettings && typeof rest.videoSettings === 'object' && !Array.isArray(rest.videoSettings)) {
+ const { backend: _backend, ...sharedVideoSettings } = rest.videoSettings;
+ rest.videoSettings = sharedVideoSettings;
+ }
+ return { ...rest, ...sanitizeSoftDeleteFields(record) };
+ }
case 'writersRoomWork': {
// A writersRoomWork is the manifest + decomposed draft-version METADATA in
// drafts[] (the .md prose bodies ride a separate body manifest). Whole-record
diff --git a/server/lib/syncWire.test.js b/server/lib/syncWire.test.js
index c6f0ee69d7..3598cd6a2a 100644
--- a/server/lib/syncWire.test.js
+++ b/server/lib/syncWire.test.js
@@ -201,6 +201,35 @@ describe('syncWire', () => {
expect(series.styleImageRefs).toEqual(['x.png']);
});
+ it('strips Music Video render pins byte-for-byte against a pre-field peer (#3245)', () => {
+ const withPins = sanitizeRecordForWire('musicVideoProject', {
+ id: 'mv-1',
+ name: 'Example Video',
+ imageMode: 'grok',
+ imageModelId: 'example-image-model',
+ videoSettings: {
+ backend: 'grok',
+ modelId: 'example-video-model',
+ grokDuration: 10,
+ generationMode: 'image',
+ },
+ });
+ const preField = sanitizeRecordForWire('musicVideoProject', {
+ id: 'mv-1',
+ name: 'Example Video',
+ videoSettings: {
+ modelId: 'example-video-model',
+ grokDuration: 10,
+ generationMode: 'image',
+ },
+ });
+
+ expect(withPins.imageMode).toBeUndefined();
+ expect(withPins.imageModelId).toBeUndefined();
+ expect(withPins.videoSettings.backend).toBeUndefined();
+ expect(JSON.stringify(withPins)).toBe(JSON.stringify(preField));
+ });
+
describe('author kind', () => {
it('passes through an author with canonical tail soft-delete fields', () => {
const a = { id: 'auth-1', name: 'Ada', bio: 'b' };
diff --git a/server/services/musicVideo/projectsLogic.js b/server/services/musicVideo/projectsLogic.js
index a79c8c56f9..80a05f58a4 100644
--- a/server/services/musicVideo/projectsLogic.js
+++ b/server/services/musicVideo/projectsLogic.js
@@ -351,9 +351,23 @@ export function sanitizeProjectForSync(raw) {
* `updatedAt`, so a tombstone beats an older live copy and can't be resurrected.
*/
export function mergeProjectRecord(local, remoteRaw) {
- const remote = sanitizeProjectForSync(remoteRaw);
+ let remote = sanitizeProjectForSync(remoteRaw);
if (!remote) return { next: null, inserted: false, remoteWins: false, changed: false };
if (!local) return { next: remote, inserted: true, remoteWins: true, changed: true };
+ // Render pins are install-capability choices and therefore wire-local
+ // (#3245). sanitizeRecordForWire omits them from peer payloads; restore this
+ // machine's values before a newer remote record wholesale-replaces local.
+ // Key-presence checks preserve an intentional local empty/null value instead
+ // of confusing it with a missing field.
+ remote = { ...remote };
+ if (Object.hasOwn(local, 'imageMode')) remote.imageMode = local.imageMode;
+ if (Object.hasOwn(local, 'imageModelId')) remote.imageModelId = local.imageModelId;
+ if (local.videoSettings && typeof local.videoSettings === 'object'
+ && !Array.isArray(local.videoSettings) && Object.hasOwn(local.videoSettings, 'backend')) {
+ const remoteVideoSettings = remote.videoSettings && typeof remote.videoSettings === 'object'
+ && !Array.isArray(remote.videoSettings) ? remote.videoSettings : {};
+ remote.videoSettings = { ...remoteVideoSettings, backend: local.videoSettings.backend };
+ }
const remoteWins = compareNewerWins(remote.updatedAt, local.updatedAt);
const next = remoteWins ? remote : local;
const changed = JSON.stringify(next) !== JSON.stringify(local);
diff --git a/server/services/musicVideo/projectsLogic.test.js b/server/services/musicVideo/projectsLogic.test.js
index 717dc79146..718c74fd03 100644
--- a/server/services/musicVideo/projectsLogic.test.js
+++ b/server/services/musicVideo/projectsLogic.test.js
@@ -478,6 +478,54 @@ describe('mergeProjectRecord (#1770 LWW)', () => {
expect(r.next.name).toBe('new');
});
+ it('preserves local render pins when a newer remote edit wins (#3245)', () => {
+ const local = {
+ id: 'mv-1',
+ updatedAt: '2026-01-01T00:00:00Z',
+ name: 'local',
+ imageMode: 'codex',
+ imageModelId: 'example-image-model',
+ videoSettings: { backend: 'local', modelId: 'local-model', grokDuration: 5 },
+ };
+ const remote = {
+ id: 'mv-1',
+ updatedAt: '2026-01-05T00:00:00Z',
+ name: 'remote edit',
+ videoSettings: { modelId: 'shared-model', grokDuration: 10 },
+ };
+
+ const r = mergeProjectRecord(local, remote);
+
+ expect(r.remoteWins).toBe(true);
+ expect(r.next.name).toBe('remote edit');
+ expect(r.next.imageMode).toBe('codex');
+ expect(r.next.imageModelId).toBe('example-image-model');
+ expect(r.next.videoSettings).toEqual({
+ modelId: 'shared-model',
+ grokDuration: 10,
+ backend: 'local',
+ });
+ });
+
+ it('keeps absent local image pins absent while preserving a local video backend', () => {
+ const local = {
+ id: 'mv-1',
+ updatedAt: '2026-01-01T00:00:00Z',
+ videoSettings: { backend: 'local' },
+ };
+ const remote = {
+ id: 'mv-1',
+ updatedAt: '2026-01-05T00:00:00Z',
+ videoSettings: { modelId: 'shared-model' },
+ };
+
+ const { next } = mergeProjectRecord(local, remote);
+
+ expect(next).not.toHaveProperty('imageMode');
+ expect(next).not.toHaveProperty('imageModelId');
+ expect(next.videoSettings).toEqual({ modelId: 'shared-model', backend: 'local' });
+ });
+
it('local with a newer updatedAt wins (no change applied)', () => {
const local = { id: 'mv-1', updatedAt: '2026-01-05T00:00:00Z', name: 'local' };
const remote = { id: 'mv-1', updatedAt: '2026-01-01T00:00:00Z', name: 'remote' };