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: address v2.11.0 release-review findings
Adam Eivy0ce837c6125f
diff --git a/PLAN.md b/PLAN.mdindex e07495d558..3da6665718 100644--- a/PLAN.md+++ b/PLAN.md@@ -181,6 +181,12 @@ Lower-severity findings from the xhigh code-review of the importer feature; the- [ ] [importer-retry-arcsummary-empty] **Retry's `arcSummary` uses `||` truthiness, dropping an intentionally-cleared summary.** `runRetryIssues` in `Importer.jsx` builds `arcDraft?.summary || arcDraft?.logline || ''`, so clearing the summary in Review falls back to the logline rather than sending none — violates the absent-vs-intentionally-empty rule the rest of the feature follows. Non-fatal (arcSummary is cosmetic prompt context). Fix: treat `summary === ''` as an intentional clear (`summary == null ? logline : summary`). Surfaced 2026-05-26.- [ ] [importer-orphan-shell-gc] **An abandoned analyze leaves an empty universe/series shell on disk.** `analyzeImport` persists universe+series after canon+arc succeed (the chosen "keep review flow + retry" tradeoff), so if the user abandons after an issue-split failure (or just never commits) on a brand-new universe/series, empty shells linger in `data/`. By-design, but a periodic GC of zero-issue, zero-canon shells older than N days (or marking analyze-created shells `ephemeral` until commit promotes them) would keep `data/` clean. Surfaced 2026-05-26.+### v2.11.0 release-review follow-ups (2026-05-27)++Surfaced by the multi-reviewer release gate for v2.11.0. The correctness/contract findings were fixed in-release (comic two-speaker-panel attribution, editorial-analysis pipe-enum prompt corruption + migration 042, `agentLifecycle` fallback-provider map shape, weather half-set-coordinate pairing, plus several comment-accuracy nits). This item was deferred as a non-blocking hardening gap.++- [ ] [voice-taskcomplete-announce-once-guard] **`onTaskUpdated` in `server/services/voice/proactiveTriggers.js` (~line 193) re-announces if an already-completed voice-dispatched task is updated again.** The spoken "your coding task is done" line keys on `tasks:changed action:'updated'` + terminal status (`completed`/`blocked`) + `voiceDispatch`, with no record of already-announced task ids — so any future caller that runs `updateTask` on an already-completed voice-dispatched task (e.g. attaching a PR URL or metadata *after* marking it completed) would re-fire the announcement. The comment claims it "announces once (at its terminal outcome)," which holds only because no current caller re-updates completed tasks. Fix: track announced task ids in a `Set` in the closure (clear on unwire) and skip if already announced, OR gate on the previous→terminal status *transition* if the event carries the prior status. Low severity (no current re-update path; worst case is a duplicate spoken line, not data loss) — deferred per YAGNI since the path doesn't exist today. Surfaced 2026-05-27.+## Future Ideas- **Identity Context Injection** — per-task-type digital twin preamble toggle.diff --git a/data.reference/prompts/stages/pipeline-editorial-analysis.md b/data.reference/prompts/stages/pipeline-editorial-analysis.mdindex 0f69425f94..0a707c8dce 100644--- a/data.reference/prompts/stages/pipeline-editorial-analysis.md+++ b/data.reference/prompts/stages/pipeline-editorial-analysis.md@@ -28,7 +28,7 @@ You are a developmental editor mapping the **reader's emotional journey** throug- `emotions`: up to 3 contributing reader emotions.- `tension`: 0–100, how much narrative/plot tension the reader feels here (stakes, danger, uncertainty, pace).- `valence`: −100 (bleak/painful) to +100 (joyful/triumphant) — the emotional "up or down" of the moment.- - `excerpt`: a short verbatim quote (≤ 160 chars) anchoring the section.+ - `excerpt`: a short verbatim quote (≤ 200 chars) anchoring the section.- `note`: 1–2 sentences on what drives that reader response and any pacing concern.3. **Map character arcs.** For every character with a meaningful presence:@@ -60,7 +60,7 @@ Return ONLY valid JSON matching this shape — no prose, no markdown fence, no c{ "label": "string", "excerpt": "string", "primaryEmotion": "string", "emotions": ["string"], "tension": 0, "valence": 0, "note": "string" }],"characters": [- { "name": "string", "role": "string", "isProtagonist": true, "arcDirection": "rising|falling|flat|complex", "arcSummary": "string", "beats": [ { "sectionIndex": 0, "state": "string" } ] }+ { "name": "string", "role": "string", "isProtagonist": true, "arcDirection": "rising", "arcSummary": "string", "beats": [ { "sectionIndex": 0, "state": "string" } ] }],"rollup": {"plotTension": 0,diff --git a/scripts/migrations/042-fix-editorial-analysis-prompt.js b/scripts/migrations/042-fix-editorial-analysis-prompt.jsnew file mode 100644index 0000000000..399ed6d6b9--- /dev/null+++ b/scripts/migrations/042-fix-editorial-analysis-prompt.js@@ -0,0 +1,53 @@+/**+ * Fix the `pipeline-editorial-analysis` stage prompt's output-contract example.+ *+ * The JSON example shipped by migration 041 used a pipe-separated enum literal+ * for `arcDirection` (`"rising|falling|flat|complex"`) and asked for a ≤160-char+ * excerpt. LLMs reproduce pipe-separated enum strings verbatim, and the+ * sanitizer (`ARC_DIRECTIONS.includes(raw.arcDirection) ? raw.arcDirection :+ * 'flat'`) then silently falls through to `'flat'` — corrupting every+ * character's arc direction and degrading protagonist / supporting-arc+ * detection (both gate on `arcDirection !== 'flat'`). The example now uses a+ * single concrete value (`"rising"`), relying on the task-section bullet to+ * enumerate the allowed values. The excerpt cap is also aligned to the+ * sanitizer's actual `EXCERPT_MAX` (200).+ *+ * Migration 041 only SEEDS the prompt when missing, so an install that already+ * ran 041 (a machine that tracked unreleased main) keeps the buggy copy. This+ * hash-driven replace bumps that copy to the corrected sample; it is a no-op+ * on fresh installs (041 seeds the corrected sample directly) and on+ * customized copies (matches neither hash → skipped).+ *+ * Strategy: hash-driven prompt-replace via `./_lib.js`. Idempotent.+ */++import { makePromptReplaceMigration } from './_lib.js';++export const ACCEPTED_OLD_MD5 = {+ 'pipeline-editorial-analysis.md': [+ '14d9879697c66d51830cc798040d5369', // pre-042 (pipe-separated arcDirection enum + ≤160 excerpt)+ ],+};++export const NEW_SHIPPED_MD5 = {+ 'pipeline-editorial-analysis.md': 'daeb02bd54b0c099b21af659c6298cfe', // post-042 (single arcDirection example, ≤200 excerpt)+};++const { applyMigration, up } = makePromptReplaceMigration({+ accepted: ACCEPTED_OLD_MD5,+ current: NEW_SHIPPED_MD5,+ label: 'editorial-analysis prompt',+ customizedHint: (filename) =>+ ` To fix the arcDirection example manually, edit:\n` ++ ` data/prompts/stages/${filename}\n` ++ ` and replace the JSON example's "arcDirection": "rising|falling|flat|complex"\n` ++ ` with a single value like "arcDirection": "rising".`,+ skipFooter: (count) =>+ `⚠️ ${count} prompt(s) could not be auto-updated because they were customized.\n` ++ ` Until fixed, the editorial analysis may report every character's arc as\n` ++ ` "flat" (the LLM echoes the pipe-separated enum literal verbatim).\n` ++ ` See data.reference/prompts/stages/pipeline-editorial-analysis.md.`,+});++export { applyMigration };+export default { up };diff --git a/scripts/setup-data.js b/scripts/setup-data.jsindex b6b32459ef..571f8deae4 100644--- a/scripts/setup-data.js+++ b/scripts/setup-data.js@@ -177,6 +177,9 @@ const SHIPPED_PROMPT_OLD_MD5 = {// universe-character-expand: pre-027 shipped, auto-updatable to the post-027// (`speechPattern` field added alongside `speechAccent`) hash.'universe-character-expand.md': ['ef109eb8e12ddb664c11c790271b5139'],+ // editorial-analysis: pre-042 (pipe-separated arcDirection enum + ≤160+ // excerpt) auto-updatable to the post-042 (single-value example, ≤200) hash.+ 'pipeline-editorial-analysis.md': ['14d9879697c66d51830cc798040d5369'],// CoS agent prompt: drop obsolete "# Chief of Staff Agent Briefing" header// and "You are an autonomous agent…" preamble (migration 009). Every// historical shipped hash is auto-updatable to the new sample.@@ -203,6 +206,7 @@ const SHIPPED_PROMPT_NEW_MD5 = {'writers-room-places.md': 'a7f68e51dd6b4421d20f5bd9d855d9b4','cos-agent-briefing.md': 'dccb392a43cbd3dac900fee12c31619a','universe-character-expand.md':'67b6e73ed47f318451a730088b4cff14',+ 'pipeline-editorial-analysis.md':'daeb02bd54b0c099b21af659c6298cfe',};const SHIPPED_PROMPT_FILES = Object.keys(SHIPPED_PROMPT_OLD_MD5);diff --git a/server/lib/comicScriptParser.js b/server/lib/comicScriptParser.jsindex de3c0bc5f2..727d1d42c0 100644--- a/server/lib/comicScriptParser.js+++ b/server/lib/comicScriptParser.js@@ -187,7 +187,10 @@ function normalizeBareComicScript(script) {}// Continuation line of a multi-line balloon — attribute it to the same// speaker so parsePanelBody captures it (otherwise lines 2+ were dropped).- if (field === 'dialogue' && dialogueSpeaker && t) {+ // The `!BARE_SPEAKER_LINE` guard (same as the pendingSpeaker branch above)+ // lets a SECOND speaker cue in the panel fall through to the speaker-cue+ // branch below instead of being eaten as the first speaker's dialogue.+ if (field === 'dialogue' && dialogueSpeaker && t && !BARE_SPEAKER_LINE.test(t)) {out.push(`${dialogueSpeaker}: ${t}`);continue;}diff --git a/server/lib/comicScriptParser.test.js b/server/lib/comicScriptParser.test.jsindex e5342f9216..17983f9422 100644--- a/server/lib/comicScriptParser.test.js+++ b/server/lib/comicScriptParser.test.js@@ -458,6 +458,17 @@ Thud!`;expect(pages[0].panels[0].caption).toBe('The end.');});+ it('attributes a second speaker cue in the same panel to the new speaker (not the first)', () => {+ // Two speakers in one panel is extremely common. The continuation-line+ // branch must let a fresh all-caps cue open a NEW speaker instead of+ // swallowing it as the first speaker's dialogue.+ const { pages } = parseComicScript('PAGE 1\nPANEL 1\nA face.\nGIANT\nHello there.\nKESSA\nHi back.');+ expect(pages[0].panels[0].dialogue).toEqual([+ { character: 'GIANT', line: 'Hello there.' },+ { character: 'KESSA', line: 'Hi back.' },+ ]);+ });+it('preserves a dangling speaker cue (no spoken line before the next marker) as text, not dropped', () => {const { pages } = parseComicScript('PAGE 1\nPANEL 1\nA face.\nGIANT\nPANEL 2\nAnother shot.');// GIANT had no spoken line before PANEL 2 — it must survive in the paneldiff --git a/server/lib/validation.js b/server/lib/validation.jsindex 6c8fccbb31..19a9585a03 100644--- a/server/lib/validation.js+++ b/server/lib/validation.js@@ -1612,9 +1612,10 @@ export const IMPORTER_CONTENT_TYPES = Object.freeze(['short-story', 'novel', 'screenplay', 'comic-script',]);-// Hard ceiling at the schema layer; the orchestrator enforces a tighter-// 200K business-rule limit and returns a friendlier error. The 5MB ceiling-// here mirrors writersRoomDraftSaveSchema.+// Hard ceiling at the schema layer (mirrors writersRoomDraftSaveSchema). The+// orchestrator's IMPORTER_SOURCE_CHAR_LIMIT matches this 5MB ceiling and+// returns a friendlier error; the real operational limit is dynamic — the+// active provider's context window.const importerSourceField = z.string().min(1).max(5_000_000);// Per-issue verbatim-excerpt ceiling (seeds stages.prose / stages.comicScript).diff --git a/server/services/agentLifecycle.js b/server/services/agentLifecycle.jsindex d8b57c776d..aa8b34b574 100644--- a/server/services/agentLifecycle.js+++ b/server/services/agentLifecycle.js@@ -196,10 +196,13 @@ export async function spawnAgentForTask(task) {reason: status.reason});- // Try to get a fallback provider (check task-level, then provider-level, then system default)- const allProviders = await getAllProviders();+ // Try to get a fallback provider (check task-level, then provider-level, then system default).+ // getFallbackProvider indexes its providers arg by id, so pass a map — NOT the+ // { activeProvider, providers: [...] } shape getAllProviders() returns (mirrors promptRunner.js).+ const { providers: providerList = [] } = await getAllProviders();+ const providersMap = Object.fromEntries(providerList.map((p) => [p.id, p]));const taskFallbackId = task.metadata?.fallbackProvider;- const fallbackResult = await getFallbackProvider(provider.id, allProviders, taskFallbackId);+ const fallbackResult = await getFallbackProvider(provider.id, providersMap, taskFallbackId);if (fallbackResult) {emitLog('info', `Using fallback provider: ${fallbackResult.provider.id} (source: ${fallbackResult.source})`, {diff --git a/server/services/importer.js b/server/services/importer.jsindex ed2f2f2bbf..3e1f88ea55 100644--- a/server/services/importer.js+++ b/server/services/importer.js@@ -429,7 +429,10 @@ const COMIC_HEADER_MAX_LEN = 80;// AND require a standalone header form — so prose like "Issue resolved." or// "Issue 1 of the saga lay open" (content that merely starts with the keyword)// isn't mis-split. A title is captured only after a separator. Sharing the-// grammar keeps the import-time split and the render-time parse in agreement.+// grammar keeps the import-time split and the render-time parse in agreement —+// except for the COMIC_HEADER_MAX_LEN (80) length cap applied here but NOT by+// the render-time bare parser, so a rare >80-char PAGE/ISSUE header folds into+// the prior segment at split time yet still opens a page at render time.const ISSUE_HEADER_RE = new RegExp(`^issue\\b\\s*#?\\s*(${COMIC_NUM})\\b\\s*(?:[:.\\-–—]\\s*(.*))?\\s*$`, 'i');// `PAGE 1`, `PAGE ONE`, `PAGES 2-3`, `PAGE ONE (FIVE PANELS)`const PAGE_HEADER_RE = new RegExp(`^pages?\\b\\s*#?\\s*(${COMIC_NUM})\\b${COMIC_HEADER_TAIL}`, 'i');diff --git a/server/services/pipeline/editorialAnalysis.js b/server/services/pipeline/editorialAnalysis.jsindex 0291cf2769..6e27dc4804 100644--- a/server/services/pipeline/editorialAnalysis.js+++ b/server/services/pipeline/editorialAnalysis.js@@ -37,8 +37,10 @@ const NOTE_MAX = 500;// Cap the content we send to the model. Prose/script stage output is bounded// at STAGE_OUTPUT_MAX (~400KB) which would blow the context window (and the// JSON instruction block with it) on a long issue, yielding a truncated /-// malformed response that sanitizeAnalysis silently degrades to empty. ~48K-// chars (~12K tokens) leaves ample room for the prompt + a heavy-tier reply.+// malformed response that extractJson rejects (it throws "Invalid JSON in AI+// response", surfacing as an analysis error rather than a silent empty+// snapshot). ~48K chars (~12K tokens) leaves ample room for the prompt + a+// heavy-tier reply.const CONTENT_MAX = 48_000;const nowIso = () => new Date().toISOString();diff --git a/server/services/sharing/peerSync.js b/server/services/sharing/peerSync.jsindex 5a868cf46e..be4146c5a0 100644--- a/server/services/sharing/peerSync.js+++ b/server/services/sharing/peerSync.js@@ -1299,10 +1299,14 @@ export async function applyIncomingPush(payload) {for (const c of RECORD_KIND_SCHEMA_CATEGORIES.issue) relevantCategories.add(c);}// A linked collection only rides a non-deleted push (buildPushPayload drops- // it for tombstones) and is itself a live record when present. Mirror the- // merge predicate at the linkedCollection apply below exactly — it refuses- // the collection when the OWNER record is a tombstone — so the gate never- // blocks `mediaCollections` over a collection the merge would ignore.+ // it for tombstones) and is itself a live record when present. This gate+ // mirrors the merge predicate's OWNER-tombstone check (the merge refuses the+ // collection when the owner record is a tombstone) — so the gate never+ // blocks `mediaCollections` over a collection the merge would ignore. It is+ // intentionally MORE permissive on the collection itself: the extra+ // `linkedCollection.deleted !== true` check here is defensive (today's+ // exporter never bundles a deleted collection), and a tombstone collection+ // is schema-version-safe at any version anyway, so it needn't gate.if (record.deleted !== true && isPlainObject(linkedCollection) && linkedCollection.deleted !== true) {for (const c of RECORD_KIND_SCHEMA_CATEGORIES.mediaCollection) relevantCategories.add(c);}diff --git a/server/services/voice/tools.js b/server/services/voice/tools.jsindex 6717568690..13ee846e9f 100644--- a/server/services/voice/tools.js+++ b/server/services/voice/tools.js@@ -1675,10 +1675,15 @@ const TOOLS = [return Number.isFinite(n) ? n : null;};const settings = await getSettings().catch(() => ({}));+ // Treat the configured location as a both-or-neither pair (the save-time+ // schema enforces this, but a hand-edited settings.json could set only+ // one half). A half-set pair falls through to the default for BOTH+ // coordinates rather than mixing one custom value with one default.const cfgLat = numOrNull(settings?.location?.lat);const cfgLon = numOrNull(settings?.location?.lon);- const resolvedLat = numOrNull(lat) ?? cfgLat ?? DEFAULT_LAT;- const resolvedLon = numOrNull(lon) ?? cfgLon ?? DEFAULT_LON;+ const cfgValid = cfgLat !== null && cfgLon !== null;+ const resolvedLat = numOrNull(lat) ?? (cfgValid ? cfgLat : null) ?? DEFAULT_LAT;+ const resolvedLon = numOrNull(lon) ?? (cfgValid ? cfgLon : null) ?? DEFAULT_LON;if (resolvedLat < -90 || resolvedLat > 90 || resolvedLon < -180 || resolvedLon > 180) {return { ok: false, summary: 'Latitude must be -90..90 and longitude -180..180.' };}