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
feat: per-run editorial-check subset override for series autopilot (#1575)
[._.]/ Adam Eivy852cc642e4d7
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 795385be02..c226275bf9 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -52,6 +52,7 @@- **[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`)- **[issue-1574] Series Autopilot now retries a failed beats/text child run before giving up, instead of marking it attempted and silently skipping it.** When the autopilot delegates to a child runner (volume beats or per-issue text/scripts), the child can finish with its target stage still empty because the underlying LLM call failed. Previously the work was marked *attempted* before the result was inspected, so the resolver skipped it on the next pass — a failed beats run wasn't caught until a downstream stage tripped over the empty `idea`, and a failed text run only paused after the fact. The autopilot now **verifies the child actually produced its output** (every issue in the volume has a beat sheet / the issue's required script stages landed) and, on a miss, **retries the child once** (skip-existing, so the retry only fills the gap) before marking the work attempted. Each attempt is budget-gated and bills one action like any other step; if the output is still missing after the retry the run emits an escalation frame and **pauses for review with the missing stages as residual findings** rather than marching on toward a "done" with no script. A per-run **`maxChildRetries`** option tunes the retry budget (0 restores the legacy single-attempt behavior). (`server/services/pipeline/seriesAutopilot.js`)+- **[issue-1575] Series Autopilot can now run a subset of editorial checks for a single run, without touching the global enabled set.** The editorial-checks pass always ran *every* enabled check, so piloting one new check — or skipping an expensive one for a single run — meant toggling checks globally and remembering to flip them back. The autopilot start payload now accepts an optional **`editorialCheckIds`** array; when present, that run's editorial-checks pass evaluates only those check ids (unknown or disabled ids are ignored), and the same subset drives the budget gate so billing and execution agree on the set. Absent or empty falls back to the full enabled set (the unchanged default). The dry-run plan also names the subset (e.g. *"per-run subset of 2 editorial check(s)"*) instead of implying the whole enabled set will run. (`server/services/pipeline/seriesAutopilot.js`, `server/routes/pipeline/autopilot.js`)## Providersdiff --git a/server/routes/pipeline/autopilot.js b/server/routes/pipeline/autopilot.jsindex 6f12667c46..13148c591b 100644--- a/server/routes/pipeline/autopilot.js+++ b/server/routes/pipeline/autopilot.js@@ -48,6 +48,12 @@ const autopilotStartSchema = z.object({// Per-run only (no persisted default); falls back to MAX_CHILD_RETRIES. Shares// the convergence ceiling so a direct API call can't request an absurd budget.maxChildRetries: z.number().int().min(0).max(MAX_CONVERGENCE_ROUNDS).optional(),+ // Per-run editorial-check subset (#1575). When present, the editorial-checks+ // pass runs ONLY these check ids instead of all enabled checks — pilot one new+ // check, or skip an expensive one, without toggling the global enabled set.+ // Absent/empty = run every enabled check (the default). Per-run only (no+ // persisted default); unknown/disabled ids are silently ignored by the runner.+ editorialCheckIds: z.array(z.string().min(1)).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 f9af8e723c..bc6493b5f3 100644--- a/server/services/pipeline/seriesAutopilot.js+++ b/server/services/pipeline/seriesAutopilot.js@@ -1023,7 +1023,14 @@ async function runReverseOutlineRefresh(sId, record) {async function runEditorialChecksPass(sId, record) {if (record.cancelRequested) return { canceled: true };const settings = await getSettings();- const plan = await buildEditorialCheckPlan(sId, { settings });+ // #1575 — a per-run subset narrows the pass to specific check ids; absent/empty+ // runs every enabled check. Normalize to null so the budget gate+ // (buildEditorialCheckPlan) and the run (runEditorialChecks) resolve the SAME+ // set — otherwise the gate could bill against checks the run skips, or vice-versa.+ const checkIds = Array.isArray(record.options.editorialCheckIds) && record.options.editorialCheckIds.length+ ? record.options.editorialCheckIds+ : null;+ const plan = await buildEditorialCheckPlan(sId, { checkIds, settings });const hasLlmCheck = plan.checks.some((c) => c.kind === 'llm');if (hasLlmCheck) {const beforeChecks = await budgetPause();@@ -1034,7 +1041,7 @@ async function runEditorialChecksPass(sId, record) {// (the runner re-checks `signal.aborted` after each check). A live getter// reflects `record.cancelRequested` without a separate controller to manage.const signal = { get aborted() { return record.cancelRequested; } };- const result = await runEditorialChecks(sId, { ...providerOverrideOpts(record), settings, signal }).catch((err) => {+ const result = await runEditorialChecks(sId, { ...providerOverrideOpts(record), checkIds, settings, signal }).catch((err) => {console.log(`⚠️ autopilot: editorial checks failed for ${sId.slice(0, 12)}: ${err.message}`);return null;});@@ -1382,7 +1389,12 @@ function buildDryRunPlan(series, issues, options) {// the health gate that won't run.if (edRounds !== 0) {plan.push({ kind: 'reverseOutline', count: 1, note: 'refresh scene segmentation for editorial checks (#1349)' });- plan.push({ kind: 'editorialChecks', count: 1, note: 'enabled editorial checks (#1284)' });+ // #1575 — when a per-run subset is set, the plan must say so rather than imply+ // the full enabled set runs.+ const editorialSubset = Array.isArray(options?.editorialCheckIds) && options.editorialCheckIds.length;+ plan.push({ kind: 'editorialChecks', count: 1, note: editorialSubset+ ? `per-run subset of ${options.editorialCheckIds.length} editorial check(s) (#1575)`+ : 'enabled editorial checks (#1284)' });plan.push({ kind: 'editorialHealthGate', count: 1, note: 'editorial health readiness gate (#1316)' });}if (VISUAL_DRAFT_ENABLED && wantsVisual(options) && wantsComic(series, options)) {diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.jsindex f3fa938799..560f87c1bd 100644--- a/server/services/pipeline/seriesAutopilot.test.js+++ b/server/services/pipeline/seriesAutopilot.test.js@@ -295,6 +295,19 @@ describe('resolveNextStep (pure)', () => {expect(skipped).not.toContain('editorialHealthGate');});+ it('dry-run plan annotates the editorial-checks step with a per-run subset (#1575)', () => {+ const series = { targetFormat: 'comic', arc: { logline: 'L', summary: 'S' }, seasons: [{ id: 'se1', number: 1 }] };+ const issues = [{ id: 'i1', seasonId: 'se1', number: 1, arcPosition: 1, stages: {} }];+ const noteFor = (opts) => autopilot.__testing.buildDryRunPlan(series, issues, opts)+ .find((p) => p.kind === 'editorialChecks')?.note;+ // No subset → the plan advertises the full enabled set.+ expect(noteFor({})).toMatch(/enabled editorial checks/);+ // A subset → the plan says how many checks will run instead of implying all.+ expect(noteFor({ editorialCheckIds: ['pacing', 'continuity'] })).toMatch(/subset of 2 editorial check/);+ // An empty array is treated as "no override" — back to the full set.+ expect(noteFor({ editorialCheckIds: [] })).toMatch(/enabled editorial checks/);+ });+it('asks to generate episodes for a season with no issues', () => {const step = resolveNextStep(comic, []);expect(step).toMatchObject({ kind: 'generateEpisodes', seasonId: 'se1' });@@ -1199,6 +1212,32 @@ describe('autopilot conductor', () => {expect(done?.editorialCheckErroredIds).toEqual([]);});+ it('forwards a per-run editorialCheckIds subset to the checks pass + budget gate (#1575)', async () => {+ const { seriesId } = await seedComplete();+ await autopilot.startSeriesAutopilot(seriesId, { editorialCheckIds: ['pacing'], includeVisual: false });+ await waitFor(runFinished(seriesId));+ // Both the budget gate (buildEditorialCheckPlan) and the run (runEditorialChecks)+ // must see the same subset so billing and execution agree on the set.+ expect(checkRunnerSpies.runEditorialChecks).toHaveBeenCalledWith(+ seriesId,+ expect.objectContaining({ checkIds: ['pacing'] }),+ );+ expect(checkRunnerSpies.buildEditorialCheckPlan).toHaveBeenCalledWith(+ seriesId,+ expect.objectContaining({ checkIds: ['pacing'] }),+ );+ });++ it('passes checkIds:null (run all enabled) when no subset is given (#1575)', async () => {+ const { seriesId } = await seedComplete();+ await autopilot.startSeriesAutopilot(seriesId, { includeVisual: false });+ await waitFor(runFinished(seriesId));+ expect(checkRunnerSpies.runEditorialChecks).toHaveBeenCalledWith(+ seriesId,+ expect.objectContaining({ checkIds: null }),+ );+ });+it('files a CoS gap task when a verify gate stalls (fileGaps)', async () => {verifyFindings = [{ severity: 'high', problem: 'unresolved plot hole' }];const { seriesId } = await seedComplete();