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: recover fal.ai video queue from a rejected run tail (#8906)
[._.]/ Adam Eivy44e86a0bde5f
diff --git a/server/services/fableLoom/falVideoAutomation.js b/server/services/fableLoom/falVideoAutomation.jsindex c7f48731c7..b137ff577d 100644--- a/server/services/fableLoom/falVideoAutomation.js+++ b/server/services/fableLoom/falVideoAutomation.js@@ -497,7 +497,14 @@ export async function startFalVideoAutomation(loomId, episodeId, nodeId, {// The free tool exposes one form in one persistent browser profile. Keep// every user-requested scene job, but serialize them so a later click// cannot replace the prompt/image of an in-flight render.- runTail = runTail.then(() => executeJob(job));+ // executeJob() catches and records its own failures on the job object, but+ // a rare failure before that internal catch (e.g. teardown throwing in the+ // finally block) would otherwise leave `runTail` permanently rejected,+ // silently skipping every future job's executeJob() call. Recover here so+ // one failed run never wedges the queue for subsequent jobs.+ runTail = runTail.catch((error) => {+ console.error(`❌ fal.ai video automation queue recovered from a prior failure: ${error?.message || error}`);+ }).then(() => executeJob(job));// Snapshot the queued state before the serialized runner can advance it;// both same-scene callers receive the same initial API contract.return publicJob(job);diff --git a/server/services/fableLoom/falVideoAutomation.test.js b/server/services/fableLoom/falVideoAutomation.test.jsindex 1d2051245e..91ab791521 100644--- a/server/services/fableLoom/falVideoAutomation.test.js+++ b/server/services/fableLoom/falVideoAutomation.test.js@@ -446,4 +446,45 @@ describe('FableLoom fal.ai browser automation', () => {expect(mocks.saveUploadedGalleryVideoBuffer).not.toHaveBeenCalled();expect(mocks.attachNodeVideo).not.toHaveBeenCalled();});++ it('still runs a later queued job after an earlier job rejects the shared run tail', async () => {+ // A plain error whose `.name` accessor itself throws reproduces a failure+ // that escapes executeJob()'s own internal try/catch (it throws again+ // while building the failure diagnostic), rejecting the promise chained+ // onto the module-level `runTail`. Without rejection recovery on that+ // chain, every subsequent job silently skips execution forever.+ class UnreadableNameError extends Error {+ get name() { throw new Error('name accessor blew up'); }+ }+ const loom = {+ id: 'loom-1',+ episodes: [{+ id: 'ep-1',+ nodes: [+ { id: 'node-1', image: 'scene.png' },+ { id: 'node-2', image: 'scene-2.png' },+ ],+ }],+ };+ mocks.getLoom+ .mockResolvedValueOnce(loom) // first job's lookup while queuing+ .mockRejectedValueOnce(new UnreadableNameError('scene check failed')) // first job's in-flight scene check+ .mockResolvedValue(loom); // second job's lookup + in-flight scene check++ const firstJob = await startFalVideoAutomation('loom-1', 'ep-1', 'node-1', {+ prompt: 'Example direction', io: null,+ });+ expect(firstJob.status).toBe('queued');+ // Let the queue actually attempt (and reject on) the first job before+ // enqueuing the second, so the rejection is in place first.+ await vi.waitFor(() => expect(mocks.getLoom.mock.calls.length).toBeGreaterThanOrEqual(2));++ makeBrowser();+ const secondJob = await startFalVideoAutomation('loom-1', 'ep-1', 'node-2', {+ prompt: 'Another direction', io: null,+ });++ const settled = await waitForTerminalJob(secondJob);+ expect(settled.status).toBe('completed');+ });});