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
address review (self): close listener before cache-inspect await; dedupe flux2 python lookup
[._.]/ Adam Eivy19d579caf255
diff --git a/server/lib/hfDownload.js b/server/lib/hfDownload.jsindex eb18f77579..c46135e53c 100644--- a/server/lib/hfDownload.js+++ b/server/lib/hfDownload.js@@ -35,7 +35,8 @@ const HELPER_SCRIPT = join(PATHS.root, 'scripts', 'hf_download_repo.py');// that broken interpreter. Every download would then fail on the broken// venv before reaching the working mflux pythonPath.export async function resolveHfDownloadPython() {- if (resolveFlux2Python() && await isFlux2VenvHealthy()) return resolveFlux2Python();+ const flux2 = resolveFlux2Python();+ if (flux2 && await isFlux2VenvHealthy()) return flux2;const settings = await getSettings();return settings?.imageGen?.local?.pythonPath || null;}diff --git a/server/lib/sseDownload.js b/server/lib/sseDownload.jsindex 284079b37b..c30af7a191 100644--- a/server/lib/sseDownload.js+++ b/server/lib/sseDownload.js@@ -24,7 +24,19 @@ export async function startHfDownloadStream({ req, res, repo, alreadyDownloadedM};const safeEnd = () => { if (!res.writableEnded) res.end(); };+ // Disconnect bookkeeping wired BEFORE the cache-inspection await. The+ // inspection can take double-digit ms on a cold cache; without this the+ // client closing mid-await would land after spawn with no kill path.+ let handle = null;+ let aborted = false;+ req.on('close', () => {+ aborted = true;+ if (handle) handle.kill();+ safeEnd();+ });+const existing = await inspectModelCache(repo);+ if (aborted) return;if (existing.cached) {send({ type: 'complete', message: alreadyDownloadedMessage || `${repo} already downloaded.`, repo, sizeBytes: existing.sizeBytes });return safeEnd();@@ -34,11 +46,10 @@ export async function startHfDownloadStream({ req, res, repo, alreadyDownloadedMreturn safeEnd();}- const handle = downloadHfRepo({ repo, onEvent: send });+ handle = downloadHfRepo({ repo, onEvent: send });inFlight.set(repo, handle);handle.promise.finally(() => {inFlight.delete(repo);safeEnd();});- req.on('close', () => { handle.kill(); safeEnd(); });}