Skip to content

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

address review: gate Generate on saving, drop canon from manual update payload, drop premature cap in characters-bucket fold, capture canon-clobber risk in PLAN

[._.]/ Adam Eivy0167e90844f6
diff --git a/client/src/pages/UniverseBuilder.jsx b/client/src/pages/UniverseBuilder.jsx
index 0af164a595..2486c025f3 100644
--- a/client/src/pages/UniverseBuilder.jsx
+++ b/client/src/pages/UniverseBuilder.jsx
@@ -457,7 +457,7 @@ export default function UniverseBuilder() {
return;
}
setSaving(true);
- const payload = {
+ const basePayload = {
name: draft.name.trim(),
starterPrompt: draft.starterPrompt || '',
logline: draft.logline || '',
@@ -465,16 +465,18 @@ export default function UniverseBuilder() {
styleNotes: draft.styleNotes || '',
categories: draft.categories,
compositeSheets: draft.compositeSheets || [],
- // Canon arrays must be included on the manual Save/Create path too —
- // the post-expand auto-save covers most paths, but a user editing a
- // saved world's canon manually still goes through this handler.
- characters: draft.characters || [],
- settings: draft.settings || [],
- objects: draft.objects || [],
influences: ensureInfluences(draft.influences),
locked: draft.locked || {},
llm: draft.llm || {},
};
+ // Canon arrays are wholesale-replaced server-side, so including them on
+ // a manual update can clobber concurrent edits from the canon UI / other
+ // tabs. Send canon ONLY on create (the new universe starts empty and
+ // needs the expanded canon as its initial state). On update, the canon
+ // UI persists its mutations via targeted PATCHes already.
+ const payload = selectedId
+ ? basePayload
+ : { ...basePayload, characters: draft.characters || [], settings: draft.settings || [], objects: draft.objects || [] };
const result = selectedId
? await updateUniverse(selectedId, payload).catch((e) => { toast.error(`Save failed: ${e.message}`); return null; })
: await createUniverse(payload).catch((e) => { toast.error(`Save failed: ${e.message}`); return null; });
@@ -1156,7 +1158,7 @@ export default function UniverseBuilder() {
<div className="flex items-center gap-2 flex-wrap">
<button
onClick={handleExpand}
- disabled={expanding || !draft.starterPrompt?.trim()}
+ disabled={expanding || saving || !draft.starterPrompt?.trim()}
className="px-3 py-2 bg-purple-600/30 hover:bg-purple-600/50 disabled:opacity-50 text-purple-200 border border-purple-600/40 rounded flex items-center gap-2 min-h-[40px]"
>
{expanding ? <Loader2 size={16} className="animate-spin" /> : <Wand2 size={16} />}
diff --git a/server/services/universeBuilder.js b/server/services/universeBuilder.js
index 19591d28d6..a96af58cbb 100644
--- a/server/services/universeBuilder.js
+++ b/server/services/universeBuilder.js
@@ -463,7 +463,11 @@ function foldRetiredCharactersBucket(raw, canon) {
if (!label) continue;
const nameKey = normalizeBibleName(label);
if (seen.has(nameKey)) continue;
- if (next.characters.length >= BIBLE_LIMITS.ENTRIES_PER_BIBLE_MAX) break;
+ // Do NOT cap by length here against raw canon entries — they haven't
+ // been sanitized yet, and a malformed bunch of pre-existing entries
+ // could cause this fold to skip legitimate variations. sanitizeBibleList
+ // applies ENTRIES_PER_BIBLE_MAX after both arrays are merged and shape-
+ // validated.
const entry = {
name: label,
prompt: trimTo(typeof variation === 'object' ? variation?.prompt : '', BIBLE_LIMITS.PROMPT_MAX),