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

fix: retain rejected arc evidence across resume

[._.]/ Adam Eivy5f0efd37ac66
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 46fbfa6a5a..1436aa4821 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -92,3 +92,4 @@
- **A character repair that objectively filled the blank cast fields is no longer thrown away because the judge scored it a tie.** The foundation gate holds each repair provisional until an independent re-judge proves it helped the dimension it was asked to fix, and reverts it otherwise — the right rule for editorial work that can only be assessed by reading it. But the character dimension's core complaint is frequently a countable one ("every core character has blank physicalDescription, visualNotes, silhouetteNotes, visualIdentity and colorPalette"), and answering it is a countable act. On the observed run the repair authored all five visual fields for all five leads — roughly five minutes of a max-effort ensemble pass — the judge came back holding character at the same 5 while unrelated worldbuilding drifted 8 → 7, and the gate reverted every sheet and paused the run for review with the cast blank again. The gate now takes a second, LLM-free opinion before it reverts a *tied* character repair: it counts the blank framework and visual fields across the exact cast the repair is allowed to write (the series roster, minus locked members) before and after, and keeps the work when that count went down. A repair whose target regressed is still reverted, every other dimension is unaffected, and a repair that changed nothing measurable is still rejected — what changed is that a fact on disk now outranks a tied score.
- **A local video render now tells you how long it has left, once your machine has rendered something comparable.** Local renders run 15–40+ minutes and the only progress the UI could show was a step counter — "20%" on a job that might finish in four minutes or forty, with no way to tell which. Each completed render now records its wall-clock time alongside the shape it rendered (model, resolution, frames, steps), and a new job estimates itself from that history: a run of the same shape uses the median of your own measured runs outright, a different shape is placed on a least-squares fit of cost against pixels × frames × steps, and the fit's intercept — the fixed per-render cost of loading weights and decoding — is what lets a chained multi-chunk render be estimated as N renders rather than one long one. The estimate rides the render's started/progress events through to the client, where the progress bar reads "20% · ~18m 30s left". An install that has never measured a comparable render reports no estimate at all rather than a fabricated one, and the progress bar simply shows the percentage as before.
- **A video LoRA in the wrong key layout is now refused with the reason instead of quietly rendering an un-LoRA'd clip.** Downloaded LoRAs ship in several incompatible safetensors key conventions, and the LTX-2 loader fuses exactly one of them: `lora_A`/`lora_B` rank pairs, optionally under a `diffusion_model.` prefix. A kohya/LyCORIS file (`lora_down`/`lora_up` + `alpha`) or a diffusers/PEFT-prefixed file matches nothing in the transformer — so the render burned its full GPU time and came back looking like the LoRA had never been selected, with no error anywhere to explain it. Confusingly, kohya files are commonly published *with* the ComfyUI `diffusion_model.` prefix, so the prefix alone was never a reliable signal. PortOS now classifies the layout from the safetensors header (`bare` / `comfyui` / `diffusers` / `kohya` / `not_a_lora`) at install time, records it in the LoRA's sidecar, and backfills it on the next listing for LoRAs installed earlier. A render that selects an un-fusable one fails up front with a 400 naming the layout and what to use instead. A file whose header can't be read stays "undetermined" and is still allowed through — unreadable is not the same as unusable.
+- **A resumed arc verification no longer forgets why its last rewrite was rejected.** When Series Autopilot restored a safe checkpoint after a regressive rewrite, it persisted both the standing blockers and the rejected candidate's new blockers — but a fresh Resume discarded the latter before calling the resolver. That made the new run liable to repeat the same bad trade from the same checkpoint. A resumed arc gate now carries the bounded discarded set into every normal, corrective, and isolated resolve attempt as explicit avoid evidence, while non-arc and non-regression pauses start clean as before.
diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.js
index f790ebac1e..9bc3aaa070 100644
--- a/server/services/pipeline/seriesAutopilot.test.js
+++ b/server/services/pipeline/seriesAutopilot.test.js
@@ -2555,6 +2555,39 @@ describe('autopilot conductor', () => {
expect(last?.residualFindings).toEqual(holes(3, 'initial'));
});
+ it('carries a paused arc regression\'s discarded findings into the resumed resolver', async () => {
+ const residual = {
+ severity: 'high', problem: 'the standing custody rule is contradictory', location: 'V1',
+ };
+ const discarded = [
+ { severity: 'medium', problem: 'the rejected rewrite dropped a sacrifice beat', location: 'V1 issue 10' },
+ { severity: 'medium', problem: 'the rejected rewrite dropped a consent choice', location: 'V1 issue 9' },
+ ];
+ arcSpies.verifyArc.mockReset();
+ arcSpies.verifyArc
+ .mockImplementationOnce(async () => ({ issues: [residual] }))
+ .mockImplementationOnce(async () => ({ issues: [] }));
+
+ const { seriesId } = await seedComplete();
+ await seriesSvc.updateSeries(seriesId, {
+ autopilot: {
+ status: 'paused',
+ currentStep: 'verifyArcSpine',
+ pauseKind: 'regression',
+ residualFindings: [residual],
+ discardedFindings: discarded,
+ },
+ });
+ await autopilot.startSeriesAutopilot(seriesId, { maxArcVerifyRounds: 2 });
+ await waitFor(runFinished(seriesId));
+
+ expect(arcSpies.resolveVerifyIssues).toHaveBeenCalledWith(
+ seriesId,
+ expect.objectContaining({ findings: [residual], avoid: discarded, spineOnly: true }),
+ );
+ expect(autopilot.__testing.runs.get(seriesId)?.lastPayload?.type).toBe('complete');
+ });
+
it('reverts an equal-count arc candidate whose findings escalated in severity', async () => {
const before = [
{ severity: 'high', problem: 'recovery clock is contradictory', location: 'V1 issues 8-9' },
diff --git a/server/services/pipeline/seriesAutopilot/childRuns.js b/server/services/pipeline/seriesAutopilot/childRuns.js
index 8b44c36285..160385234e 100644
--- a/server/services/pipeline/seriesAutopilot/childRuns.js
+++ b/server/services/pipeline/seriesAutopilot/childRuns.js
@@ -267,6 +267,13 @@ export async function runArcVerify(seriesId, record, { spineOnly = false } = {})
// from a spine round misreports the failure to both the status line and the
// stall-diagnosis prompt that replays these frames.
const scope = spineOnly ? 'arcSpine' : 'arc';
+ const priorAvoid = Array.isArray(record.options.priorArcAvoidFindings)
+ ? record.options.priorArcAvoidFindings
+ : [];
+ // Preserve rejected-candidate evidence across Resume, then layer any newer
+ // regression from this run on top. `discardedSet` keeps the provider prompt
+ // bounded exactly like the persisted marker.
+ const avoidFindings = (current = []) => discardedSet([...priorAvoid, ...current]);
let convergence = { best: null, sinceBest: 0 };
let changed = false;
// Lowest verified blocker set seen in this gate, paired with the exact arc /
@@ -372,7 +379,7 @@ export async function runArcVerify(seriesId, record, { spineOnly = false } = {})
const beforeRetry = await budgetPause();
if (beforeRetry) return beforeRetry;
const retried = await resolveArcFindings(seriesId, record, {
- findings: rollbackTarget.blocking, avoid: discarded, spineOnly,
+ findings: rollbackTarget.blocking, avoid: avoidFindings(discarded), spineOnly,
});
if (retried?.applied !== false) changed = true;
// The restored state is what the retry has to beat, so the next round
@@ -392,7 +399,7 @@ export async function runArcVerify(seriesId, record, { spineOnly = false } = {})
const isolated = await isolateArcFindings(seriesId, record, {
scope, round, spineOnly,
baseline: rollbackTarget.blocking,
- avoid: discarded,
+ avoid: avoidFindings(discarded),
attemptsLeft: isolationLeft,
});
isolationLeft -= isolated.attempts;
@@ -472,7 +479,11 @@ export async function runArcVerify(seriesId, record, { spineOnly = false } = {})
// episode-empty plan, so its resolver may only patch the arc + volumes
// (#3789). The later full arc gate keeps episode corrections, which is the
// only place they can actually close a finding.
- const resolved = await resolveArcFindings(seriesId, record, { findings: blocking, spineOnly });
+ const resolved = await resolveArcFindings(seriesId, record, {
+ findings: blocking,
+ avoid: avoidFindings(),
+ spineOnly,
+ });
if (resolved?.applied !== false) changed = true;
lastResolve = { blocking, snapshot, runIds: arcResolveRunIds(resolved) };
broadcast(seriesId, {
diff --git a/server/services/pipeline/seriesAutopilot/orchestrator.js b/server/services/pipeline/seriesAutopilot/orchestrator.js
index 48a74ba9db..36f3cebc76 100644
--- a/server/services/pipeline/seriesAutopilot/orchestrator.js
+++ b/server/services/pipeline/seriesAutopilot/orchestrator.js
@@ -11,7 +11,7 @@ import { mergeSeverityWeights, resolveBlockingSet } from '../../../lib/editorial
import { loadState } from '../../cosState.js';
import { getDomainBudgetStatus } from '../../domainUsage.js';
import { getSettings } from '../../settings.js';
-import { getSeries, updateSeries } from '../series.js';
+import { getSeries, updateSeries, AUTOPILOT_DISCARDED_MAX } from '../series.js';
import { listIssues } from '../issues.js';
import { buildEditorialCheckPlan } from '../editorial/checkRunner.js';
import { runs } from './state.js';
@@ -66,6 +66,16 @@ export async function startSeriesAutopilot(sId, options = {}) {
// a resume re-reads them fresh. Loading the series here is cheap; a missing
// series (deleted mid-run) falls through to the frozen defaults.
const seriesRecord = await getSeries(sId).catch(() => null);
+ // A regressive arc repair is restored before the run pauses, and the rejected
+ // candidate's findings are persisted as `discardedFindings`. A fresh run used
+ // to forget that evidence and could immediately regenerate the same bad trade
+ // from the same checkpoint. Carry it into the next arc gate as an internal
+ // avoid-list only when the prior pause came from an arc verification step.
+ const priorArcAvoidFindings = seriesRecord?.autopilot?.status === 'paused'
+ && ['verifyArcSpine', 'verifyArc'].includes(seriesRecord.autopilot.currentStep)
+ && Array.isArray(seriesRecord.autopilot.discardedFindings)
+ ? seriesRecord.autopilot.discardedFindings.slice(0, AUTOPILOT_DISCARDED_MAX)
+ : [];
const autoSelectModels = resolveAutopilotAutoSelectModels(options, settings);
const modelPerformance = autoSelectModels
? await getModelPerformanceReport().catch((err) => {
@@ -108,6 +118,7 @@ export async function startSeriesAutopilot(sId, options = {}) {
creative: creativeRouteExplicit,
judge: judgeRouteExplicit,
},
+ priorArcAvoidFindings,
// Run provider/model: per-run override → the series' own `series.llm` →
// unset (stage pin / active provider downstream). Resolved ONCE here so the
// manual run, a scheduled run and the UI's "this run calls X / Y" copy all