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

Merge pull request #666 from atomantic/claim/comic-script-generation-panel-hardening

[._.]/ Adam Eivya2c037fcb1b4
diff --cc PLAN.md
index 6dcb6d1959,fbd162bdbc..a93e717e99
--- a/PLAN.md
+++ b/PLAN.md
@@@ -25,10 -25,9 +25,9 @@@ Claimable, well-specified, no decision
- [ ] [qwen-image-edit-init-image-required] **Qwen-Image-Edit dispatches without its required init image.** `qwen-image-edit` (registry `mediaModels.js:202`) loads `QwenImageEditPipeline` which requires an `image` arg; the entry is exposed in the normal image-gen model picker which permits text-only submission. Today the user picks the model, submits a text prompt, and the runner crashes deep inside the diffusers pipeline. Options: (a) add an `editOnly: true` flag + validate at `routes/imageGen.js` POST; (b) filter the model from the picker when no source image is uploaded; (c) reroute through a future `/api/image-gen/edit` endpoint.
- [ ] [hidream-requires-hf-token-fail-fast] **Probe HF token upfront for HiDream gated-encoder downloads.** `data.reference/media-models.json`'s HiDream entries carry `requiresHfToken: true`, but `scripts/z_image_turbo.py` `load_external_text_encoder()` does NOT call `probe_hf_auth()` the way `flux2_macos.py:265` does. A user without a valid HF token currently sees a multi-GB download attempt that fails with a 401 deep inside transformers. Mirror the FLUX.2 probe before invoking `transformers.from_pretrained()` on the gated encoder repo.
- [ ] [flux2-runner-sidecar-tests] **Test coverage for `generateImage`'s sidecar `meta` payload.** `server/services/imageGen/local.test.js` exercises `buildArgs` but never asserts on the sidecar `meta` object built inside `generateImage` — including the `referenceImageFilenames` + `referenceImageStrengths` fields. A focused test would need to either factor the meta-builder out of `generateImage` so it's callable without spawning Python, or stub the spawn + assert on the persisted sidecar JSON.
- - [ ] [comic-script-generation-panel-hardening] **Harden `pipeline-comic-script.md` to prevent content-in-page-description malformation at generation time.** The `comic-structure` editorial-review category (migration 057) catches pages where all content landed in the page-level description instead of panel definitions — that's a detection layer; the root fix is in the generation prompt. Add explicit rules to `data.reference/prompts/stages/pipeline-comic-script.md`: (a) "NEVER put action, dialogue, or scene content in the page-level description — that is ONLY for layout intent (1–3 lines max)"; (b) "Every page MUST have 4–6 discrete `Panel N` blocks with `Description:`, `Caption:`, `Dialogue:`, and `SFX:` fields." Add a migration alongside the prompt change.
- [ ] [manuscript-review-sync] **Wire the manuscript-review comment set into cross-install sync.** `data/pipeline-series/{id}/manuscript-review.json` is written as a sibling of the series record but is NOT carried by `exportSeries`/`importSeries` or the peer-sync path. `manuscriptReview.mergeReviewFromSync(seriesId, remoteReview)` (LWW-per-comment) already exists; what's missing is (a) including the review document in the series export bundle, (b) a wire-schema-version gate in `server/lib/schemaVersions.js`, and (c) calling `mergeReviewFromSync` on the receiving side. Accepted *fixes* already sync (they write to issue stage outputs); only the comment list/status/dismissals don't propagate yet.
-- [ ] [season-continuity-extract-honors-series-llm] **Season-episodes continuity extract doesn't honor the series LLM (or a model override).** The continuity `extractCanonFromProse` call in `generateSeasonEpisodes` (`server/routes/pipeline.js`, the `if (body.commit)` block) passes only `providerOverride: body.providerOverride` — no `series.llm` fallback and no `modelOverride` — so it falls back to the global active provider instead of the series-pinned LLM. Not a correctness bug, just an inconsistency. Add the same `providerMatchesSeries`-guarded provider/model resolution used by the extract-canon and extract-scenes routes.
- [ ] [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).
+- [ ] [series-llm-override-resolution-helper] **Extract the series-LLM override resolution into one shared helper.** The `providerMatchesSeries`-guarded provider/model resolution (`provider = override || series.llm?.provider`; only inherit `series.llm?.model` when the effective provider still matches the series provider) is now inlined in three routes in `server/routes/pipeline.js`: extract-canon (~line 1855, body field `body.model`), extract-scenes (~line 1705, inlines only the boolean as `sceneProviderMatchesSeries` and folds the rest into the `extractScenes` call), and season-episodes-generate (~line 1284, body field `body.modelOverride`). Extract a pure `resolveSeriesLlmOverride(series, { overrideProvider, overrideModel })` returning `{ provider, model, providerMatchesSeries }` into `server/lib/` (new module → register in the `index.js` barrel + README per the maintenance rule), and migrate all three call sites (each maps its own body field name). Deferred from the season-continuity-extract-honors-series-llm PR: the body-field-name + variable-name skew across sites means a careful lift, it touches two proven live routes + their tests, and the new lib module trips the barrel rule — its own PR. Surfaced by /simplify (reuse + altitude, 2026-06-02).
- [ ] [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`)