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
address review (codex): write corrected beats to idea.input too so the fix reaches the manuscript
Adam Eivyc371c8372a66
diff --git a/server/services/pipeline/arcPlanner/beatContinuity.js b/server/services/pipeline/arcPlanner/beatContinuity.jsindex 82f4991ca8..c9a42bf1de 100644--- a/server/services/pipeline/arcPlanner/beatContinuity.js+++ b/server/services/pipeline/arcPlanner/beatContinuity.js@@ -134,8 +134,10 @@ export async function resolveBeatContinuity(seriesId, options = {}) {* Apply the resolver's per-issue beat rewrites to the canonical issue records.* Each correction targets one issue by its series-global episode number (with* `seasonNumber` as a disambiguating cross-check, mirroring- * `applyEpisodeResolutions`). Writes the new beats to `idea.output` while- * preserving the existing `idea.input` synopsis.+ * `applyEpisodeResolutions`). Writes the new beats to BOTH `idea.input` and+ * `idea.output` — see the inline note: downstream generation reads+ * `stageContentOf(idea)` (input-preferred), so writing only `idea.output` would+ * leave the manuscript adapting the stale synopsis.** After rewriting an issue's beats, the now-stale downstream text stages* (prose/comicScript/teleplay) are cleared so the conductor regenerates them from@@ -176,7 +178,18 @@ export async function applyBeatResolutions(seriesId, series, episodes) {applied.push({ issueId: issue.id, number: issue.number, seasonNumber: edit.seasonNumber, skipped: 'no-beats' });continue;}+ // Write the corrected beats to BOTH idea.input AND idea.output. This is+ // load-bearing, not redundant: downstream text generation adapts an issue+ // from `stageContentOf(idea)`, which prefers `idea.input` (the synopsis seed+ // episodeSeedPass writes) over `idea.output` (the beats) — so a correction+ // written ONLY to idea.output is invisible to prose/script generation, which+ // would keep adapting the stale synopsis and the fix would never reach the+ // manuscript. Writing it to idea.input makes the corrected beats the source+ // the downstream stages actually read; writing it to idea.output keeps the+ // beat corpus (re-verify, the human beat view, renderVolumeIssue) consistent+ // with the fix so the convergence loop converges.await updateStageWithLatest(issue.id, 'idea', () => ({+ input: edit.beats,output: edit.beats,status: 'ready',errorMessage: '',diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.jsindex 92399a41ad..a75f4da58b 100644--- a/server/services/pipeline/seriesAutopilot.test.js+++ b/server/services/pipeline/seriesAutopilot.test.js@@ -121,6 +121,7 @@ const seasonsSvc = await import('./seasons.js');const issuesSvc = await import('./issues.js');const autopilot = await import('./seriesAutopilot.js');const arcPlanner = await import('./arcPlanner.js');+const { stageContentOf } = await import('./textStages.js');const { resolveNextStep, requiredScriptStages, scriptStructurallyReady, visualReady, wantsComic } = autopilot;// A comic script string that parseComicScript turns into >=1 page/panel.@@ -902,14 +903,19 @@ describe('beat-continuity resolve (#1510)', () => {return { series: fresh, issueId: issue.id };}- it('rewrites beats in place and preserves the synopsis input', async () => {+ it('writes the corrected beats to BOTH idea.input and idea.output so prose adapts from the fix', async () => {const { series, issueId } = await seedIssueWithBeats();const applied = await applyBeatResolutions(series.id, series, [{ seasonNumber: 1, episodeNumber: 1, beats: 'corrected beats' }]);expect(applied).toEqual([expect.objectContaining({ issueId, number: 1, corrected: true })]);const issue = await issuesSvc.getIssue(issueId);expect(issue.stages.idea.output).toBe('corrected beats');- expect(issue.stages.idea.input).toBe('synopsis'); // synopsis preserved+ // idea.input must carry the fix too — downstream text generation reads+ // stageContentOf(idea), which prefers idea.input, so a fix only in+ // idea.output would never reach the regenerated prose/scripts.+ expect(issue.stages.idea.input).toBe('corrected beats');expect(issue.stages.idea.status).toBe('ready');+ // The real prose source-of-truth resolver must now surface the correction.+ expect(stageContentOf(issue.stages.idea)).toBe('corrected beats');});it('clears stale downstream prose/scripts AND comicPages art so they regenerate from the corrected beats', async () => {