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
fix: preserve autopilot resume options
[._.]/ Adam Eivy7ab68f153bf5
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 587da9d9d6..e5a5823691 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -109,6 +109,8 @@## Series Pipeline+- **A paused Series Autopilot run now resumes with its visual and gap-filing choices intact.** Those two controls were run-local, but the pause marker remembered only the current step and error. Reloading the page or restarting PortOS therefore made the Options form look like a brand-new run: visuals returned to their default and "File CoS tasks" silently turned off, so a later unresolved gap could disappear instead of being tracked. Active and paused markers now carry only those two safe continuation choices, the resume form restores them, and a completed run or different series still gets clean defaults. The one-shot "Unlock everything" consent is deliberately not re-armed: its pass already leaves the records unlocked, and repeating a spent mutation is not part of resuming.+- **Series autopilot now secures the foundation before it grows a manuscript.** The foundation judge now reads the actual volume and episode synopses, authored character arcs, and series voice/exemplars — and its cache invalidates when any of them change. A weighted average can no longer hide a critically weak dimension: every world/character/structure/craft score must also clear a floor. Character findings repair the referenced core cast as an ensemble and write whole-series character arcs instead of expanding whichever unrelated record has the most blanks; craft findings repair the series voice and add concrete tuning-fork examples instead of rewriting the universe's visual style; world findings carry the judge's specific directive into the world-bible pass. Foundation and structural verification now form one bounded planning loop: either one's repairs invalidate the other's verdict, every volume gets its own synopsis-level verification alongside the cross-volume pass, and autopilot refuses to start beat sheets until the two gates jointly converge.- **Series autopilot no longer manufactures the duplicate volumes it then gets stuck on.** Arc auto-resolve matched the LLM's rewritten volumes back to your existing ones by `id` alone — but the resolve prompt routinely returns a rewritten volume *without* echoing its id, and that read as "a brand new volume", minting a second record. In the autopilot's unlock-for-run mode, which deliberately refuses to let a rewrite delete a volume, the original was then re-inserted right next to the mint. So every auto-resolve round left one more `Volume 1` than it started with, arc-verify filed the pile-up as a blocking finding, and the run paused for "no net progress" while pointing at damage it had caused itself. A rewrite is now matched to the record it is a rewrite *of* — by id, then title, then an unambiguous volume number — and lands on that record, keeping its episodes, themes and lock attached. There is no positional guessing: a volume that genuinely doesn't match still mints, because a wrong guess would overwrite one volume's prose with another's.diff --git a/client/src/components/pipeline/AutopilotPanel.jsx b/client/src/components/pipeline/AutopilotPanel.jsxindex 82b40906db..d1790c2266 100644--- a/client/src/components/pipeline/AutopilotPanel.jsx+++ b/client/src/components/pipeline/AutopilotPanel.jsx@@ -417,6 +417,18 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdateconst [showOpts, setShowOpts] = useState(false);const [includeVisual, setIncludeVisual] = useState(true);const [fileGaps, setFileGaps] = useState(false);++ // A paused run is a continuation, not a new configuration. Restore the two+ // run-local toggles the server stamped onto its marker so a reload/restart+ // cannot silently turn gap filing off (or visuals back on). A completed run+ // and a different series intentionally return to the ordinary defaults.+ const resumeIncludeVisual = series?.autopilot?.resumeOptions?.includeVisual;+ const resumeFileGaps = series?.autopilot?.resumeOptions?.fileGaps;+ useEffect(() => {+ const paused = series?.autopilot?.status === 'paused';+ setIncludeVisual(paused && typeof resumeIncludeVisual === 'boolean' ? resumeIncludeVisual : true);+ setFileGaps(paused && typeof resumeFileGaps === 'boolean' ? resumeFileGaps : false);+ }, [seriesId, series?.autopilot?.status, resumeIncludeVisual, resumeFileGaps]);// Persist a setting (clamped) so a later Resume picks it up server-side.// patchSettingsSlice is a GET-merge-PUT, so two overlapping calls (a blur save// racing start()'s save) can lose an update — a slow earlier PUT lands after adiff --git a/client/src/components/pipeline/AutopilotPanel.test.jsx b/client/src/components/pipeline/AutopilotPanel.test.jsxindex 5876eb55e2..912f68fe00 100644--- a/client/src/components/pipeline/AutopilotPanel.test.jsx+++ b/client/src/components/pipeline/AutopilotPanel.test.jsx@@ -375,6 +375,25 @@ describe('AutopilotPanel', () => {expect(screen.getByRole('button', { name: /resume autopilot/i })).toBeInTheDocument();});+ it('restores run-local visual and gap choices when a paused run resumes', async () => {+ renderPanel({+ id: 's1',+ targetFormat: 'comic',+ autopilot: {+ status: 'paused',+ resumeOptions: { includeVisual: false, fileGaps: true },+ },+ });+ await waitFor(() => expect(getPipelineAutopilotStatus).toHaveBeenCalled());+ fireEvent.click(screen.getByRole('button', { name: /options/i }));+ expect(screen.getByRole('checkbox', { name: /draft cover \+ all interior pages/i })).not.toBeChecked();+ expect(screen.getByRole('checkbox', { name: /file CoS tasks for gaps/i })).toBeChecked();+ fireEvent.click(screen.getByRole('button', { name: /resume autopilot/i }));+ await waitFor(() => expect(startPipelineAutopilot).toHaveBeenCalledWith(+ 's1', { includeVisual: false, fileGaps: true }, { silent: true },+ ));+ });+it('flags a divergence pause with a "not converging" badge (#1571)', async () => {renderPanel({id: 's1',diff --git a/server/services/pipeline/series.js b/server/services/pipeline/series.jsindex 60996b3549..40fd101357 100644--- a/server/services/pipeline/series.js+++ b/server/services/pipeline/series.js@@ -119,6 +119,21 @@ export const AUTOPILOT_STATUSES = Object.freeze(['idle', 'running', 'paused', 'dexport const AUTOPILOT_STEP_MAX = 80;export const AUTOPILOT_ERROR_MAX = 1000;const AUTOPILOT_FINDING_SEVERITIES = ['high', 'medium', 'low'];++// The two local Options toggles that must survive a pause/reload so "Resume"+// continues the run the user actually launched. These are deliberately scoped+// to the paused run marker instead of global settings: a future scheduled run+// should not inherit one series' gap-filing choice, while a resume should not+// silently turn it off. The destructive-consent `unlockForRun` flag is NOT+// carried here — the unlock pass spends that consent once and leaves the+// records unlocked, so re-arming it would only repeat a completed mutation.+const sanitizeAutopilotResumeOptions = (raw) => {+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return null;+ const out = {};+ if (typeof raw.includeVisual === 'boolean') out.includeVisual = raw.includeVisual;+ if (typeof raw.fileGaps === 'boolean') out.fileGaps = raw.fileGaps;+ return Object.keys(out).length ? out : null;+};// Why a bounded-retry gate paused the run. Convergence gates (#1571):// `maxRounds` (the verify→resolve loop ran out of rounds) vs `divergence` (it// stopped converging early — the blocking count failed to drop). Child runners@@ -174,6 +189,10 @@ export const sanitizeAutopilot = (raw) => {// strip is real data loss), a stale peer that drops pauseKind just briefly// shows a generic "paused" banner until the next run re-stamps it.pauseKind: AUTOPILOT_PAUSE_KINDS.includes(raw.pauseKind) ? raw.pauseKind : null,+ // Run-local choices restored by the Options form on a paused resume. This is+ // transient orchestration state, not creative content, so it shares the+ // marker's no-schema-gate posture.+ resumeOptions: sanitizeAutopilotResumeOptions(raw.resumeOptions),// #1572 — a `done` run that filed blocking script-craft gaps (the advisory// craft gate) carries the count here so the marker can qualify "complete"// instead of reporting clean while downstream rendering is still blocked.diff --git a/server/services/pipeline/series.test.js b/server/services/pipeline/series.test.jsindex dee3aba0da..79bd5a553c 100644--- a/server/services/pipeline/series.test.js+++ b/server/services/pipeline/series.test.js@@ -878,4 +878,21 @@ describe('pipeline series service', () => {expect(svc.sanitizeAutopilot({ status: 'paused', healthBreakdown: [] }).healthBreakdown).toBeNull();});});++ describe('sanitizeAutopilot resumeOptions', () => {+ it('preserves only the paused run toggles that the UI can safely restore', () => {+ expect(svc.sanitizeAutopilot({+ status: 'paused',+ resumeOptions: { includeVisual: false, fileGaps: true, unlockForRun: true },+ }).resumeOptions).toEqual({ includeVisual: false, fileGaps: true });+ });++ it('drops malformed resume options', () => {+ expect(svc.sanitizeAutopilot({ status: 'paused' }).resumeOptions).toBeNull();+ expect(svc.sanitizeAutopilot({+ status: 'paused',+ resumeOptions: { includeVisual: 'yes', fileGaps: 1 },+ }).resumeOptions).toBeNull();+ });+ });});diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.jsindex a88e982f1d..3dc43630bb 100644--- a/server/services/pipeline/seriesAutopilot.test.js+++ b/server/services/pipeline/seriesAutopilot.test.js@@ -1682,6 +1682,20 @@ describe('autopilot conductor', () => {expect(removeByMetadata).toHaveBeenCalledWith('autopilotPauseSeriesId', seriesId);});+ it('persists run-local visual and gap choices for a paused resume', async () => {+ editorialFindings = [{ severity: 'high', problem: 'missing scene', issueNumber: 1 }];+ const { seriesId } = await seedComplete();+ await autopilot.startSeriesAutopilot(seriesId, {+ includeVisual: false,+ fileGaps: true,+ maxEditorialRounds: 1,+ });+ await waitFor(runFinished(seriesId));+ const series = await seriesSvc.getSeries(seriesId);+ expect(series.autopilot?.status).toBe('paused');+ expect(series.autopilot?.resumeOptions).toEqual({ includeVisual: false, fileGaps: true });+ });+it('does not notify on a clean complete (#1615)', async () => {const { seriesId } = await seedComplete();await autopilot.startSeriesAutopilot(seriesId, {});diff --git a/server/services/pipeline/seriesAutopilot/session.js b/server/services/pipeline/seriesAutopilot/session.jsindex e3eaa65038..fd8c653614 100644--- a/server/services/pipeline/seriesAutopilot/session.js+++ b/server/services/pipeline/seriesAutopilot/session.js@@ -96,8 +96,19 @@ export function scheduleCleanup(seriesId, record) {// Thin persisted marker for resume/paused UI + boot recovery. NOT a step// cursor — see module header. Best-effort; a marker write must never abort a run.export async function persistMarker(seriesId, patch) {+ const run = runs.get(seriesId);+ const resumable = ['running', 'paused', 'error'].includes(patch.status) && run?.options+ ? {+ includeVisual: run.options.includeVisual !== false,+ fileGaps: run.options.fileGaps === true,+ }+ : null;await updateSeries(seriesId, {- autopilot: { ...patch, updatedAt: new Date().toISOString() },+ autopilot: {+ ...patch,+ ...(resumable ? { resumeOptions: resumable } : {}),+ updatedAt: new Date().toISOString(),+ },}).catch((err) => {console.log(`⚠️ autopilot: marker write failed for ${seriesId.slice(0, 12)}: ${err.message}`);});