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

simplify: dedupe convergence-round UI input, pause-reason, plan-note, and round cap

[._.]/ Adam Eivy13fce2a4dcaf
diff --git a/client/src/components/pipeline/AutopilotPanel.jsx b/client/src/components/pipeline/AutopilotPanel.jsx
index 85b70de2dd..0b28475dc6 100644
--- a/client/src/components/pipeline/AutopilotPanel.jsx
+++ b/client/src/components/pipeline/AutopilotPanel.jsx
@@ -30,6 +30,30 @@ const clampRound = (n, fallback) => {
return Math.max(ROUND_MIN, Math.min(ROUND_MAX, Math.round(v)));
};
+// A single convergence-round field for the Options popover. Allows '' mid-edit
+// (so the field can be cleared) and clamps + persists the chosen value on blur.
+function RoundInput({ id, label, settingKey, value, setValue, defaultValue, persist }) {
+ return (
+ <div className="flex items-center gap-2">
+ <label htmlFor={id} className="text-xs text-gray-300">{label}</label>
+ <input
+ id={id}
+ type="number"
+ min={ROUND_MIN}
+ max={ROUND_MAX}
+ value={value}
+ onChange={(e) => setValue(e.target.value === '' ? '' : Number(e.target.value))}
+ onBlur={() => {
+ const v = clampRound(value, defaultValue);
+ setValue(v);
+ persist({ [settingKey]: v });
+ }}
+ className="w-16 px-2 py-1 rounded text-xs bg-port-bg border border-port-border text-gray-200"
+ />
+ </div>
+ );
+}
+
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',
@@ -275,40 +299,24 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
File CoS tasks for gaps it can&apos;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>
+ <RoundInput
+ id="autopilot-arc-rounds"
+ label="Arc verify rounds"
+ settingKey="maxArcVerifyRounds"
+ value={arcRounds}
+ setValue={setArcRounds}
+ defaultValue={DEFAULT_ARC_ROUNDS}
+ persist={persistRounds}
+ />
+ <RoundInput
+ id="autopilot-editorial-rounds"
+ label="Editorial rounds"
+ settingKey="maxEditorialRounds"
+ value={editorialRounds}
+ setValue={setEditorialRounds}
+ defaultValue={DEFAULT_EDITORIAL_ROUNDS}
+ persist={persistRounds}
+ />
</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.
diff --git a/server/lib/validation.js b/server/lib/validation.js
index 0fbab9d995..38fe90ee96 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -1083,13 +1083,16 @@ export const editorialCustomCheckUpdateSchema = z.object(editorialCustomCheckSha
// `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.
+// per-run override; raised cap so a stubborn arc can be given more rounds. The
+// cap is exported so the autopilot route schema (and any UI) share one ceiling
+// instead of re-hardcoding it and drifting.
+export const MAX_CONVERGENCE_ROUNDS = 20;
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(),
+ maxArcVerifyRounds: z.number().int().min(0).max(MAX_CONVERGENCE_ROUNDS).optional(),
+ maxEditorialRounds: z.number().int().min(0).max(MAX_CONVERGENCE_ROUNDS).optional(),
}).strict();
// Cursor-context payload for the CD-bridge suggest route — identical shape to
diff --git a/server/routes/pipeline/autopilot.js b/server/routes/pipeline/autopilot.js
index 46ca05abff..e18d4fd54e 100644
--- a/server/routes/pipeline/autopilot.js
+++ b/server/routes/pipeline/autopilot.js
@@ -14,7 +14,7 @@
import { Router } from 'express';
import { z } from 'zod';
import { asyncHandler, ServerError } from '../../lib/errorHandler.js';
-import { validateRequest } from '../../lib/validation.js';
+import { validateRequest, MAX_CONVERGENCE_ROUNDS } from '../../lib/validation.js';
import * as seriesSvc from '../../services/pipeline/series.js';
import * as autopilot from '../../services/pipeline/seriesAutopilot.js';
import { mapServiceError, providerOverrideShape } from './shared.js';
@@ -36,8 +36,8 @@ const autopilotStartSchema = z.object({
// 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(),
+ maxArcVerifyRounds: z.number().int().min(0).max(MAX_CONVERGENCE_ROUNDS).optional(),
+ maxEditorialRounds: z.number().int().min(0).max(MAX_CONVERGENCE_ROUNDS).optional(),
});
router.post('/series/:id/autopilot/start', asyncHandler(async (req, res) => {
diff --git a/server/services/pipeline/seriesAutopilot.js b/server/services/pipeline/seriesAutopilot.js
index e70f1ba455..c8cc97f765 100644
--- a/server/services/pipeline/seriesAutopilot.js
+++ b/server/services/pipeline/seriesAutopilot.js
@@ -127,6 +127,22 @@ export function resolveAutopilotRounds(options = {}, settings = null) {
};
}
+// Per-gate copy for the non-convergence pause — shared by the arc-verify and
+// editorial loops so the two messages can't drift.
+const PAUSE_GATES = {
+ arc: { label: 'Arc verification', fix: 'Edit the arc/volumes to address them', limit: 'verify-rounds' },
+ editorial: { label: 'Editorial review', fix: 'Address them in the manuscript editor', limit: 'editorial-rounds' },
+};
+function convergencePauseReason(gate, maxRounds, blockingCount) {
+ const { label, fix, limit } = PAUSE_GATES[gate];
+ const plural = maxRounds === 1 ? 'round' : 'rounds';
+ return `${label} couldn't auto-resolve ${blockingCount} blocking finding(s) in ${maxRounds} ${plural} — `
+ + `paused for review. ${fix}, or raise the ${limit} limit in Options and resume.`;
+}
+
+// Dry-run plan note for a bounded gate: "skipped (0 rounds)" or "up to N rounds".
+const roundsNote = (rounds) => (rounds === 0 ? 'skipped (0 rounds)' : `up to ${rounds} 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;
@@ -459,12 +475,7 @@ async function runArcVerify(seriesId, record) {
return {};
}
if (round === maxRounds) {
- 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,
- };
+ return { pause: true, reason: convergencePauseReason('arc', maxRounds, blocking.length), residual: blocking };
}
if (record.cancelRequested) return { canceled: true };
// resolveVerifyIssues bills another action — recheck the budget so a single
@@ -622,12 +633,7 @@ async function runEditorial(sId, record) {
return {};
}
if (round === maxRounds) {
- 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,
- };
+ return { pause: true, reason: convergencePauseReason('editorial', maxRounds, blocking.length), 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
@@ -980,7 +986,7 @@ function buildDryRunPlan(series, issues, options) {
const emptySeasons = seasons.filter((s) => !ordered.some((i) => i.seasonId === s.id));
if (emptySeasons.length) plan.push({ kind: 'generateEpisodes', count: emptySeasons.length });
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` });
+ plan.push({ kind: 'verifyArc', count: 1, note: roundsNote(arcRounds) });
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 });
@@ -988,7 +994,7 @@ function buildDryRunPlan(series, issues, options) {
if (textNeeded) plan.push({ kind: 'textStages', count: textNeeded });
if (isComicTarget(series)) plan.push({ kind: 'scriptVerify', count: ordered.length });
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: 'editorialReview', count: 1, note: roundsNote(edRounds) });
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)) {