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: let a production run retry a failing scene after resume (#9066)

[._.]/ Adam Eivycd5a17dad99b
diff --git a/server/services/musicVideo/production.js b/server/services/musicVideo/production.js
index 099fd41f4a..7a1376eb9c 100644
--- a/server/services/musicVideo/production.js
+++ b/server/services/musicVideo/production.js
@@ -216,6 +216,7 @@ export function startProductionOnProject(project, {
stopReason: null,
error: null,
createdAt: now,
+ resumedAt: now,
updatedAt: now,
};
return { project: { ...project, productionRuns: pruneRuns([...projectProductionRuns(project), run]), updatedAt: now }, run };
@@ -285,9 +286,11 @@ export function nextProductionStep(project, run, { jobs = [], processId = null }
if (stepKind === 'clip' && !scene.referenceImageId) { waiting = true; continue; }
const steps = slotSteps(run, scene.sceneId, stepKind);
if (steps.some((s) => LIVE_STEP.has(s.status)) || liveSlotJob(jobs, project.id, scene.sceneId, stepKind)) { waiting = true; continue; }
- const failures = steps.filter((s) => s.status === 'failed' || s.status === 'canceled').length;
+ // Failures since the last Start/Resume: a resume retries the slot, and a
+ // job cancelled by Stop is not a failure of the route.
+ const failures = steps.filter((s) => s.status === 'failed' && (s.settledAt || '') >= (run.resumedAt || '')).length;
if (failures >= MAX_SLOT_FAILURES) {
- return { type: 'halt', status: 'needs-human', reason: `"${scene.label || scene.sceneId}" failed to generate its ${stepKind} ${failures} times — generate it by hand or change the pool, then resume` };
+ return { type: 'halt', status: 'blocked', reason: `"${scene.label || scene.sceneId}" failed to generate its ${stepKind} ${failures} times — generate it by hand, or resume to try again` };
}
return { type: 'dispatch', kind: stepKind, sceneId: scene.sceneId };
}
@@ -478,6 +481,7 @@ export function resumeProductionOnProject(project, runId, { limits, acceptBasis
status: 'running',
limits: nextLimits,
processId,
+ resumedAt: now,
stopReason: null,
error: null,
...(basisChanged ? { basis: { revision: productionBasisRevision(project), capturedAt: now } } : {}),
diff --git a/server/services/musicVideo/productionService.test.js b/server/services/musicVideo/productionService.test.js
index c9046da0cf..d4608ff844 100644
--- a/server/services/musicVideo/productionService.test.js
+++ b/server/services/musicVideo/productionService.test.js
@@ -249,6 +249,25 @@ describe('music video production run (#9066)', () => {
expect(dispatch.mock.calls.filter(([a]) => a.scene.sceneId === 'mvs-a')).toHaveLength(2);
});
+ it('halts a slot that keeps failing, and a resume retries it', async () => {
+ seedProject();
+ await start();
+ const fail = (id) => {
+ const job = jobs.find((j) => j.id === id);
+ job.status = 'failed';
+ mediaJobEvents.emit('failed', job);
+ };
+ fail('job-1');
+ await settle();
+ fail('job-3');
+ await settle();
+ expect(theRun()).toMatchObject({ status: 'blocked', stopReason: expect.stringMatching(/"A" failed to generate its frame 2 times/) });
+ const before = dispatch.mock.calls.length;
+ await service.resumeProduction('mv-example', theRun().id);
+ await settle();
+ expect(dispatch.mock.calls.slice(before).map(([a]) => a.scene.sceneId)).toEqual(['mvs-a']);
+ });
+
it('coalesces concurrent advances so each slot is dispatched once', async () => {
seedProject();
let release;