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
refactor: register the chain before its first await so a cancel still finds it (#3801)
[._.]/ Adam Eivyc1426d9c96af
diff --git a/server/services/videoGen/eta.js b/server/services/videoGen/eta.jsindex 6720f73bd9..7ad639a070 100644--- a/server/services/videoGen/eta.js+++ b/server/services/videoGen/eta.js@@ -26,6 +26,12 @@* fresh install has no measurements by definition.** Everything here is pure — `history` is passed in, never read from disk.+ *+ * Deliberately NOT in the shape key: mode (t2v / i2v / fflf / extend) and+ * LoRAs. They do move render cost, but folding them in would fragment an+ * install's already-small sample set into buckets too thin to fit — and the+ * resulting variance is ordinary estimate noise, whereas an over-narrow key+ * produces "no estimate" for renders we could have called within a minute.*/// Only the most recent N same-model records feed a fit. Older runs drift awaydiff --git a/server/services/videoGen/local.js b/server/services/videoGen/local.jsindex 33e4854ad8..d5c521a9dc 100644--- a/server/services/videoGen/local.js+++ b/server/services/videoGen/local.js@@ -1714,6 +1714,15 @@ export async function generateChainedVideo({ chunks, chunkPrompts, contextFramesrest.numFrames ?? chainModel?.defaultFrames ?? DEFAULT_NUM_FRAMES,);+ const chainState = { stopped: false };+ activeChain = chainState;++ // Hold an outer job entry so attachSseClient(outerJobId) wires up against+ // the same SSE stream the queue sees. Without this, /api/video-gen/:id/events+ // attached at the outer id would 404 because no `jobs` map entry exists.+ const outerJob = { id: outerJobId, clients: [], status: 'running' };+ jobs.set(outerJobId, outerJob);+// Chain-level wall-clock estimate (#3801). Every chunk is a full render that// pays the fixed per-render cost again, so the chain estimate is the// per-chunk estimate times the chunk count — `chunks` is handed to the@@ -1722,6 +1731,9 @@ export async function generateChainedVideo({ chunks, chunkPrompts, contextFrames// `width = 768, height = 512` parameter defaults and the samplerLocked step// rule); the estimator returns null on anything it can't resolve, so a drift// here degrades to "no estimate" rather than to a wrong number.+ // Deliberately placed AFTER `activeChain`/`jobs` are registered: it is the+ // first await in this function, and a cancel arriving during the history+ // read must still find the chain to stop.const chainSteps = chainModel?.samplerLocked? chainModel.steps: (rest.steps ? Number(rest.steps) : chainModel?.steps);@@ -1737,15 +1749,6 @@ export async function generateChainedVideo({ chunks, chunkPrompts, contextFramesconst chainEtaField = chainEta ? { etaMs: chainEta.etaMs } : {};console.log(`🎬 Chained video [${outerJobId.slice(0, 8)}]: ${totalChunks} chunks, eta=${chainEta ? `${Math.round(chainEta.etaMs / 1000)}s (${chainEta.basis}, n=${chainEta.sampleCount})` : 'unknown'}`);- const chainState = { stopped: false };- activeChain = chainState;-- // Hold an outer job entry so attachSseClient(outerJobId) wires up against- // the same SSE stream the queue sees. Without this, /api/video-gen/:id/events- // attached at the outer id would 404 because no `jobs` map entry exists.- const outerJob = { id: outerJobId, clients: [], status: 'running' };- jobs.set(outerJobId, outerJob);-const chunkIds = [];let currentSource = rest.sourceImagePath;// 'window' continuation: the tail slice of the prior chunk that the next one