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(videogen): clean up a failed starting-frame encode, pin the renderer canvas table
Adam Eivycd70f6a42bb5
diff --git a/server/lib/reactorStartingFrame.js b/server/lib/reactorStartingFrame.jsindex ac3dd44e59..190d3dea76 100644--- a/server/lib/reactorStartingFrame.js+++ b/server/lib/reactorStartingFrame.js@@ -25,6 +25,7 @@* refusing a render PortOS merely failed to measure would be worse than letting* reactor fit it.*/+import { rm } from 'node:fs/promises';import sharp from 'sharp';import {REACTOR_DEFAULT_ASPECT, nearestReactorAspect, reactorCanvas,@@ -69,7 +70,14 @@ export async function prepareReactorStartingFrame(sourceImagePath, requestedAspe.toFile(fittedPath).then(() => true).catch(() => false);- if (!written) return passthrough;+ if (!written) {+ // A failed encode can still have created the destination. Nothing reports+ // this path back to the caller (passthrough carries `fittedPath: null`), so+ // its cleanup would never run and a truncated PNG would sit in the video+ // gallery directory forever.+ await rm(fittedPath, { force: true }).catch(() => {});+ return passthrough;+ }console.log(`🖼️ Reactor starting frame fitted ${size.width}x${size.height} → ${canvas.width}x${canvas.height} (${aspect})`);return { aspect, canvas, framePath: fittedPath, fittedPath };}diff --git a/server/lib/reactorVideoClip.test.js b/server/lib/reactorVideoClip.test.jsindex 32597b2552..70502fb8c4 100644--- a/server/lib/reactorVideoClip.test.js+++ b/server/lib/reactorVideoClip.test.js@@ -1,3 +1,5 @@+import { readFile } from 'node:fs/promises';+import { fileURLToPath } from 'node:url';import { describe, it, expect } from 'vitest';import {REACTOR_MAX_PROMPT_LENGTH, REACTOR_CLIP_FPS, REACTOR_MIN_CLIP_SECONDS,@@ -72,6 +74,23 @@ describe('reactorVideoClip', () => {});});+// scripts/reactor-render.py opens the session and cannot import this module, so+// its canvas table is a hand-written copy — the "kept in sync by a comment"+// shape. A canvas added here and not there fails at `set_canvas` AFTER a paid+// session is already open; one removed here and not there renders on a canvas+// the picker no longer offers.+describe('reactorVideoClip renderer mirror', () => {+ it('matches the canvas table in scripts/reactor-render.py', async () => {+ const source = await readFile(fileURLToPath(new URL('../../scripts/reactor-render.py', import.meta.url)), 'utf8');+ const table = source.match(/^CANVASES = \{(.+)\}$/m);+ expect(table, 'CANVASES table not found in scripts/reactor-render.py').toBeTruthy();+ const entries = [...table[1].matchAll(/"([^"]+)": \((\d+), (\d+)\)/g)]+ .map(([, aspect, width, height]) => ({ aspect, width: Number(width), height: Number(height) }));+ expect(entries).toEqual(REACTOR_CANVASES.map(({ aspect, width, height }) => ({ aspect, width, height })));+ expect(source).toMatch(new RegExp(`^DEFAULT_ASPECT = "${REACTOR_DEFAULT_ASPECT}"$`, 'm'));+ });+});+describe('reactorVideoClip client mirror', () => {it('matches client/src/lib/reactorVideoClip.js', async () => {// The VideoGen prompt counter and clip-length picker build from the client