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 (codex): drop stale series concept on universe switch; apply generated shape verbatim

[._.]/ Adam Eivy0fb8fee73435
diff --git a/client/src/pages/Pipeline.jsx b/client/src/pages/Pipeline.jsx
index 215a19111b..a67de92d3c 100644
--- a/client/src/pages/Pipeline.jsx
+++ b/client/src/pages/Pipeline.jsx
@@ -7,7 +7,7 @@
* drills into its detail page where issues are created and managed.
*/
-import { useEffect, useMemo, useState } from 'react';
+import { useEffect, useMemo, useRef, useState } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import { Plus, Workflow as WorkflowIcon, Trash2, Loader2, Globe2, FileInput, Sparkles } from 'lucide-react';
import toast from '../components/ui/Toast';
@@ -54,6 +54,10 @@ export default function Pipeline() {
const [generating, setGenerating] = useState(false);
const [showForm, setShowForm] = useState(false);
const [form, setForm] = useState(emptyForm);
+ // Mirror the live universe selection so an in-flight generate can detect the
+ // user switching universes mid-request and drop the now-stale concept.
+ const universeIdRef = useRef(form.universeId);
+ useEffect(() => { universeIdRef.current = form.universeId; }, [form.universeId]);
useEffect(() => {
Promise.all([
@@ -105,19 +109,28 @@ export default function Pipeline() {
toast.error('Pick a universe first — the generator uses it as seed material');
return;
}
+ const requestedUniverseId = form.universeId;
setGenerating(true);
- const concept = await generateSeriesConcept(form.universeId, {}, { silent: true }).catch((err) => {
+ const concept = await generateSeriesConcept(requestedUniverseId, {}, { silent: true }).catch((err) => {
toast.error(err.message || 'Failed to generate a series concept');
return null;
});
setGenerating(false);
if (!concept) return;
+ // The request can outlive the selection: if the user switched universes
+ // while it was in flight, applying a concept seeded from the old universe
+ // would pair the new universeId with a mismatched story. Drop the stale
+ // result — gate both the form merge and the toast on the live selection.
+ if (universeIdRef.current !== requestedUniverseId) return;
setForm((f) => ({
...f,
name: concept.name || f.name,
logline: concept.logline || f.logline,
premise: concept.premise || f.premise,
- shape: concept.shape || f.shape,
+ // The generated concept owns the story shape — apply it verbatim,
+ // including null (LLM picked none), so a stale earlier pick can't
+ // misrepresent the freshly generated concept.
+ shape: concept.shape,
}));
toast.success(
concept.rationale