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

feat: surface errored editorial checks in autopilot telemetry instead of silent clean (#1573)

[._.]/ Adam Eivyee65b45048a3
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index acd5e018a2..2db8f9c925 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -50,6 +50,7 @@
- **[issue-1514] A per-stage provider pin now wins over Series Autopilot's run provider on *every* stage, not just script verification.** Pinning a single pipeline stage to a specific provider on the Prompts page already stuck for the script-verification gate, but the autopilot still threaded its run-wide provider as a hard *override* into every other stage it drives — arc generation and verification, episode seeding, prose/comic-script text stages, volume beats, the reverse-outline refresh, the editorial checks and their auto-fixes, and manuscript completeness — so a pin on any of those was silently ignored mid-run. The autopilot now passes its run provider as a soft *default* across all of them: a pinned stage keeps running on its chosen provider, while unpinned stages still follow the run's provider. As a deliberate consequence, when the run's provider is unavailable an unpinned stage now falls through to the active provider instead of failing the run with a "provider unavailable" error. Manual "regenerate with provider X" buttons are unchanged — an explicit per-call pick still wins everywhere.
- **[issue-1558] A per-stage *model* pin now also wins over Series Autopilot's run model — completing the #1514 work.** #1514 made a pinned stage keep its chosen *provider* during an autopilot run, but the run's *model* was still threaded as a hard override, so if you launched a run with both a provider and a model and a stage had its own provider+model pin, that stage ran on the pinned provider but with the *run's* model id — which could be wrong (or invalid) for the pinned provider, and ignored the model you deliberately set on the stage. The autopilot now passes its run model as a soft *default* too, with the same precedence as the provider: an explicit per-call model pick wins, then the stage's own model pin, then the run's model, then the provider's default — so a pinned stage now keeps both its provider *and* its model, while unpinned stages still follow the run's model.
- **[issue-1571] Series Autopilot now stops a verify/editorial loop early when it stops making progress, instead of burning the whole daily budget.** The arc-verification, beat-continuity, and editorial convergence loops auto-resolve their blocking findings and re-check, bounded by a round cap. Previously a loop that wasn't actually improving — a fix that re-introduced a different break, or that just oscillated between the same findings — kept spending AI budget round after round until it hit the cap and paused anyway. The autopilot now watches the blocking-finding count across rounds and, if it stops reaching a new low for two rounds running, pauses immediately with a distinct **"not converging"** state (visible as a badge on the paused panel) so you know it needs a human edit rather than more rounds. Loops that are genuinely making progress, and runs on the default round caps, are unaffected — the early stop only kicks in once a raised cap lets a stalled or oscillating loop keep going.
+- **[issue-1573] Series Autopilot now flags editorial checks that errored instead of reporting a silent "clean" run.** Each editorial check runs inside a boundary guard so one bad check (a malformed prompt, a provider timeout, a missing context) can't abort the whole pass — but a check that *threw* produced no findings, and the autopilot's per-pass broadcast always reported "0 blocking" and completed as if everything had run. A check that errored every run looked clean until someone inspected the raw per-check results. The editorial-checks round frame now carries an **errored count + the failing check ids**, and a run that finished with any errored check is qualified on the terminal summary and the persisted status banner (a caution, not "production-ready") so the partial failure is visible — the dimension that errored was never actually evaluated. The standalone "run editorial checks" panel surfaces the same errored aggregate on its completion frame. (`server/services/pipeline/seriesAutopilot.js`, `server/services/pipeline/editorial/checkRunner.js`, `server/services/pipeline/series.js`, `client/src/components/pipeline/AutopilotPanel.jsx`)
## Providers
diff --git a/client/src/components/pipeline/AutopilotPanel.jsx b/client/src/components/pipeline/AutopilotPanel.jsx
index 852a8124f5..9362bc7842 100644
--- a/client/src/components/pipeline/AutopilotPanel.jsx
+++ b/client/src/components/pipeline/AutopilotPanel.jsx
@@ -97,7 +97,7 @@ function frameLabel(f) {
case 'step:start': return `${stepLabel(f.kind)}…`;
case 'step:complete': return `${stepLabel(f.kind)} done`;
case 'step:skip': return `Skipped ${stepLabel(f.kind)}${f.reason ? ` — ${f.reason}` : ''}`;
- case 'verify:round': return `${f.scope} check — ${f.blocking} blocking of ${f.findings} finding(s)`;
+ case 'verify:round': return `${f.scope} check — ${f.blocking} blocking of ${f.findings} finding(s)${f.errored > 0 ? ` · ⚠️ ${f.errored} errored` : ''}`;
case 'render:queued': return `Queued draft render: ${f.target}`;
case 'gap:filed': return `Filed CoS task (${f.gapKind})`;
case 'paused': return `Paused — ${f.reason}`;
@@ -113,6 +113,9 @@ const RUN_ENDED = new Set(['complete', 'canceled', 'error', 'paused']);
// #1572 — shared caution tail for a `done` run that filed blocking script-craft
// gaps, so the completion toast and the persisted-status banner can't drift.
const craftGapCaution = (n) => `${n} filed script-craft gap${n === 1 ? '' : 's'} — resolve before rendering`;
+// #1573 — a `done` run where an editorial check threw never evaluated that
+// dimension, so "complete" is qualified rather than "production-ready".
+const editorialCheckCaution = (n) => `${n} editorial check${n === 1 ? '' : 's'} errored — review before trusting "clean"`;
function Findings({ items }) {
if (!items?.length) return null;
@@ -249,6 +252,7 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
if (latest.type === 'complete') {
if (latest.dryRun) toast.success('Autopilot plan ready');
else if (latest.craftGapIssues > 0) toast.warning(`Autopilot complete with ${craftGapCaution(latest.craftGapIssues)}`);
+ else if (latest.editorialCheckErrors > 0) toast.warning(`Autopilot complete — ${editorialCheckCaution(latest.editorialCheckErrors)}`);
else toast.success('Autopilot complete — draft is production-ready');
}
else if (latest.type === 'canceled') toast.success('Autopilot canceled');
@@ -429,18 +433,22 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
"production-ready" — those gaps still block downstream rendering. */}
{!active && ap && ap.status && ap.status !== 'idle' && ap.status !== 'running' ? (() => {
const doneWithGaps = ap.status === 'done' && ap.craftGapIssues > 0;
- const tone = ap.status === 'paused' || doneWithGaps ? 'warning' : ap.status === 'error' ? 'error' : 'success';
+ // #1573 — a done run with errored editorial checks is a caution too (the
+ // craft-gap message takes precedence when both are present).
+ const doneWithCheckErrors = ap.status === 'done' && !doneWithGaps && ap.editorialCheckErrors > 0;
+ const tone = ap.status === 'paused' || doneWithGaps || doneWithCheckErrors ? 'warning' : ap.status === 'error' ? 'error' : 'success';
return (
<div className={`px-3 pb-3 border-t pt-2 ${tone === 'warning' ? 'border-port-warning/30' : tone === 'error' ? 'border-port-error/30' : 'border-port-success/30'}`}>
<div className="flex items-center gap-2 text-xs">
{ap.status === 'paused' ? <PauseCircle size={13} className="text-port-warning" />
- : doneWithGaps ? <AlertCircle size={13} className="text-port-warning" />
+ : doneWithGaps || doneWithCheckErrors ? <AlertCircle size={13} className="text-port-warning" />
: ap.status === 'done' ? <CheckCircle2 size={13} className="text-port-success" />
: <AlertCircle size={13} className="text-port-error" />}
<span className={tone === 'warning' ? 'text-port-warning' : tone === 'success' ? 'text-port-success' : 'text-port-error'}>
{ap.status === 'paused' ? (ap.currentStep ? `Paused at ${stepLabel(ap.currentStep)}` : 'Paused')
: doneWithGaps ? `Completed with ${craftGapCaution(ap.craftGapIssues)}`
- : ap.status === 'done' ? 'Last run completed — draft is production-ready' : 'Last run errored'}
+ : doneWithCheckErrors ? `Completed — ${editorialCheckCaution(ap.editorialCheckErrors)}`
+ : ap.status === 'done' ? 'Last run completed — draft is production-ready' : 'Last run errored'}
</span>
{ap.status === 'paused' && ap.pauseKind === 'divergence' ? (
<span
diff --git a/client/src/components/pipeline/AutopilotPanel.test.jsx b/client/src/components/pipeline/AutopilotPanel.test.jsx
index c7746bb667..be76e2761a 100644
--- a/client/src/components/pipeline/AutopilotPanel.test.jsx
+++ b/client/src/components/pipeline/AutopilotPanel.test.jsx
@@ -169,6 +169,20 @@ describe('AutopilotPanel', () => {
expect(screen.getByText(/Completed with 1 filed script-craft gap —/i)).toBeInTheDocument();
});
+ it('qualifies a done marker with errored editorial checks as a caution (#1573)', async () => {
+ renderPanel({ id: 's1', targetFormat: 'comic', autopilot: { status: 'done', craftGapIssues: 0, editorialCheckErrors: 2 } });
+ await waitFor(() => expect(getPipelineAutopilotStatus).toHaveBeenCalled());
+ expect(screen.getByText(/2 editorial checks errored — review before trusting/i)).toBeInTheDocument();
+ expect(screen.queryByText(/draft is production-ready/i)).not.toBeInTheDocument();
+ });
+
+ it('prefers the craft-gap caution over the editorial-check caution when both are present (#1573)', async () => {
+ renderPanel({ id: 's1', targetFormat: 'comic', autopilot: { status: 'done', craftGapIssues: 1, craftGapFindings: 1, editorialCheckErrors: 1 } });
+ await waitFor(() => expect(getPipelineAutopilotStatus).toHaveBeenCalled());
+ expect(screen.getByText(/Completed with 1 filed script-craft gap —/i)).toBeInTheDocument();
+ expect(screen.queryByText(/editorial check/i)).not.toBeInTheDocument();
+ });
+
it('ignores a stale terminal frame from a previous run when starting again', async () => {
startPipelineAutopilot.mockResolvedValue({ runId: 'B', mode: 'execute' });
sseLatest = { type: 'complete', runId: 'A' }; // leftover terminal frame from run A
diff --git a/server/services/pipeline/editorial/checkRunner.js b/server/services/pipeline/editorial/checkRunner.js
index 9c8f441b77..a89090d360 100644
--- a/server/services/pipeline/editorial/checkRunner.js
+++ b/server/services/pipeline/editorial/checkRunner.js
@@ -712,6 +712,21 @@ export function cancelEditorialChecks(seriesId) {
* progress lands via SSE. Re-calling while a run is in flight resolves to the
* existing runId.
*/
+/**
+ * Summarize a `perCheck` array (the `{ checkId, count|error|skipped }` entries
+ * `runEditorialChecks` returns) into the errored aggregate surfaced on the
+ * completion frame and the autopilot run summary — so a check that throws every
+ * pass is visible instead of hiding behind a silent "clean" run (#1573). Shared
+ * by the standalone run route and `seriesAutopilot.runEditorialChecksPass` so
+ * both frames name the fields identically.
+ */
+export function summarizeCheckErrors(perCheck) {
+ const erroredCheckIds = (Array.isArray(perCheck) ? perCheck : [])
+ .filter((c) => c?.error)
+ .map((c) => c.checkId);
+ return { errored: erroredCheckIds.length, erroredCheckIds };
+}
+
export function startEditorialChecksRun(seriesId, options = {}) {
return runner.start(seriesId, async ({ runId, signal, record, broadcast }) => {
broadcast({ type: 'start', runId });
@@ -727,14 +742,19 @@ export function startEditorialChecksRun(seriesId, options = {}) {
console.log(`📝 editorial checks canceled — series=${String(seriesId).slice(0, 12)}`);
return;
}
+ const { errored, erroredCheckIds } = summarizeCheckErrors(result.perCheck);
broadcast({
type: 'complete',
runId,
findingCount: result.findings.length,
perCheck: result.perCheck,
+ // #1573 — surface errored checks on the terminal frame so a check that
+ // throws every run is visible instead of reporting a silent "clean".
+ errored,
+ erroredCheckIds,
completedAt: new Date().toISOString(),
});
- console.log(`📝 editorial checks complete — series=${String(seriesId).slice(0, 12)} findings=${result.findings.length}`);
+ console.log(`📝 editorial checks complete — series=${String(seriesId).slice(0, 12)} findings=${result.findings.length}${errored ? ` — ⚠️ ${errored} check(s) errored: ${erroredCheckIds.join(', ')}` : ''}`);
});
}
diff --git a/server/services/pipeline/editorial/checkRunner.test.js b/server/services/pipeline/editorial/checkRunner.test.js
index 90281e9231..4470149ced 100644
--- a/server/services/pipeline/editorial/checkRunner.test.js
+++ b/server/services/pipeline/editorial/checkRunner.test.js
@@ -76,7 +76,7 @@ vi.mock('../reverseOutline.js', () => ({ getReverseOutline: vi.fn(async () => ou
let editorialState = { characters: [] };
vi.mock('../editorialAnalysis.js', () => ({ getSeriesEditorial: vi.fn(async () => editorialState) }));
-const { runEditorialChecks, buildEditorialCheckPlan, getReviewWithStaleness, enabledChecksConsumeReverseOutline } = await import('./checkRunner.js');
+const { runEditorialChecks, buildEditorialCheckPlan, getReviewWithStaleness, enabledChecksConsumeReverseOutline, summarizeCheckErrors } = await import('./checkRunner.js');
const { runStagedLLM, resolveStageContext } = await import('../../../lib/stageRunner.js');
const { collectManuscriptSections } = await import('../arcPlanner.js');
const { getSeriesCanon } = await import('../seriesCanon.js');
@@ -375,6 +375,23 @@ describe('runEditorialChecks', () => {
});
});
+describe('summarizeCheckErrors (#1573)', () => {
+ it('extracts the count + checkIds of errored perCheck entries', () => {
+ const perCheck = [
+ { checkId: 'pacing', count: 0, error: 'provider timeout' },
+ { checkId: 'continuity', count: 2 },
+ { checkId: 'naming', count: 0, skipped: true },
+ { checkId: 'info-dump', error: 'boom' },
+ ];
+ expect(summarizeCheckErrors(perCheck)).toEqual({ errored: 2, erroredCheckIds: ['pacing', 'info-dump'] });
+ });
+
+ it('reports zero for a clean pass and tolerates a non-array', () => {
+ expect(summarizeCheckErrors([{ checkId: 'pacing', count: 1 }])).toEqual({ errored: 0, erroredCheckIds: [] });
+ expect(summarizeCheckErrors(undefined)).toEqual({ errored: 0, erroredCheckIds: [] });
+ });
+});
+
describe('visual.shot-continuity (#1315)', () => {
// Enable ONLY the shot-continuity check so the assertions don't pick up
// naming/info-dump findings (and the LLM mock isn't exercised).
diff --git a/server/services/pipeline/series.js b/server/services/pipeline/series.js
index 4997e66ea5..872865e6ff 100644
--- a/server/services/pipeline/series.js
+++ b/server/services/pipeline/series.js
@@ -153,6 +153,11 @@ export const sanitizeAutopilot = (raw) => {
// Same transient-marker rationale as pauseKind: no schema-gate bump.
craftGapIssues: toCount(raw.craftGapIssues),
craftGapFindings: toCount(raw.craftGapFindings),
+ // #1573 — count of editorial checks that errored during the run's checks
+ // pass. A `done` run with errored>0 didn't actually evaluate those checks, so
+ // the UI flags it instead of reporting clean. Same transient-marker rationale
+ // as craftGap* / pauseKind: no schema-gate bump.
+ editorialCheckErrors: toCount(raw.editorialCheckErrors),
updatedAt: isStr(raw.updatedAt) ? raw.updatedAt : null,
};
};
diff --git a/server/services/pipeline/seriesAutopilot.js b/server/services/pipeline/seriesAutopilot.js
index 0314aac8d9..564b2c8f19 100644
--- a/server/services/pipeline/seriesAutopilot.js
+++ b/server/services/pipeline/seriesAutopilot.js
@@ -92,7 +92,7 @@ import {
import * as volumeBeatsRunner from './volumeBeatsRunner.js';
import * as autoRunner from './autoRunner.js';
import { seedReviewFromFindings, getReview } from './manuscriptReview.js';
-import { runEditorialChecks, buildEditorialCheckPlan, enabledChecksConsumeReverseOutline } from './editorial/checkRunner.js';
+import { runEditorialChecks, buildEditorialCheckPlan, enabledChecksConsumeReverseOutline, summarizeCheckErrors } from './editorial/checkRunner.js';
import { generateReverseOutline, getReverseOutline } from './reverseOutline.js';
import { computeHealth, openBlockers } from './editorialScore.js';
import { getSettings } from '../settings.js';
@@ -977,7 +977,16 @@ async function runEditorialChecksPass(sId, record) {
if (result?.canceled || record.cancelRequested) return { canceled: true };
if (result) {
if (hasLlmCheck) await recordDomainUsage('cos', { actions: 1 });
- broadcast(sId, { type: 'verify:round', scope: 'editorialChecks', round: 1, findings: result.findings.length, blocking: 0 });
+ // #1573 — a check whose run() threw is recorded in perCheck.error but the
+ // pass otherwise looks clean. Surface the errored count + failing checkIds on
+ // the round frame and accumulate them onto the run so the terminal summary
+ // can flag a partial failure (no silent "complete").
+ const { errored, erroredCheckIds } = summarizeCheckErrors(result.perCheck);
+ erroredCheckIds.forEach((id) => record.runState.editorialCheckErroredIds.add(id));
+ broadcast(sId, { type: 'verify:round', scope: 'editorialChecks', round: 1, findings: result.findings.length, blocking: 0, errored, erroredCheckIds });
+ if (errored) {
+ console.error(`❌ autopilot: ${errored} editorial check(s) errored — series=${sId.slice(0, 12)} ${erroredCheckIds.join(', ')}`);
+ }
}
record.runState.editorialChecksReviewed = true;
return {};
@@ -1385,6 +1394,10 @@ export async function startSeriesAutopilot(sId, options = {}) {
// render blockers the user still has to resolve.
scriptCraftGapIssues: new Set(),
scriptCraftBlocking: 0,
+ // #1573 — checkIds of editorial checks that threw during this run's checks
+ // pass. Surfaced on the terminal `complete` frame + persisted marker so a
+ // check that errors every run is visible instead of a silent "clean".
+ editorialCheckErroredIds: new Set(),
},
activeChild: null,
};
@@ -1430,9 +1443,15 @@ export async function startSeriesAutopilot(sId, options = {}) {
// on both the persisted marker and the terminal frame.
const craftGapIssues = record.runState.scriptCraftGapIssues.size;
const craftGapFindings = record.runState.scriptCraftBlocking;
- await persistMarker(sId, { status: 'done', runId, currentStep: null, craftGapIssues, craftGapFindings });
- broadcast(sId, { type: 'complete', runId, steps: ordinal, craftGapIssues, craftGapFindings, completedAt: new Date().toISOString() });
- console.log(`✅ autopilot complete — series=${sId.slice(0, 12)} steps=${ordinal}${craftGapIssues ? ` (${craftGapIssues} issue(s) with filed script-craft gaps)` : ''}`);
+ // #1573 — qualify "complete" when an editorial check threw this run: the
+ // run finished, but a check that errored produced no findings, so its
+ // dimension was never actually evaluated. Persist the count + carry the
+ // failing checkIds on the frame so the UI flags it instead of "clean".
+ const editorialCheckErroredIds = [...record.runState.editorialCheckErroredIds];
+ const editorialCheckErrors = editorialCheckErroredIds.length;
+ await persistMarker(sId, { status: 'done', runId, currentStep: null, craftGapIssues, craftGapFindings, editorialCheckErrors });
+ broadcast(sId, { type: 'complete', runId, steps: ordinal, craftGapIssues, craftGapFindings, editorialCheckErrors, editorialCheckErroredIds, completedAt: new Date().toISOString() });
+ console.log(`✅ autopilot complete — series=${sId.slice(0, 12)} steps=${ordinal}${craftGapIssues ? ` (${craftGapIssues} issue(s) with filed script-craft gaps)` : ''}${editorialCheckErrors ? ` (${editorialCheckErrors} editorial check(s) errored: ${editorialCheckErroredIds.join(', ')})` : ''}`);
return;
}
diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.js
index 82fcde5b67..62b78b90cb 100644
--- a/server/services/pipeline/seriesAutopilot.test.js
+++ b/server/services/pipeline/seriesAutopilot.test.js
@@ -76,10 +76,19 @@ vi.mock('./manuscriptReview.js', () => ({
// Drives whether the reverse-outline refresh step (#1349) thinks a scene-consuming
// check is enabled. Default false so the existing conductor runs skip it cheaply.
let reverseOutlineConsumed = false;
+// Drives the perCheck array the editorial-checks pass sees, so a test can inject
+// an errored check and assert it surfaces in the run summary (#1573).
+let editorialChecksPerCheck = [];
const checkRunnerSpies = {
- runEditorialChecks: vi.fn(async () => ({ runId: 'ec', findings: [], perCheck: [], canceled: false })),
+ runEditorialChecks: vi.fn(async () => ({ runId: 'ec', findings: [], perCheck: editorialChecksPerCheck, canceled: false })),
buildEditorialCheckPlan: vi.fn(async () => ({ seriesId: 's', checks: [], enabledCount: 0, consumesReverseOutline: reverseOutlineConsumed })),
enabledChecksConsumeReverseOutline: vi.fn(() => reverseOutlineConsumed),
+ // Real pure impl (the module is fully mocked) so the SUT's error-summarizing
+ // matches production behavior without pulling checkRunner's heavy imports.
+ summarizeCheckErrors: (perCheck) => {
+ const erroredCheckIds = (Array.isArray(perCheck) ? perCheck : []).filter((c) => c?.error).map((c) => c.checkId);
+ return { errored: erroredCheckIds.length, erroredCheckIds };
+ },
};
vi.mock('./editorial/checkRunner.js', () => checkRunnerSpies);
@@ -166,6 +175,7 @@ beforeEach(() => {
canonUndescribed = [];
reverseOutlineConsumed = false;
reverseOutlineState = { status: 'complete', stale: false };
+ editorialChecksPerCheck = [];
nextTaskId = 0;
autopilot.__testing.runs.clear();
vi.clearAllMocks();
@@ -1077,6 +1087,34 @@ describe('autopilot conductor', () => {
expect(done?.craftGapFindings).toBe(0);
});
+ it('flags errored editorial checks on the terminal complete frame + marker (#1573)', async () => {
+ editorialChecksPerCheck = [
+ { checkId: 'pacing', count: 0, error: 'provider timeout' },
+ { checkId: 'continuity', count: 2 },
+ ];
+ const { seriesId } = await seedComplete();
+ await autopilot.startSeriesAutopilot(seriesId, { includeVisual: false });
+ await waitFor(runFinished(seriesId));
+ const done = autopilot.__testing.runs.get(seriesId)?.lastPayload;
+ expect(done?.type).toBe('complete');
+ expect(done?.editorialCheckErrors).toBe(1);
+ expect(done?.editorialCheckErroredIds).toEqual(['pacing']);
+ const marker = (await seriesSvc.getSeries(seriesId)).autopilot;
+ expect(marker.status).toBe('done');
+ expect(marker.editorialCheckErrors).toBe(1);
+ });
+
+ it('reports a clean complete (no errored checks) when every editorial check ran (#1573)', async () => {
+ editorialChecksPerCheck = [{ checkId: 'pacing', count: 0 }, { checkId: 'continuity', count: 1 }];
+ const { seriesId } = await seedComplete();
+ await autopilot.startSeriesAutopilot(seriesId, { includeVisual: false });
+ await waitFor(runFinished(seriesId));
+ const done = autopilot.__testing.runs.get(seriesId)?.lastPayload;
+ expect(done?.type).toBe('complete');
+ expect(done?.editorialCheckErrors).toBe(0);
+ expect(done?.editorialCheckErroredIds).toEqual([]);
+ });
+
it('files a CoS gap task when a verify gate stalls (fileGaps)', async () => {
verifyFindings = [{ severity: 'high', problem: 'unresolved plot hole' }];
const { seriesId } = await seedComplete();