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
make autopilot verify/review convergence rounds configurable instead of a hard 3-round abort
[._.]/ Adam Eivy2d624c263055
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 5330554ef3..445974822e 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -10,6 +10,7 @@## Added+- **Autopilot convergence rounds are now configurable.** The series autopilot re-verifies the arc (and re-reviews the manuscript) in bounded auto-resolve loops, and previously hard-stopped after 3 arc rounds / 2 editorial rounds with "did not converge after 3 rounds" — leaving no way to give a stubborn arc more attempts. You can now set **Arc verify rounds** and **Editorial rounds** (0–20, where 0 skips that gate) in Autonomous mode → **Options**; the values persist as a per-install default and are reused on **Resume**. A per-run override still wins over the saved default, which wins over the built-in floor (3 / 2). When a gate still can't auto-resolve within the limit, the pause message now says how many blocking findings remain and points you to edit the arc/manuscript or raise the limit and resume.- Editorial Checks page now has an AI provider + model selector that configures the editorial pass. Leave it on "Default provider" to use the active/stage provider, or pick a specific provider/model to override the LLM-backed checks for that run.- App **Automation** tabs now show a banner when scheduled automation is globally paused, with a one-click **Resume**. Manually clicking **Run** on a task now bypasses the global pause — the pause only stops scheduled/autonomous spawning, not explicit user triggers.- **Vite Dev-UI host guard.** Launching a managed app's Dev UI over Tailscale used to fail with Vite's "Blocked request. This host (…) is not allowed" because Vite ≥5 rejects unknown hosts. The app detail view now checks each online Vite app's config against the host PortOS is served under and shows a warning banner when it would be blocked, with two one-click fixes: **Allow all hosts (auto)** deterministically rewrites the app's `vite.config` to `server.allowedHosts: true` (safe on a private Tailscale network), and **Fix with AI** queues a CoS agent to edit (or create) the app's `vite.config` in its own repo for configs too unusual to auto-edit. Launching by IP/localhost already works since Vite never blocks those.diff --git a/client/src/components/pipeline/AutopilotPanel.jsx b/client/src/components/pipeline/AutopilotPanel.jsxindex bedfa43020..85b70de2dd 100644--- a/client/src/components/pipeline/AutopilotPanel.jsx+++ b/client/src/components/pipeline/AutopilotPanel.jsx@@ -14,8 +14,22 @@ import {getPipelineSeriesCanonReadiness,getPipelineSeries,listPipelineIssues,+ getSettings,+ patchSettingsSlice,} from '../../services/api';+// Convergence-round bounds — mirror the server (seriesAutopilot.js + the+// pipelineEditorialChecks settings schema). 0 = skip that gate entirely.+const ROUND_MIN = 0;+const ROUND_MAX = 20;+const DEFAULT_ARC_ROUNDS = 3;+const DEFAULT_EDITORIAL_ROUNDS = 2;+const clampRound = (n, fallback) => {+ const v = Number(n);+ if (!Number.isFinite(v)) return fallback;+ return Math.max(ROUND_MIN, Math.min(ROUND_MAX, Math.round(v)));+};+const SEVERITY_COLORS = {high: 'text-port-error border-port-error/40 bg-port-error/10',medium: 'text-port-warning border-port-warning/40 bg-port-warning/10',@@ -91,9 +105,32 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdateconst [showOpts, setShowOpts] = useState(false);const [includeVisual, setIncludeVisual] = useState(true);const [fileGaps, setFileGaps] = useState(false);+ const [arcRounds, setArcRounds] = useState(DEFAULT_ARC_ROUNDS);+ const [editorialRounds, setEditorialRounds] = useState(DEFAULT_EDITORIAL_ROUNDS);const [canon, setCanon] = useState(null);const [canonLoading, setCanonLoading] = useState(false);+ // Load the persisted convergence-round defaults so the Options inputs reflect+ // the install's setting (the autopilot reads the same setting server-side when+ // a run/resume doesn't carry a per-run override).+ useEffect(() => {+ let canceled = false;+ getSettings({ silent: true })+ .then((s) => {+ if (canceled) return;+ const pec = s?.pipelineEditorialChecks || {};+ if (Number.isInteger(pec.maxArcVerifyRounds)) setArcRounds(pec.maxArcVerifyRounds);+ if (Number.isInteger(pec.maxEditorialRounds)) setEditorialRounds(pec.maxEditorialRounds);+ })+ .catch(() => null);+ return () => { canceled = true; };+ }, []);++ // Persist a round setting (clamped) so a later Resume picks it up server-side.+ const persistRounds = useCallback((patch) => {+ patchSettingsSlice('pipelineEditorialChecks', patch, { silent: true }).catch(() => null);+ }, []);+const { latest, frames } = usePipelineProgress(pipelineAutopilotSseUrl, [seriesId], { enabled: active });const onSeriesUpdateRef = useRef(onSeriesUpdate);@@ -149,7 +186,12 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdateconst start = useCallback(async () => {setStarting(true);setPlan(null);- const res = await startPipelineAutopilot(seriesId, { includeVisual, fileGaps }, { silent: true })+ const res = await startPipelineAutopilot(seriesId, {+ includeVisual,+ fileGaps,+ maxArcVerifyRounds: clampRound(arcRounds, DEFAULT_ARC_ROUNDS),+ maxEditorialRounds: clampRound(editorialRounds, DEFAULT_EDITORIAL_ROUNDS),+ }, { silent: true }).catch((err) => { toast.error(err.message || 'Could not start autopilot'); return null; });setStarting(false);if (!res) return;@@ -159,7 +201,7 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate// effect can reject a stale terminal frame from the previous run.activeRunIdRef.current = res.runId || null;setActive(true);- }, [seriesId, includeVisual, fileGaps]);+ }, [seriesId, includeVisual, fileGaps, arcRounds, editorialRounds]);const cancel = useCallback(async () => {await cancelPipelineAutopilot(seriesId).catch(() => null);@@ -232,6 +274,45 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate<input type="checkbox" checked={fileGaps} onChange={(e) => setFileGaps(e.target.checked)} />File CoS tasks for gaps it can't resolve</label>+ <div className="flex flex-wrap gap-4 pt-1">+ <div className="flex items-center gap-2">+ <label htmlFor="autopilot-arc-rounds" className="text-xs text-gray-300">Arc verify rounds</label>+ <input+ id="autopilot-arc-rounds"+ type="number"+ min={ROUND_MIN}+ max={ROUND_MAX}+ value={arcRounds}+ onChange={(e) => setArcRounds(e.target.value === '' ? '' : Number(e.target.value))}+ onBlur={() => {+ const v = clampRound(arcRounds, DEFAULT_ARC_ROUNDS);+ setArcRounds(v);+ persistRounds({ maxArcVerifyRounds: v });+ }}+ className="w-16 px-2 py-1 rounded text-xs bg-port-bg border border-port-border text-gray-200"+ />+ </div>+ <div className="flex items-center gap-2">+ <label htmlFor="autopilot-editorial-rounds" className="text-xs text-gray-300">Editorial rounds</label>+ <input+ id="autopilot-editorial-rounds"+ type="number"+ min={ROUND_MIN}+ max={ROUND_MAX}+ value={editorialRounds}+ onChange={(e) => setEditorialRounds(e.target.value === '' ? '' : Number(e.target.value))}+ onBlur={() => {+ const v = clampRound(editorialRounds, DEFAULT_EDITORIAL_ROUNDS);+ setEditorialRounds(v);+ persistRounds({ maxEditorialRounds: v });+ }}+ className="w-16 px-2 py-1 rounded text-xs bg-port-bg border border-port-border text-gray-200"+ />+ </div>+ </div>+ <p className="text-[11px] text-gray-500">+ How many auto-resolve rounds each gate attempts before pausing for human review (0 skips the gate, max {ROUND_MAX}). Saved as the default and reused on Resume.+ </p><p className="text-[11px] text-gray-500">Runs under the CoS auto-run autonomy domain. With it set to <em>dry-run</em>, this only previews the plan.</p>diff --git a/client/src/components/pipeline/AutopilotPanel.test.jsx b/client/src/components/pipeline/AutopilotPanel.test.jsxindex d103a0f24b..ddc7ad026d 100644--- a/client/src/components/pipeline/AutopilotPanel.test.jsx+++ b/client/src/components/pipeline/AutopilotPanel.test.jsx@@ -10,6 +10,8 @@ vi.mock('../../services/api', () => ({getPipelineSeriesCanonReadiness: vi.fn(),getPipelineSeries: vi.fn(),listPipelineIssues: vi.fn(),+ getSettings: vi.fn(),+ patchSettingsSlice: vi.fn(),}));vi.mock('../ui/Toast', () => ({ default: { success: vi.fn(), error: vi.fn(), warning: vi.fn() } }));// Controllable SSE hook so tests don't touch EventSource. `sseLatest` lets a@@ -24,6 +26,8 @@ import {startPipelineAutopilot,getPipelineAutopilotStatus,getPipelineSeriesCanonReadiness,+ getSettings,+ patchSettingsSlice,} from '../../services/api';import toast from '../ui/Toast';import AutopilotPanel from './AutopilotPanel';@@ -41,6 +45,8 @@ beforeEach(() => {sseFrames = [];getPipelineAutopilotStatus.mockResolvedValue({ autopilot: null, active: false });startPipelineAutopilot.mockResolvedValue({ runId: 'r1', mode: 'execute', alreadyRunning: false });+ getSettings.mockResolvedValue({ pipelineEditorialChecks: {} });+ patchSettingsSlice.mockResolvedValue({});});describe('AutopilotPanel', () => {@@ -49,7 +55,9 @@ describe('AutopilotPanel', () => {await waitFor(() => expect(getPipelineAutopilotStatus).toHaveBeenCalled());fireEvent.click(screen.getByRole('button', { name: /run autopilot/i }));await waitFor(() => expect(startPipelineAutopilot).toHaveBeenCalledWith(- 's1', { includeVisual: true, fileGaps: false }, { silent: true },+ 's1',+ { includeVisual: true, fileGaps: false, maxArcVerifyRounds: 3, maxEditorialRounds: 2 },+ { silent: true },));});@@ -63,7 +71,9 @@ describe('AutopilotPanel', () => {fireEvent.click(checks[1]); // fileGaps -> truefireEvent.click(screen.getByRole('button', { name: /run autopilot/i }));await waitFor(() => expect(startPipelineAutopilot).toHaveBeenCalledWith(- 's1', { includeVisual: false, fileGaps: true }, { silent: true },+ 's1',+ { includeVisual: false, fileGaps: true, maxArcVerifyRounds: 3, maxEditorialRounds: 2 },+ { silent: true },));});diff --git a/server/lib/validation.js b/server/lib/validation.jsindex 1aca88f376..0fbab9d995 100644--- a/server/lib/validation.js+++ b/server/lib/validation.js@@ -1080,10 +1080,16 @@ export const editorialCustomCheckUpdateSchema = z.object(editorialCustomCheckSha// loop + UI read as "manuscript clean": 'noOpenHigh' (default), the stricter// 'noOpenHighOrMedium', or 'none' (disable). Optional + additive, so older peers// and a never-configured install fall through to the service default.+// `maxArcVerifyRounds` / `maxEditorialRounds` bound the autopilot's verify→resolve+// convergence loops before it pauses for human review (0 = skip that gate+// entirely). Persisted defaults the autopilot reads when a run doesn't pass a+// per-run override; raised cap (20) so a stubborn arc can be given more rounds.export const pipelineEditorialChecksSettingsSchema = z.object({checks: z.record(editorialCheckConfigSchema).optional(),customChecks: z.array(z.object({}).passthrough()).optional(),readinessGate: z.enum(['noOpenHigh', 'noOpenHighOrMedium', 'none']).optional(),+ maxArcVerifyRounds: z.number().int().min(0).max(20).optional(),+ maxEditorialRounds: z.number().int().min(0).max(20).optional(),}).strict();// Cursor-context payload for the CD-bridge suggest route — identical shape todiff --git a/server/routes/pipeline/autopilot.js b/server/routes/pipeline/autopilot.jsindex 652dde528c..46ca05abff 100644--- a/server/routes/pipeline/autopilot.js+++ b/server/routes/pipeline/autopilot.js@@ -31,9 +31,13 @@ const autopilotStartSchema = z.object({target: z.enum(['auto', 'text', 'visual']).optional().default('auto'),// Create CoS tasks for capability gaps (Phase 3).fileGaps: z.boolean().optional().default(false),- // Convergence bounds for the verify/review loops (0 = skip that gate).- maxArcVerifyRounds: z.number().int().min(0).max(5).optional(),- maxEditorialRounds: z.number().int().min(0).max(5).optional(),+ // Per-run convergence bounds for the verify/review loops (0 = skip that gate).+ // When omitted, the autopilot falls back to the persisted+ // pipelineEditorialChecks.{maxArcVerifyRounds,maxEditorialRounds} setting, then+ // to the module default. Cap mirrors the settings schema so the UI knob and a+ // direct API call agree on the ceiling.+ maxArcVerifyRounds: z.number().int().min(0).max(20).optional(),+ maxEditorialRounds: z.number().int().min(0).max(20).optional(),});router.post('/series/:id/autopilot/start', asyncHandler(async (req, res) => {diff --git a/server/services/pipeline/seriesAutopilot.js b/server/services/pipeline/seriesAutopilot.jsindex ebc8476536..e70f1ba455 100644--- a/server/services/pipeline/seriesAutopilot.js+++ b/server/services/pipeline/seriesAutopilot.js@@ -103,10 +103,30 @@ import { checkSeriesCanonReadiness } from './canonReadiness.js';const runs = new Map();// Bounded convergence loops — re-verify/re-review at most this many rounds, then-// pause for human review with the residual findings (see module header).+// pause for human review with the residual findings (see module header). These+// are the floor defaults; an install can raise them persistently via+// pipelineEditorialChecks.{maxArcVerifyRounds,maxEditorialRounds} (or a single+// run can override per-run through the autopilot start options).export const MAX_ARC_VERIFY_ROUNDS = 3;export const MAX_EDITORIAL_ROUNDS = 2;+// Resolve the effective round bounds for a run: an explicit per-run option wins,+// then the persisted pipelineEditorialChecks setting, then the module default.+// Returns integers only — a non-integer at any layer falls through to the next.+// Centralized so the loops, the dry-run plan, and the resume path all agree.+export function resolveAutopilotRounds(options = {}, settings = null) {+ const pec = settings?.pipelineEditorialChecks || {};+ const pick = (optKey, setKey, fallback) => {+ if (Number.isInteger(options?.[optKey])) return options[optKey];+ if (Number.isInteger(pec?.[setKey])) return pec[setKey];+ return fallback;+ };+ return {+ maxArcVerifyRounds: pick('maxArcVerifyRounds', 'maxArcVerifyRounds', MAX_ARC_VERIFY_ROUNDS),+ maxEditorialRounds: pick('maxEditorialRounds', 'maxEditorialRounds', MAX_EDITORIAL_ROUNDS),+ };+}+// When true, a comic-target run with `includeVisual` proceeds past the text +// editorial terminal into draft cover/page rendering (see runVisualDraft).export const VISUAL_DRAFT_ENABLED = true;@@ -439,7 +459,12 @@ async function runArcVerify(seriesId, record) {return {};}if (round === maxRounds) {- return { pause: true, reason: `arc verification did not converge after ${maxRounds} rounds`, residual: blocking };+ const plural = maxRounds === 1 ? 'round' : 'rounds';+ return {+ pause: true,+ reason: `Arc verification couldn't auto-resolve ${blocking.length} blocking finding(s) in ${maxRounds} ${plural} — paused for review. Edit the arc/volumes to address them, or raise the verify-rounds limit in Options and resume.`,+ residual: blocking,+ };}if (record.cancelRequested) return { canceled: true };// resolveVerifyIssues bills another action — recheck the budget so a single@@ -597,7 +622,12 @@ async function runEditorial(sId, record) {return {};}if (round === maxRounds) {- return { pause: true, reason: `editorial review did not converge after ${maxRounds} round(s)`, residual: blocking };+ const plural = maxRounds === 1 ? 'round' : 'rounds';+ return {+ pause: true,+ reason: `Editorial review couldn't auto-resolve ${blocking.length} blocking finding(s) in ${maxRounds} ${plural} — paused for review. Address them in the manuscript editor, or raise the editorial-rounds limit in Options and resume.`,+ residual: blocking,+ };}// Bounded auto-fix: apply a fix for each open high-severity comment, then// the loop re-analyzes. Each fix is wrapped so one bad anchor doesn't abort@@ -949,14 +979,16 @@ function buildDryRunPlan(series, issues, options) {if (noArc || seasons.length === 0) plan.push({ kind: 'generateArc', count: 1 });const emptySeasons = seasons.filter((s) => !ordered.some((i) => i.seasonId === s.id));if (emptySeasons.length) plan.push({ kind: 'generateEpisodes', count: emptySeasons.length });- plan.push({ kind: 'verifyArc', count: 1, note: `up to ${MAX_ARC_VERIFY_ROUNDS} rounds` });+ const arcRounds = Number.isInteger(options?.maxArcVerifyRounds) ? options.maxArcVerifyRounds : MAX_ARC_VERIFY_ROUNDS;+ plan.push({ kind: 'verifyArc', count: 1, note: arcRounds === 0 ? 'skipped (0 rounds)' : `up to ${arcRounds} rounds` });const beatsNeeded = seasons.filter((s) =>ordered.some((i) => i.seasonId === s.id && !isStageReady(i.stages?.idea))).length;if (beatsNeeded) plan.push({ kind: 'beatSheet', count: beatsNeeded });const textNeeded = ordered.filter((i) => !textReady(i, series)).length;if (textNeeded) plan.push({ kind: 'textStages', count: textNeeded });if (isComicTarget(series)) plan.push({ kind: 'scriptVerify', count: ordered.length });- plan.push({ kind: 'editorialReview', count: 1, note: `up to ${MAX_EDITORIAL_ROUNDS} rounds` });+ const edRounds = Number.isInteger(options?.maxEditorialRounds) ? options.maxEditorialRounds : MAX_EDITORIAL_ROUNDS;+ plan.push({ kind: 'editorialReview', count: 1, note: edRounds === 0 ? 'skipped (0 rounds)' : `up to ${edRounds} rounds` });plan.push({ kind: 'editorialChecks', count: 1, note: 'enabled editorial checks (#1284)' });plan.push({ kind: 'editorialHealthGate', count: 1, note: 'editorial health readiness gate (#1316)' });if (VISUAL_DRAFT_ENABLED && wantsVisual(options) && isComicTarget(series)) {@@ -988,6 +1020,14 @@ export async function startSeriesAutopilot(sId, options = {}) {return { rejected: true, mode: 'off' };}+ // Resolve the convergence-round bounds ONCE at start (per-run option →+ // persisted setting → default) and stamp them onto the run's options so the+ // synchronous loops, the dry-run plan, and a later resume all read the same+ // effective values. A resume reuses this same path, so a raised persisted+ // setting takes effect on the next Resume without re-specifying it.+ const settings = await getSettings().catch(() => null);+ const runOptions = { ...options, ...resolveAutopilotRounds(options, settings) };+if (existing) {// A finished run still in its replay window — evict it so this fresh run// fully replaces it (mirrors editorialAnalysisRunner).@@ -1005,7 +1045,7 @@ export async function startSeriesAutopilot(sId, options = {}) {cleanupTimer: null,startedAt: new Date().toISOString(),mode,- options,+ options: runOptions,runState: {arcAttempted: false,arcVerified: false,@@ -1031,7 +1071,7 @@ export async function startSeriesAutopilot(sId, options = {}) {if (mode === 'dry-run') {const series = await getSeries(sId);const issues = await listIssues({ seriesId: sId });- const plan = buildDryRunPlan(series, issues, options);+ const plan = buildDryRunPlan(series, issues, runOptions);broadcast(sId, { type: 'start', runId, mode, target: series.targetFormat, plan });// Carry the plan on the terminal frame too: a dry-run emits start +// complete synchronously, often before the client attaches, and@@ -1046,7 +1086,7 @@ export async function startSeriesAutopilot(sId, options = {}) {const series0 = await getSeries(sId);broadcast(sId, { type: 'start', runId, mode, target: series0.targetFormat });await persistMarker(sId, { status: 'running', runId, currentStep: null, residualFindings: [], lastError: null });- if (options.includeVisual && !VISUAL_DRAFT_ENABLED) {+ if (runOptions.includeVisual && !VISUAL_DRAFT_ENABLED) {broadcast(sId, { type: 'note', message: 'Draft visual rendering is not enabled in this build — running to text-ready + editorial review.' });}@@ -1054,7 +1094,7 @@ export async function startSeriesAutopilot(sId, options = {}) {while (!record.cancelRequested) {const series = await getSeries(sId);const issues = await listIssues({ seriesId: sId });- const step = resolveNextStep(series, issues, record.runState, options);+ const step = resolveNextStep(series, issues, record.runState, runOptions);if (step.kind === 'done') {await persistMarker(sId, { status: 'done', runId, currentStep: null });diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.jsindex e01eeacf2f..d1c57626e9 100644--- a/server/services/pipeline/seriesAutopilot.test.js+++ b/server/services/pipeline/seriesAutopilot.test.js@@ -108,6 +108,9 @@ vi.mock('./canonReadiness.js', () => ({ checkSeriesCanonReadiness }));// Mocked domainUsage binding, so a test can drive the budget per call.const { getDomainBudgetStatus } = await import('../domainUsage.js');+// Mocked settings binding, so a test can drive the persisted convergence-round+// defaults the autopilot reads at start.+const { getSettings } = await import('../settings.js');// Real services + the unit under test (imported AFTER the mocks above).const seriesSvc = await import('./series.js');@@ -148,6 +151,9 @@ beforeEach(() => {// Reset the budget mock to read the `budgetStatus` var (clearAllMocks keeps// implementations, but a prior test may have set a call-count-keyed one).getDomainBudgetStatus.mockImplementation(async () => budgetStatus);+ // Reset settings to empty so a test that set persisted convergence rounds+ // doesn't leak its default into the next test.+ getSettings.mockImplementation(async () => ({}));});// ---------------------------------------------------------------------------@@ -169,6 +175,28 @@ describe('resolveNextStep (pure)', () => {expect(step.kind).not.toBe('generateArc');});+ it('resolveAutopilotRounds: per-run option wins, else setting, else default', () => {+ const { resolveAutopilotRounds, MAX_ARC_VERIFY_ROUNDS, MAX_EDITORIAL_ROUNDS } = autopilot;+ // per-run option wins (including an explicit 0 = skip)+ expect(resolveAutopilotRounds(+ { maxArcVerifyRounds: 7, maxEditorialRounds: 0 },+ { pipelineEditorialChecks: { maxArcVerifyRounds: 4, maxEditorialRounds: 4 } },+ )).toEqual({ maxArcVerifyRounds: 7, maxEditorialRounds: 0 });+ // persisted setting fills in when no per-run override+ const fromSetting = resolveAutopilotRounds({}, { pipelineEditorialChecks: { maxArcVerifyRounds: 6 } });+ expect(fromSetting.maxArcVerifyRounds).toBe(6);+ expect(fromSetting.maxEditorialRounds).toBe(MAX_EDITORIAL_ROUNDS);+ // module default when neither is set+ expect(resolveAutopilotRounds({}, null)).toEqual({+ maxArcVerifyRounds: MAX_ARC_VERIFY_ROUNDS, maxEditorialRounds: MAX_EDITORIAL_ROUNDS,+ });+ // a non-integer at any layer falls through+ expect(resolveAutopilotRounds(+ { maxArcVerifyRounds: 2.5 },+ { pipelineEditorialChecks: { maxArcVerifyRounds: 'x' } },+ ).maxArcVerifyRounds).toBe(MAX_ARC_VERIFY_ROUNDS);+ });+it('regenerates the arc for an arc-only series with no volumes', () => {const arcOnly = { targetFormat: 'comic', arc: { logline: 'L', summary: 'S' }, seasons: [] };expect(resolveNextStep(arcOnly, []).kind).toBe('generateArc');@@ -431,6 +459,28 @@ describe('autopilot conductor', () => {expect(series.autopilot?.residualFindings?.[0]?.problem).toBe('plot hole');});+ it('uses the persisted maxArcVerifyRounds setting when no per-run override is given', async () => {+ verifyFindings = [{ severity: 'high', problem: 'plot hole', location: 'V1' }];+ getSettings.mockImplementation(async () => ({ pipelineEditorialChecks: { maxArcVerifyRounds: 4 } }));+ const { seriesId } = await seedComplete();+ await autopilot.startSeriesAutopilot(seriesId, {}); // no per-run rounds — settings drives it+ await waitFor(runFinished(seriesId));+ // 4 verify rounds (the persisted setting), 3 resolves, then a pause.+ expect(arcSpies.verifyArc).toHaveBeenCalledTimes(4);+ expect(arcSpies.resolveVerifyIssues).toHaveBeenCalledTimes(3);+ expect(autopilot.__testing.runs.get(seriesId)?.lastPayload?.type).toBe('paused');+ });++ it('a per-run override beats the persisted maxArcVerifyRounds setting', async () => {+ verifyFindings = [{ severity: 'high', problem: 'plot hole', location: 'V1' }];+ getSettings.mockImplementation(async () => ({ pipelineEditorialChecks: { maxArcVerifyRounds: 4 } }));+ const { seriesId } = await seedComplete();+ await autopilot.startSeriesAutopilot(seriesId, { maxArcVerifyRounds: 1 });+ await waitFor(runFinished(seriesId));+ expect(arcSpies.verifyArc).toHaveBeenCalledTimes(1);+ expect(arcSpies.resolveVerifyIssues).not.toHaveBeenCalled();+ });+it('pauses (no infinite loop) when episode generation produces no issues', async () => {const series = await seriesSvc.createSeries({ name: 'S', logline: 'L', premise: 'P', targetFormat: 'comic' });await seriesSvc.updateSeries(series.id, { arc: { logline: 'A', summary: 'S' } });