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

refactor([story-builder-issue-llm-seeding]): simplify issue-gen toast + document deliberate canon-skip

[._.]/ Adam Eivy0a2b90280671
diff --git a/PLAN.md b/PLAN.md
index 178258c72f..aa64663bd0 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -57,6 +57,7 @@ Claimable, well-specified, no decision needed — `/claim`-able. Unordered.
- [ ] [coalesce-fallback-provider-failure-storm] **Coalesce duplicate fallback work during an N-way provider-failure storm.** When a stuck provider has N simultaneous in-flight calls, each failure independently runs `pickFallbackProvider` → `getAllProviders()` → `loadProviders()` (reads `providers.json` from disk every time — no in-memory cache) → `markUnavailable` (writing `provider-status.json`). Two compounding fixes: (a) add a tiny TTL cache (~1s) to `aiToolkit/providers.js#loadProviders`; (b) coalesce per-provider failure handling in `promptRunner.js` with a `Map<providerId, Promise>` so subsequent failures for the same provider await the first's mark-and-pick result. Acceptance: under a simulated 10-concurrent-failure load, providers.json is read at most twice and provider-status.json is written once. Surfaced by /simplify during the ai-fallback PR (2026-05-22).
- [ ] [extract-use-universe-load-hook] **Extract a `useUniverse(universeId)` load hook.** `client/src/components/pipeline/stages/StoryboardsStage.jsx` (~line 57) and `NounsStage.jsx` (~line 149) now run a byte-identical `useMounted` + `let cancelled` + `getUniverse(series.universeId).then(...).catch(...)` effect to load the linked universe record. Extract a `client/src/hooks/useUniverse.js` returning `[universe, loading, error]` (handling the mount/cancel guards internally), register it in the hooks `index.js` barrel + README, and migrate both call sites. Deferred from the wardrobe-picking PR: migrating `NounsStage` is outside that diff's scope and the new module trips the barrel maintenance rule. Surfaced by /simplify (reuse, 2026-06-01).
- [ ] [wardrobe-appearance-id-route-validation] **Validate `characterAppearances` ids against the linked universe at the persistence boundary.** The generic `POST /issues/:id/stages/:stageId/visual` route (`visualGenerateSchema` in `server/routes/pipeline.js`) accepts `characterAppearances` and validates only shape (`characterId`/`wardrobeId` are non-empty strings), not that the ids actually resolve to a canon character + one of its wardrobes. Today `buildScenePrompt`'s defensive read silently drops unresolved picks (matches the existing scene pass-through convention for `shots`), so this is robustness/clarity, not correctness. If tightened later, resolve the ids against `loadBibleContext(issueId).canon.characters` at the route and 400 on a dangling id rather than relying on the prompt-builder's silent drop. Surfaced by /simplify (altitude, 2026-06-01).
+- [ ] [create-issue-preload-series-for-batch] **`createIssue`'s renumber pass re-reads the series on every call — preload it for batch episode seeding.** `createIssue` (`server/services/pipeline/issues.js`) calls `getSeries()` inside its `renumberInline` pass on every invocation. `commitEpisodesToIssues` (`server/services/pipeline/arcPlanner.js`) creates one issue per episode in a loop, so a 12-episode season does 12 redundant `getSeries()` reads of an unchanging record (and `generateIssuesFromArc` already fetched it once). Add a `createIssueWithPreloadedSeries(series, input)` variant (or a `{ preloadedSeries }` option) that threads the already-fetched series into `renumberInline`, and route the batch loop through it. Pre-existing in `createIssue` (the Pipeline season-episodes route pays the same cost); LLM-bound batch so the realized win is small — surfaced by /simplify (efficiency) during the story-builder-issue-llm-seeding PR (2026-06-01). Deferred because it touches the `issues.js` renumber internals beyond this diff's scope.
## Blocked / Deferred (skip for `/claim`)
diff --git a/client/src/pages/StoryBuilder.jsx b/client/src/pages/StoryBuilder.jsx
index ff6b48d2c6..833a4ebda3 100644
--- a/client/src/pages/StoryBuilder.jsx
+++ b/client/src/pages/StoryBuilder.jsx
@@ -692,14 +692,13 @@ function IssuesPanel({ session, series, issues, onChanged }) {
if (!res) return;
const created = res.createdIssues?.length || 0;
const skipped = (res.seasons || []).filter((s) => s.skipped);
+ const skipReason = skipped.length ? skipped[0].reason : null;
if (created > 0) {
toast.success(`Created ${created} issue${created === 1 ? '' : 's'} from the arc`);
+ // Surface partial-batch skips so a locked/empty season doesn't fail silently.
+ if (skipReason) toast.error(`Skipped ${skipped.length} season${skipped.length === 1 ? '' : 's'}: ${skipReason}`);
} else {
- toast.error(skipped.length ? `No issues created — ${skipped[0].reason}` : 'No issues were generated');
- }
- // Surface partial-batch skips so a locked/empty season doesn't fail silently.
- if (created > 0 && skipped.length) {
- toast.error(`Skipped ${skipped.length} season${skipped.length === 1 ? '' : 's'}: ${skipped[0].reason}`);
+ toast.error(skipReason ? `No issues created — ${skipReason}` : 'No issues were generated');
}
onChanged();
};
diff --git a/server/services/storyBuilder.js b/server/services/storyBuilder.js
index d8d0269e3a..7dfc2a14e7 100644
--- a/server/services/storyBuilder.js
+++ b/server/services/storyBuilder.js
@@ -439,6 +439,14 @@ export async function setIssueLock(id, issueId, locked) {
*
* `options.seasonId` scopes generation to a single season; omit to cover every
* season on the arc.
+ *
+ * Deliberately does NOT run the Pipeline route's post-create continuity canon
+ * extraction (extractCanonFromProse). In the builder, canon is owned by the
+ * dedicated `characters` step where the user curates it against the universe;
+ * episode synopses here are thin idea-stage seeds, so auto-extracting canon
+ * from them would push low-signal entries the user then has to clean up. Issue
+ * creation is the focused job of this action — the characters step handles
+ * canon.
*/
export async function generateIssuesFromArc(id, options = {}) {
const session = await getStorySession(id);