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([setup-check-cache]): sweep expired entries, add /setup/install bust test, soften changelog overclaim
[._.]/ Adam Eivy4ceaf021468b
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 6c02a23e4c..311282bc4f 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -5,7 +5,7 @@- **[patch-settings-slice-helper] Nested settings edits no longer risk clobbering sibling fields.** Saving a Python path from Video Gen, or an image-gen config from a pipeline / Writers Room stage, used to round-trip the entire current settings object — leaving unrelated top-level keys exposed to drift if the read raced a concurrent write elsewhere. These edits now scope themselves to the slice being changed.- **[client-use-previous-hook] Shared `usePrevious` hook.** Internal refactor: collapses two ad-hoc previous-render comparisons into one shared hook. No user-visible behavior change.- **[warning-banner-component] Shared `Banner` component.** Internal refactor: introduces a tone-variant Banner primitive and replaces five hand-rolled warning banners (LoRA manager, Security audio prompt, scheduled-runs paused / improvement-disabled callouts, local Python arch / externally-managed notices, CoS memory-backend status). Two of those banners pick up a minor visual unification — the LoRA download message body now uses the standard warning amber instead of a cream variant, and the local Python notices gain a few pixels of horizontal padding to match the rest of the warning banner family.-- **[setup-check-cache] Local Python setup check no longer spawns a subprocess per keystroke.** Typing in the Python interpreter path used to fire a fresh ~0.5–1 s python probe on every (debounced) keystroke, on mount, and on the refresh button. The check now memoises its result per interpreter for 30 seconds, and the cache busts automatically when the interpreter binary changes, when a new venv is created, and when a `pip install` finishes — so typing flows feel snappier without ever returning stale status.+- **[setup-check-cache] Local Python setup check no longer spawns a subprocess per keystroke.** Typing in the Python interpreter path used to fire a fresh ~0.5–1 s python probe on every (debounced) keystroke, on mount, and on the refresh button. The check now memoises its result per interpreter for 30 seconds, and the cache busts automatically when the interpreter binary changes, when a new venv is created, and when a `pip install` finishes — so typing flows feel snappier. External package mutations (a shell-side `pip install`) can take up to 30 s to surface; the next setup interaction picks them up.## Addeddiff --git a/server/routes/imageGen.js b/server/routes/imageGen.jsindex 0944dbdcac..8a3f0f801c 100644--- a/server/routes/imageGen.js+++ b/server/routes/imageGen.js@@ -798,7 +798,14 @@ router.get('/setup/check', asyncHandler(async (req, res) => {}const result = await buildSetupCheck(pythonPath);if (key) {- setupCheckCache.set(key, { result, expiresAt: Date.now() + SETUP_CHECK_TTL_MS });+ // Sweep expired entries on every write so a long-running process doesn't+ // accumulate stale (path, mtime) combos from intermediate keystrokes+ // (each typed character of a path string lands a unique key here).+ const now = Date.now();+ for (const [k, v] of setupCheckCache) {+ if (v.expiresAt <= now) setupCheckCache.delete(k);+ }+ setupCheckCache.set(key, { result, expiresAt: now + SETUP_CHECK_TTL_MS });}res.json(result);}));diff --git a/server/routes/imageGen.test.js b/server/routes/imageGen.test.jsindex b09f314b77..28b93c4635 100644--- a/server/routes/imageGen.test.js+++ b/server/routes/imageGen.test.js@@ -643,5 +643,42 @@ describe('Image Gen Routes', () => {await request(app).get(`/api/image-gen/setup/check?pythonPath=${encodeURIComponent(base)}`);expect(probePythonHealth).toHaveBeenCalledTimes(2);});++ it('GET /setup/install completion invalidates the cache for that pythonPath', async () => {+ const p = '/usr/bin/python3-install-bust-test';+ // Warm cache.+ await request(app).get(`/api/image-gen/setup/check?pythonPath=${encodeURIComponent(p)}`);+ expect(probePythonHealth).toHaveBeenCalledTimes(1);++ // Run install (mocked installPackages resolves immediately).+ const installRes = await request(app).get(`/api/image-gen/setup/install?pythonPath=${encodeURIComponent(p)}&packages=mflux`);+ expect(installRes.status).toBe(200);++ // The next /setup/check must re-probe — the install just changed the+ // missing-packages list, and the SSE consumer re-runs /setup/check on+ // `complete` expecting fresh data.+ await request(app).get(`/api/image-gen/setup/check?pythonPath=${encodeURIComponent(p)}`);+ expect(probePythonHealth).toHaveBeenCalledTimes(2);+ });++ it('write path sweeps expired entries so long-running processes do not accumulate', async () => {+ vi.useFakeTimers({ shouldAdvanceTime: true });+ try {+ const stale = '/usr/bin/python3-sweep-stale';+ const fresh = '/usr/bin/python3-sweep-fresh';+ // Warm the cache with one entry, then advance past the TTL.+ await request(app).get(`/api/image-gen/setup/check?pythonPath=${encodeURIComponent(stale)}`);+ vi.advanceTimersByTime(31_000);+ // A write for a different path triggers the sweep — stale entry drops.+ await request(app).get(`/api/image-gen/setup/check?pythonPath=${encodeURIComponent(fresh)}`);+ // A subsequent probe of the stale path re-spawns, confirming the entry+ // was actually removed (not merely TTL-bypassed).+ await request(app).get(`/api/image-gen/setup/check?pythonPath=${encodeURIComponent(stale)}`);+ // 3 spawns total: initial stale, fresh, post-sweep stale.+ expect(probePythonHealth).toHaveBeenCalledTimes(3);+ } finally {+ vi.useRealTimers();+ }+ });});});