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: mirror absent-vs-cleared content gate into memoryDB backend (#1826)
[._.]/ Adam Eivy9425ba6871c6
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex d36dfd68e0..7d63ef059a 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -20,7 +20,7 @@- **Blocking sync I/O removed from request/completion hot paths** — several syscalls ran synchronously on paths that serve live SSE/socket traffic, freezing the event loop for their duration. `checkForTaskCommit` (`agentRunTracking.js`) ran a `spawnSync('git', ['log', …])` on the completion path of every failed CoS run (100ms–2s on a large repo); it now uses the async, hard-timeout `bufferedSpawn`. `buildId.js` `statSync`'d `client/dist/index.html` on every SPA navigation; the freshness check is now throttled to at most once per second (the hot path between checks is a clock comparison, no syscall), so a rebuild re-syncs the served HTML with the on-disk chunks within the throttle window instead of paying a stat per navigation. The avatar (`routes/avatar.js`) and attachment (`routes/attachments.js`) routes swapped `existsSync`/`statSync` for async `fs.access`/`fs.stat` (via a new canonical `pathExists` helper in `fileUtils.js`), and uploads now call the idempotent `ensureDir` directly. Separately, the tombstone-prune paths for authors/tracks/creative-director projects (DB + file backends) wrapped their per-record `deleteSyncBaseHash` loops in `withBaseHashFlushBatch`, collapsing N `sync_base_hashes.json` rewrites into one. (#1828)- **External API model/metadata fetches now time out instead of stalling callers indefinitely** — `_fetchGeminiModels` (Gemini model refresh in `aiToolkit/providers.js`) made a `fetch` with no `AbortSignal`, unlike every other provider model-fetch in that file, so a hung Google endpoint could block a model-refresh request forever; it now uses the same `AbortSignal.timeout(8000)`. `fetchCivitaiModel` and `searchCivitaiLoras` (`server/lib/civitai.js`) likewise passed no signal, so a Civitai hang stalled LoRA metadata/search callers; both now default to `AbortSignal.timeout(10000)` and accept a caller-provided `signal` override. (#1827)-- **Absent-vs-cleared merge bugs that silently restored values the user just cleared** — three spots conflated "field absent" with "field intentionally cleared to empty". Clearing a memory's content to `""` now reindexes BM25 (so the old text no longer stays searchable) and regenerates the summary, instead of a falsy gate skipping both (`memory.js`). A genuinely empty-body email refresh now overwrites the cached body instead of `||` collapsing back to the stale text (`messageSync.js`, both the thread-match and original-message paths). And clearing a CoS task's legacy direct field (`context`/`model`/`provider`/`app`) to `""` now persists as `""` rather than `|| undefined` deleting the key — `null` still drops it (`cosTaskStore.js`). (#1826)+- **Absent-vs-cleared merge bugs that silently restored values the user just cleared** — three spots conflated "field absent" with "field intentionally cleared to empty". A memory content edit now regenerates the summary and (file backend) reindexes BM25 via a shape-based gate (`typeof content === 'string'` / `Array.isArray(tags)`) instead of a falsy one that skipped both on an empty value and could crash `generateSummary` on a null/undefined content — fixed in both the file backend (`memory.js`) and the production Postgres backend (`memoryDB.js`) so they stay mirrored. (Empty memory content stays blocked at the API by `memoryUpdateSchema`'s `min(1)`, consistent with create.) A genuinely empty-body email refresh now overwrites the cached body instead of `||` collapsing back to the stale text (`messageSync.js`, both the thread-match and original-message paths). And clearing a CoS task's legacy direct field (`context`/`model`/`provider`/`app`) to `""` now persists as `""` rather than `|| undefined` deleting the key — `null` still drops it (`cosTaskStore.js`). (#1826)- **Unguarded async `child_process` handlers can no longer crash the Node process** — several `close`/`error` event handlers were `async` and `await`ed disk writes / completion bookkeeping with no `try/catch`, so a single failed write (e.g. a full disk) or a throwing completion hook surfaced as an unhandled rejection and took down the whole server. Wrapped the at-risk handler bodies in `server/services/runner.js` (both `close` and `error`), `videoTimeline/local.js`, `agentCliSpawning.js` (both `close` and `error`), and both the CLI `close` handler and the detached `processStream().catch` in `aiToolkit/runner.js`. The recovery paths now still settle callers waiting on `onComplete` with failure metadata (so a finalization failure surfaces as a failed run instead of hanging forever), with the completion hook isolated from `onComplete` so a throwing `onRunFailed` can't block the caller from settling. Also replaced the two silent recovery-critical `.catch(() => {})` swallows in `cos-runner/index.js` with logged failures so a lost completion-metadata write is visible instead of silently dropping a finished task. (#1825)- Catalog "Appears in" panel no longer renders dangling chips that deep-link to soft-deleted universe/series/creative-director targets — the detail page filters refs to live targets only (the orphan stays recoverable via the "Orphaned" album). Also fixed a stale resolver bug where soft-deleted Creative Director projects (#1564) wrongly resolved as live, and extended orphan-bucket detection so a deleted CD project's ex-cast surfaces as orphaned rather than unlinked. (#1812)diff --git a/server/services/memoryDB.js b/server/services/memoryDB.jsindex 30352d82e4..fbd42f649c 100644--- a/server/services/memoryDB.js+++ b/server/services/memoryDB.js@@ -284,8 +284,15 @@ export async function updateMemory(id, updates) {}}- // Update summary if content changed but no explicit summary- if (updates.content && !updates.summary) {+ // Update summary if content changed but no explicit summary. Gate on "is a+ // string", not truthiness, to mirror the file backend (memory.js): a content+ // edit must refresh the summary rather than leave the stale one behind+ // (absent-vs-cleared, CLAUDE.md). The typeof check also keeps null/undefined+ // out of generateSummary, which would throw on `.length`. (Empty content is+ // separately blocked at the API by memoryUpdateSchema's min(1), so in practice+ // this only fires for a real non-empty edit — the guard keeps both backends+ // consistent and crash-safe regardless of caller.)+ if (typeof updates.content === 'string' && !updates.summary) {fields.push(`summary = $${paramIdx++}`);params.push(generateSummary(updates.content));}