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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: keep cancelled dependency repairs resumable without duplicate clips (#9349)
Adam Eivy574ac3ede5e1
diff --git a/server/lib/musicVideoDependencies.js b/server/lib/musicVideoDependencies.jsindex ceab1de2aa..01e1df16aa 100644--- a/server/lib/musicVideoDependencies.js+++ b/server/lib/musicVideoDependencies.js@@ -109,7 +109,9 @@ export function musicVideoDependencyImpact(project, performanceChanges = []) {? (scene.takes || []).findLast((entry) => entry.kind === 'video' && entry.status === 'rejected') : null);const changes = take ? musicVideoTakeChanges(project, scene, take) : [];const audio = performanceChanges.filter((entry) => entry.sceneId === scene.sceneId);- const reasons = [...new Set([...changes.map((entry) => entry.reason), ...audio.map((entry) => entry.reason)])];+ const unfinished = !scene.videoHistoryId && (project.revisions || []).some((revision) => revision.type === 'dependencies'+ && revision.sections?.some((section) => section.sceneId === scene.sceneId && section.verdict === 'rejected'));+ const reasons = [...new Set([...changes.map((entry) => entry.reason), ...audio.map((entry) => entry.reason), ...(unfinished ? ['Replacement clip is still missing'] : [])])];if (reasons.length) shots.push({ sceneId: scene.sceneId, kind: 'video', assetId: take?.assetId || scene.videoHistoryId,reasons, durationSec: Math.max(0, (scene.endSec || 0) - (scene.startSec || 0)) });}diff --git a/server/routes/musicVideoDependencies.test.js b/server/routes/musicVideoDependencies.test.jsindex 77f362e8ae..098df14ba4 100644--- a/server/routes/musicVideoDependencies.test.js+++ b/server/routes/musicVideoDependencies.test.js@@ -68,6 +68,17 @@ describe('public dependency save / repair / review workflow', () => {expect((await request(app).post(`${base()}/revisions/${restarted.body.revision.id}/resume`)).body.needsGeneration).toEqual([]);expect((await fresh()).scenes[0].takes.filter((take) => take.assetId === 'clip-new')).toHaveLength(1);expect((await fresh()).scenes[1].videoHistoryId).toBe('clip-b');+ await expect(assertRevisionOpen(project.id, restarted.body.revision.id, { sceneId: 'a', kind: 'video' })).rejects.toMatchObject({ code: 'REVISION_SECTION_SELECTED' });+ });++ it('refuses generation when a historical stale take was reselected during repair', async () => {+ await request(app).patch(`${base()}/scenes/a`).send({ referenceImageId: 'new.png' });+ const opened = await request(app).post(`${base()}/dependency-repairs`).send({ basis: (await impact()).body.basis });+ const historical = opened.body.project.scenes[0].takes.find((take) => take.assetId === 'clip-a');+ await request(app).post(`${base()}/scenes/a/takes/${historical.takeId}/select`);+ const response = await request(app).post(`${base()}/revisions/${opened.body.revision.id}/resume`);+ expect(response.status).toBe(409);+ expect(response.body.code).toBe('DEPENDENCY_REPAIR_STALE_SELECTION');});it('refuses a stale preview and invalidates passing reviews including an in-flight review race', async () => {diff --git a/server/services/musicVideo/revision.js b/server/services/musicVideo/revision.jsindex abd41380cb..24525a880c 100644--- a/server/services/musicVideo/revision.js+++ b/server/services/musicVideo/revision.js@@ -296,6 +296,10 @@ export function claimRevisionGeneration(project, revisionId, jobs = [], nowMs =throw revisionError(409, 'DEPENDENCY_REPAIR_CHANGED', 'The repair inputs changed — cancel and preview the affected dependencies again');}const states = revisionSectionStates(project, revision, jobs, nowMs);+ if (revision.type === 'dependencies' && states.some((section) => section.state === 'needs-generation'+ && project.scenes.find((scene) => scene.sceneId === section.sceneId)?.videoHistoryId)) {+ throw revisionError(409, 'DEPENDENCY_REPAIR_STALE_SELECTION', 'Clear the selected stale clip or select a current replacement before resuming');+ }const ref = ({ sceneId, kind }) => ({ sceneId, kind });const needsGeneration = states.filter((s) => s.state === 'needs-generation').map(ref);const generating = states.filter((s) => s.state === 'generating').map(ref);@@ -371,6 +375,8 @@ export function assertRevisionOpenForGeneration(project, revisionId, { sceneId =const revision = resumableRevision(project, revisionId);if (revision.type === 'dependencies') {const section = revision.sections.find((entry) => entry.sceneId === sceneId && entry.kind === kind);+ const scene = project.scenes.find((entry) => entry.sceneId === sceneId);+ if (scene?.[TAKE_SLOT[kind]]) throw revisionError(409, 'REVISION_SECTION_SELECTED', 'This repair section already has a selected clip — clear or review it before submitting again');if (!section || musicVideoDependencyChanges(project, section.dependencies).length) {throw revisionError(409, 'DEPENDENCY_REPAIR_CHANGED', 'This generation does not match the previewed repair inputs');}